Author: abelevich
Date: 2007-05-05 12:00:24 -0400 (Sat, 05 May 2007)
New Revision: 662
Added:
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/datagrid/service/
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/datagrid/service/ImageStore.java
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/datagrid/service/JiraService.java
Log:
Added:
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/datagrid/service/ImageStore.java
===================================================================
---
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/datagrid/service/ImageStore.java
(rev 0)
+++
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/datagrid/service/ImageStore.java 2007-05-05
16:00:24 UTC (rev 662)
@@ -0,0 +1,43 @@
+/*
+ * Copyright
+ * Copyright (c) Exadel,Inc. 2006
+ * All rights reserved.
+ *
+ * History
+ * $Source:
/cvs-master/intralinks-jsf-comps/web-projects/data-view-grid-demo/src/com/exadel/jsf/demo/datagrid/service/ImageStore.java,v
$
+ * $Revision: 1.1 $
+ */
+
+package org.richfaces.demo.datagrid.service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class ImageStore{
+ public ImageStore() {
+ super();
+ }
+
+ private Map <Object, String> images = new HashMap<Object, String>();
+
+
+ /**
+ * @return the images
+ */
+ public Map <Object, String> getImages() {
+ return images;
+ }
+
+ /**
+ * @param images the images to set
+ */
+ public void setImages(Map <Object, String> images) {
+ this.images = images;
+ }
+
+
+}
Added:
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/datagrid/service/JiraService.java
===================================================================
---
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/datagrid/service/JiraService.java
(rev 0)
+++
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/datagrid/service/JiraService.java 2007-05-05
16:00:24 UTC (rev 662)
@@ -0,0 +1,169 @@
+/*
+ * Copyright
+ * Copyright (c) Exadel,Inc. 2006
+ * All rights reserved.
+ *
+ * History
+ * $Source:
/cvs-master/intralinks-jsf-comps/web-projects/data-view-grid-demo/src/com/exadel/jsf/demo/datagrid/service/JiraService.java,v
$
+ * $Revision: 1.5 $
+ */
+
+package org.richfaces.demo.datagrid.service;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.digester.Digester;
+import org.apache.commons.digester.ExtendedBaseRules;
+import org.apache.commons.digester.Rule;
+import org.richfaces.demo.datagrid.model.Channel;
+import org.richfaces.demo.datagrid.model.Issue;
+import org.richfaces.demo.datagrid.model.JiraUser;
+import org.richfaces.demo.datagrid.model.Key;
+import org.richfaces.demo.datagrid.model.Priority;
+import org.richfaces.demo.datagrid.model.Status;
+import org.richfaces.demo.datagrid.model.Type;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class JiraService {
+
+ private static final String KEY = "jiraService";
+
+ private static final JiraService instance = new JiraService();
+
+ /**
+ *
+ */
+ public JiraService() {
+ super();
+ init();
+ }
+
+ private Channel channel = null;
+ public Channel getChannel() {
+
+ if (channel == null) {
+ init();
+ }
+
+ return channel;
+ }
+ public void setChannel(Channel channel) {
+ this.channel = channel;
+ }
+
+
+ static class JiraCursedRule extends Rule {
+
+ private String propertyName;
+
+ public JiraCursedRule(String propertyName) {
+ super();
+ this.propertyName = propertyName;
+ }
+
+ @Override
+ public void body(String namespace, String name, String text) throws Exception {
+ Object bean = digester.peek();
+ PropertyUtils.setSimpleProperty(bean, propertyName, text.trim());
+
+ }
+
+ @Override
+ public void finish() throws Exception {
+ // TODO Auto-generated method stub
+ super.finish();
+ }
+ }
+
+
+ private void init() {
+ channel = new Channel();
+ Digester digester = new Digester();
+ digester.setValidating(false);
+ digester.setNamespaceAware(false);
+ digester.setEntityResolver(new EntityResolver() {
+ public InputSource resolveEntity(String publicId, String systemId) throws
SAXException, IOException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ });
+ digester.setRules(new ExtendedBaseRules());
+
+ digester.push(channel);
+
+ String path = "rss/channel";
+ digester.addBeanPropertySetter(path + "/?");
+
+ path = path + "/item";
+ String issuePath = path;
+ digester.addObjectCreate(path, Issue.class);
+ digester.addSetProperties(path);
+ digester.addBeanPropertySetter(path + "/?");
+ digester.addSetNext(path, "addIssue");
+
+ path = issuePath + "/key";
+ digester.addObjectCreate(path, Key.class);
+ digester.addSetProperties(path);
+ digester.addRule(path, new JiraCursedRule("value"));
+ digester.addBeanPropertySetter(path + "/?");
+ digester.addSetNext(path, "setKey");
+
+ path = issuePath + "/priority";
+ digester.addObjectCreate(path, Priority.class);
+ digester.addSetProperties(path);
+ digester.addBeanPropertySetter(path + "/?");
+ digester.addRule(path, new JiraCursedRule("name"));
+ digester.addSetNext(path, "setPriority");
+
+ path = issuePath + "/status";
+ digester.addObjectCreate(path, Status.class);
+ digester.addSetProperties(path);
+ digester.addBeanPropertySetter(path + "/?");
+ digester.addRule(path, new JiraCursedRule("name"));
+ digester.addSetNext(path, "setStatus");
+
+ path = issuePath + "/assignee";
+ digester.addObjectCreate(path, JiraUser.class);
+ digester.addSetProperties(path);
+ digester.addBeanPropertySetter(path + "/?");
+ digester.addRule(path, new JiraCursedRule("name"));
+ digester.addSetNext(path, "setAssignee");
+
+ path = issuePath + "/reporter";
+ digester.addObjectCreate(path, JiraUser.class);
+ digester.addSetProperties(path);
+ digester.addBeanPropertySetter(path + "/?");
+ digester.addRule(path, new JiraCursedRule("name"));
+ digester.addSetNext(path, "setReporter");
+
+ path = issuePath + "/type";
+ digester.addObjectCreate(path, Type.class);
+ digester.addSetProperties(path);
+ digester.addBeanPropertySetter(path + "/?");
+ digester.addRule(path, new JiraCursedRule("name"));
+ digester.addSetNext(path, "setType");
+ try {
+ //InputStream stream; //=
Thread.currentThread().getContextClassLoader().getResourceAsStream();
+ //stream =
FacesContext.getCurrentInstance().getExternalContext().getResourceAsStream("/WEB-INF/xmldata/jira.xml");
+ //JarInputStream stream = getXMLInputStream();
+ InputStream stream =
Thread.currentThread().getContextClassLoader().getResourceAsStream("jira.xml");
+ digester.parse(stream);
+ stream.close();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ public static final JiraService getInstance() {
+ return instance;
+ }
+}
Show replies by date