about summary refs log tree commit diff stats
path: root/client/trunk
diff options
context:
space:
mode:
Diffstat (limited to 'client/trunk')
-rw-r--r--client/trunk/nbproject/project.properties19
-rw-r--r--client/trunk/src/com/fourisland/instadisc/Database/Item.java85
-rw-r--r--client/trunk/src/com/fourisland/instadisc/Database/Subscription.java52
-rw-r--r--client/trunk/src/com/fourisland/instadisc/Database/Wrapper.java79
-rw-r--r--client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java1
-rw-r--r--client/trunk/src/com/fourisland/instadisc/IDItemListCellRenderer.java54
-rw-r--r--client/trunk/src/com/fourisland/instadisc/InstaDiscApp.java4
-rw-r--r--client/trunk/src/com/fourisland/instadisc/InstaDiscThread.java2
-rw-r--r--client/trunk/src/com/fourisland/instadisc/InstaDiscView.form3
-rw-r--r--client/trunk/src/com/fourisland/instadisc/InstaDiscView.java52
-rw-r--r--client/trunk/src/com/fourisland/instadisc/Item/Categories/Blogpost.java6
-rw-r--r--client/trunk/src/com/fourisland/instadisc/Item/Categories/Category.java36
-rw-r--r--client/trunk/src/com/fourisland/instadisc/Item/Item.java55
-rw-r--r--client/trunk/src/com/fourisland/instadisc/Item/Verification.java1
-rw-r--r--client/trunk/src/com/fourisland/instadisc/resources/InstaDiscApp.properties12
-rw-r--r--client/trunk/src/com/fourisland/instadisc/resources/InstaDiscView.properties2
16 files changed, 433 insertions, 30 deletions
diff --git a/client/trunk/nbproject/project.properties b/client/trunk/nbproject/project.properties index a239641..505e8b5 100644 --- a/client/trunk/nbproject/project.properties +++ b/client/trunk/nbproject/project.properties
@@ -1,7 +1,7 @@
1application.desc=A simple java desktop application based on Swing Application Framework 1application.desc=A productivity-increasing notification program
2application.homepage=http://appframework.dev.java.net 2application.homepage=http://fourisland.com/projects/instadisc
3application.title=Basic Application Example 3application.title=InstaDisc
4application.vendor=Sun Microsystems Inc. 4application.vendor=Four Island
5build.classes.dir=${build.dir}/classes 5build.classes.dir=${build.dir}/classes
6build.classes.excludes=**/*.java,**/*.form 6build.classes.excludes=**/*.java,**/*.form
7# This directory is removed when the project is cleaned: 7# This directory is removed when the project is cleaned:
@@ -29,7 +29,8 @@ javac.classpath=\
29 ${libs.XML-RPC.classpath}:\ 29 ${libs.XML-RPC.classpath}:\
30 ${libs.BDB.classpath}:\ 30 ${libs.BDB.classpath}:\
31 ${file.reference.commons-logging-1.1.jar}:\ 31 ${file.reference.commons-logging-1.1.jar}:\
32 ${file.reference.ws-commons-util-1.0.2.jar} 32 ${file.reference.ws-commons-util-1.0.2.jar}:\
33 ${libs.beans-binding.classpath}
33# Space-separated list of extra javac options 34# Space-separated list of extra javac options
34javac.compilerargs= 35javac.compilerargs=
35javac.deprecation=false 36javac.deprecation=false
@@ -51,9 +52,17 @@ javadoc.splitindex=true
51javadoc.use=true 52javadoc.use=true
52javadoc.version=false 53javadoc.version=false
53javadoc.windowtitle= 54javadoc.windowtitle=
55jnlp.codebase.type=local
56jnlp.codebase.url=file:/home/hatkirby/NetBeansProjects/InstaDisc/dist/
57jnlp.enabled=false
58jnlp.offline-allowed=false
59jnlp.signed=false
54# Property libs.BDB.classpath is set here just to make sharing of project simpler. 60# Property libs.BDB.classpath is set here just to make sharing of project simpler.
55# The library definition has always preference over this property. 61# The library definition has always preference over this property.
56libs.BDB.classpath=lib/je-3.3.62.jar 62libs.BDB.classpath=lib/je-3.3.62.jar
63# Property libs.beans-binding.classpath is set here just to make sharing of project simpler.
64# The library definition has always preference over this property.
65libs.beans-binding.classpath=../../../../usr/share/netbeans/6.0.1/java1/modules/ext/beansbinding-1.2.1.jar
57# Property libs.XML-RPC.classpath is set here just to make sharing of project simpler. 66# Property libs.XML-RPC.classpath is set here just to make sharing of project simpler.
58# The library definition has always preference over this property. 67# The library definition has always preference over this property.
59libs.XML-RPC.classpath=lib/xmlrpc-client-3.1.jar:lib/xmlrpc-common-3.1.jar:lib/xmlrpc-server-3.1.jar 68libs.XML-RPC.classpath=lib/xmlrpc-client-3.1.jar:lib/xmlrpc-common-3.1.jar:lib/xmlrpc-server-3.1.jar
diff --git a/client/trunk/src/com/fourisland/instadisc/Database/Item.java b/client/trunk/src/com/fourisland/instadisc/Database/Item.java new file mode 100644 index 0000000..7dbc89b --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/Database/Item.java
@@ -0,0 +1,85 @@
1/*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5package com.fourisland.instadisc.Database;
6
7import com.sleepycat.persist.model.Entity;
8import com.sleepycat.persist.model.PrimaryKey;
9import java.util.HashMap;
10
11/**
12 *
13 * @author hatkirby
14 */
15@Entity
16public class Item {
17
18 @PrimaryKey
19 private Integer id;
20 private String subscription;
21 private String title;
22 private String author;
23 private String url;
24 private HashMap<String, String> semantics;
25
26 public Item() {
27 semantics = new HashMap<String, String>();
28 }
29
30 public Integer getID() {
31 return id;
32 }
33
34 public String getSubscription() {
35 return subscription;
36 }
37
38 public String getTitle() {
39 return title;
40 }
41
42 public String getAuthor() {
43 return author;
44 }
45
46 public String getURL() {
47 return url;
48 }
49
50 public HashMap<String, String> getSemantics() {
51 return semantics;
52 }
53
54 public void setID(Integer id) {
55 this.id = id;
56 }
57
58 public void setSubscription(String subscription) {
59 this.subscription = subscription;
60 }
61
62 public void setTitle(String title) {
63 this.title = title;
64 }
65
66 public void setAuthor(String author) {
67 this.author = author;
68 }
69
70 public void setURL(String url) {
71 this.url = url;
72 }
73
74 public void setSemantics(HashMap<String, String> semantics) {
75 this.semantics = semantics;
76 }
77
78 public String getSemantics(String key) {
79 return semantics.get(key);
80 }
81
82 public void putSemantics(String key, String value) {
83 semantics.put(key, value);
84 }
85}
diff --git a/client/trunk/src/com/fourisland/instadisc/Database/Subscription.java b/client/trunk/src/com/fourisland/instadisc/Database/Subscription.java new file mode 100644 index 0000000..529d60a --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/Database/Subscription.java
@@ -0,0 +1,52 @@
1/*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5
6package com.fourisland.instadisc.Database;
7
8import com.sleepycat.persist.model.Entity;
9import com.sleepycat.persist.model.PrimaryKey;
10
11/**
12 *
13 * @author hatkirby
14 */
15@Entity
16public class Subscription {
17
18 @PrimaryKey
19 private String url;
20 private String category;
21 private String title;
22
23 public String getURL()
24 {
25 return url;
26 }
27
28 public String getCategory()
29 {
30 return category;
31 }
32
33 public String getTitle()
34 {
35 return title;
36 }
37
38 public void setURL(String url)
39 {
40 this.url = url;
41 }
42
43 public void setCategory(String category)
44 {
45 this.category = category;
46 }
47
48 public void setTitle(String title)
49 {
50 this.title = title;
51 }
52}
diff --git a/client/trunk/src/com/fourisland/instadisc/Database/Wrapper.java b/client/trunk/src/com/fourisland/instadisc/Database/Wrapper.java index 1f905ee..13623c0 100644 --- a/client/trunk/src/com/fourisland/instadisc/Database/Wrapper.java +++ b/client/trunk/src/com/fourisland/instadisc/Database/Wrapper.java
@@ -26,6 +26,8 @@ public class Wrapper {
26 public static EntityStore es = null; 26 public static EntityStore es = null;
27 public static PrimaryIndex<Integer, OldVerID> oldVerID; 27 public static PrimaryIndex<Integer, OldVerID> oldVerID;
28 public static PrimaryIndex<String, IDConfig> idConfig; 28 public static PrimaryIndex<String, IDConfig> idConfig;
29 public static PrimaryIndex<Integer, Item> item;
30 public static PrimaryIndex<String, Subscription> subscription;
29 31
30 public static void init(String loc) { 32 public static void init(String loc) {
31 33
@@ -46,6 +48,8 @@ public class Wrapper {
46 try { 48 try {
47 oldVerID = es.getPrimaryIndex(Integer.class, OldVerID.class); 49 oldVerID = es.getPrimaryIndex(Integer.class, OldVerID.class);
48 idConfig = es.getPrimaryIndex(String.class, IDConfig.class); 50 idConfig = es.getPrimaryIndex(String.class, IDConfig.class);
51 item = es.getPrimaryIndex(Integer.class, Item.class);
52 subscription = es.getPrimaryIndex(String.class, Subscription.class);
49 } catch (DatabaseException ex) { 53 } catch (DatabaseException ex) {
50 Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex); 54 Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex);
51 } 55 }
@@ -126,4 +130,79 @@ public class Wrapper {
126 Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex); 130 Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex);
127 } 131 }
128 } 132 }
133
134 public static void addItem(Item m_item)
135 {
136 try {
137 item.put(m_item);
138 } catch (DatabaseException ex) {
139 Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex);
140 }
141 }
142
143 public static int countItem()
144 {
145 try {
146 return (int) item.count();
147 } catch (DatabaseException ex) {
148 Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex);
149 return 0;
150 }
151 }
152
153 public static void dropFromTopItem()
154 {
155 try {
156 Integer[] keySet = (Integer[]) item.map().keySet().toArray();
157 item.delete(keySet[0]);
158 } catch (DatabaseException ex) {
159 Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex);
160 }
161 }
162
163 public static Item[] getAllItem()
164 {
165 try {
166 Iterator<Item> i = item.entities().iterator();
167 Item[] temp = new Item[0];
168 int len = 0;
169
170 while (i.hasNext())
171 {
172 Item[] temp2 = new Item[len+1];
173 int j=0;
174 for (j=0;j<len;j++)
175 {
176 temp2[j] = temp[j];
177 }
178 temp2[len] = i.next();
179 temp = temp2;
180 }
181
182 return temp;
183 } catch (DatabaseException ex) {
184 Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex);
185 return new Item[0];
186 }
187 }
188
189 public static Subscription getSubscription(String url)
190 {
191 try {
192 return subscription.get(url);
193 } catch (DatabaseException ex) {
194 Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex);
195 return null;
196 }
197 }
198
199 public static boolean existsSubscription(String url)
200 {
201 try {
202 return subscription.contains(url);
203 } catch (DatabaseException ex) {
204 Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex);
205 return false;
206 }
207 }
129} 208}
diff --git a/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java index e6e75ff..dfbc89e 100644 --- a/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java +++ b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java
@@ -174,6 +174,7 @@ public class Step2 extends javax.swing.JDialog {
174 Wrapper.setConfig("username", jTextField1.getText()); 174 Wrapper.setConfig("username", jTextField1.getText());
175 Wrapper.setConfig("password", md5.hash()); 175 Wrapper.setConfig("password", md5.hash());
176 Wrapper.setConfig("centralServerURL", jTextField3.getText()); 176 Wrapper.setConfig("centralServerURL", jTextField3.getText());
177 Wrapper.setConfig("itemsToHold", "10");
177 178
178 StepEndResults.ok = true; 179 StepEndResults.ok = true;
179 this.setVisible(false); 180 this.setVisible(false);
diff --git a/client/trunk/src/com/fourisland/instadisc/IDItemListCellRenderer.java b/client/trunk/src/com/fourisland/instadisc/IDItemListCellRenderer.java new file mode 100644 index 0000000..3d057e2 --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/IDItemListCellRenderer.java
@@ -0,0 +1,54 @@
1/*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5package com.fourisland.instadisc;
6
7import com.fourisland.instadisc.Database.Item;
8import com.fourisland.instadisc.Database.Wrapper;
9import com.fourisland.instadisc.Item.Categories.Category;
10import java.awt.Color;
11import java.awt.Component;
12import javax.swing.ImageIcon;
13import javax.swing.JLabel;
14import javax.swing.JList;
15import javax.swing.ListCellRenderer;
16
17/**
18 *
19 * @author hatkirby
20 */
21public class IDItemListCellRenderer extends JLabel implements ListCellRenderer {
22
23 String base;
24
25 public IDItemListCellRenderer(String base)
26 {
27 this.base = base;
28 }
29
30 public Component getListCellRendererComponent(JList arg0, Object arg1, int arg2, boolean arg3, boolean arg4) {
31 Item item = (Item) arg1;
32
33 this.setIcon(Category.iconFromCategory(Wrapper.getSubscription(item.getSubscription()).getCategory()));
34 this.setText("<HTML><I>" + Wrapper.getSubscription(item.getSubscription()).getTitle() + "</I><B>" + item.getTitle() + "</B> by " + item.getAuthor());
35
36 /*if (item.getUnread()) {
37 this.setBackground(Color.YELLOW);
38 } else */{
39 if (arg3) {
40 this.setForeground(arg0.getSelectionForeground());
41 this.setBackground(arg0.getSelectionBackground());
42 } else {
43 this.setForeground(arg0.getForeground());
44 this.setBackground(arg0.getBackground());
45 }
46 }
47
48 this.setOpaque(true);
49 this.setFont(arg0.getFont());
50 this.setEnabled(arg0.isEnabled());
51
52 return this;
53 }
54}
diff --git a/client/trunk/src/com/fourisland/instadisc/InstaDiscApp.java b/client/trunk/src/com/fourisland/instadisc/InstaDiscApp.java index ffac22d..789dc75 100644 --- a/client/trunk/src/com/fourisland/instadisc/InstaDiscApp.java +++ b/client/trunk/src/com/fourisland/instadisc/InstaDiscApp.java
@@ -13,6 +13,8 @@ import org.jdesktop.application.SingleFrameApplication;
13 * The main class of the application. 13 * The main class of the application.
14 */ 14 */
15public class InstaDiscApp extends SingleFrameApplication { 15public class InstaDiscApp extends SingleFrameApplication {
16
17 public static String base;
16 18
17 /** 19 /**
18 * At startup create and show the main frame of the application. 20 * At startup create and show the main frame of the application.
@@ -44,6 +46,8 @@ public class InstaDiscApp extends SingleFrameApplication {
44 */ 46 */
45 public static void main(String[] args) { 47 public static void main(String[] args) {
46 if (args.length > 0) { 48 if (args.length > 0) {
49 base = args[0];
50
47 File db = new File(args[0] + "db"); 51 File db = new File(args[0] + "db");
48 if (!db.exists()) { 52 if (!db.exists()) {
49 db.mkdir(); 53 db.mkdir();
diff --git a/client/trunk/src/com/fourisland/instadisc/InstaDiscThread.java b/client/trunk/src/com/fourisland/instadisc/InstaDiscThread.java index 55baf28..224021b 100644 --- a/client/trunk/src/com/fourisland/instadisc/InstaDiscThread.java +++ b/client/trunk/src/com/fourisland/instadisc/InstaDiscThread.java
@@ -102,7 +102,7 @@ class HandleItemThread implements Runnable {
102 i++; 102 i++;
103 } 103 }
104 104
105 Logger.getLogger(HandleItemThread.class.getName()).log(Level.INFO, headerMap.toString()); 105 //Logger.getLogger(HandleItemThread.class.getName()).log(Level.INFO, headerMap.toString());
106 try { 106 try {
107 s.close(); 107 s.close();
108 } catch (IOException ex) { 108 } catch (IOException ex) {
diff --git a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form index bb3cc48..d88434a 100644 --- a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form +++ b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form
@@ -38,6 +38,9 @@
38 <Property name="selectionMode" type="int" value="0"/> 38 <Property name="selectionMode" type="int" value="0"/>
39 <Property name="name" type="java.lang.String" value="jList1" noResource="true"/> 39 <Property name="name" type="java.lang.String" value="jList1" noResource="true"/>
40 </Properties> 40 </Properties>
41 <Events>
42 <EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jList1MouseClicked"/>
43 </Events>
41 </Component> 44 </Component>
42 </SubComponents> 45 </SubComponents>
43 </Container> 46 </Container>
diff --git a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java index d43589a..e2d0058 100644 --- a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java +++ b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java
@@ -1,9 +1,10 @@
1/* 1/*
2 * InstaDiscView.java 2 * InstaDiscView.java
3 */ 3 */
4
5package com.fourisland.instadisc; 4package com.fourisland.instadisc;
6 5
6import com.fourisland.instadisc.Database.Item;
7import com.fourisland.instadisc.Database.Wrapper;
7import org.jdesktop.application.Action; 8import org.jdesktop.application.Action;
8import org.jdesktop.application.ResourceMap; 9import org.jdesktop.application.ResourceMap;
9import org.jdesktop.application.SingleFrameApplication; 10import org.jdesktop.application.SingleFrameApplication;
@@ -11,6 +12,12 @@ import org.jdesktop.application.FrameView;
11import org.jdesktop.application.TaskMonitor; 12import org.jdesktop.application.TaskMonitor;
12import java.awt.event.ActionEvent; 13import java.awt.event.ActionEvent;
13import java.awt.event.ActionListener; 14import java.awt.event.ActionListener;
15import java.io.IOException;
16import java.net.URI;
17import java.net.URISyntaxException;
18import java.util.logging.Level;
19import java.util.logging.Logger;
20import javax.swing.DefaultListModel;
14import javax.swing.Timer; 21import javax.swing.Timer;
15import javax.swing.Icon; 22import javax.swing.Icon;
16import javax.swing.JDialog; 23import javax.swing.JDialog;
@@ -30,6 +37,7 @@ public class InstaDiscView extends FrameView {
30 ResourceMap resourceMap = getResourceMap(); 37 ResourceMap resourceMap = getResourceMap();
31 int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout"); 38 int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
32 messageTimer = new Timer(messageTimeout, new ActionListener() { 39 messageTimer = new Timer(messageTimeout, new ActionListener() {
40
33 public void actionPerformed(ActionEvent e) { 41 public void actionPerformed(ActionEvent e) {
34 statusMessageLabel.setText(""); 42 statusMessageLabel.setText("");
35 } 43 }
@@ -40,6 +48,7 @@ public class InstaDiscView extends FrameView {
40 busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]"); 48 busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
41 } 49 }
42 busyIconTimer = new Timer(busyAnimationRate, new ActionListener() { 50 busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
51
43 public void actionPerformed(ActionEvent e) { 52 public void actionPerformed(ActionEvent e) {
44 busyIconIndex = (busyIconIndex + 1) % busyIcons.length; 53 busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
45 statusAnimationLabel.setIcon(busyIcons[busyIconIndex]); 54 statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
@@ -52,6 +61,7 @@ public class InstaDiscView extends FrameView {
52 // connecting action tasks to status bar via TaskMonitor 61 // connecting action tasks to status bar via TaskMonitor
53 TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext()); 62 TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
54 taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() { 63 taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
64
55 public void propertyChange(java.beans.PropertyChangeEvent evt) { 65 public void propertyChange(java.beans.PropertyChangeEvent evt) {
56 String propertyName = evt.getPropertyName(); 66 String propertyName = evt.getPropertyName();
57 if ("started".equals(propertyName)) { 67 if ("started".equals(propertyName)) {
@@ -68,18 +78,22 @@ public class InstaDiscView extends FrameView {
68 progressBar.setVisible(false); 78 progressBar.setVisible(false);
69 progressBar.setValue(0); 79 progressBar.setValue(0);
70 } else if ("message".equals(propertyName)) { 80 } else if ("message".equals(propertyName)) {
71 String text = (String)(evt.getNewValue()); 81 String text = (String) (evt.getNewValue());
72 statusMessageLabel.setText((text == null) ? "" : text); 82 statusMessageLabel.setText((text == null) ? "" : text);
73 messageTimer.restart(); 83 messageTimer.restart();
74 } else if ("progress".equals(propertyName)) { 84 } else if ("progress".equals(propertyName)) {
75 int value = (Integer)(evt.getNewValue()); 85 int value = (Integer) (evt.getNewValue());
76 progressBar.setVisible(true); 86 progressBar.setVisible(true);
77 progressBar.setIndeterminate(false); 87 progressBar.setIndeterminate(false);
78 progressBar.setValue(value); 88 progressBar.setValue(value);
79 } 89 }
80 } 90 }
81 }); 91 });
82 92
93 jList1.setCellRenderer(new IDItemListCellRenderer(InstaDiscApp.base));
94 jList1.setModel(lm);
95 refreshItemPane();
96
83 InstaDiscThread idt = new InstaDiscThread(); 97 InstaDiscThread idt = new InstaDiscThread();
84 Thread idtt = new Thread(idt); 98 Thread idtt = new Thread(idt);
85 idtt.start(); 99 idtt.start();
@@ -123,6 +137,11 @@ public class InstaDiscView extends FrameView {
123 137
124 jList1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); 138 jList1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
125 jList1.setName("jList1"); // NOI18N 139 jList1.setName("jList1"); // NOI18N
140 jList1.addMouseListener(new java.awt.event.MouseAdapter() {
141 public void mouseClicked(java.awt.event.MouseEvent evt) {
142 jList1MouseClicked(evt);
143 }
144 });
126 jScrollPane1.setViewportView(jList1); 145 jScrollPane1.setViewportView(jList1);
127 146
128 javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel); 147 javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
@@ -199,6 +218,19 @@ public class InstaDiscView extends FrameView {
199 setMenuBar(menuBar); 218 setMenuBar(menuBar);
200 setStatusBar(statusPanel); 219 setStatusBar(statusPanel);
201 }// </editor-fold>//GEN-END:initComponents 220 }// </editor-fold>//GEN-END:initComponents
221 private void jList1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList1MouseClicked
222 if (evt.getClickCount() == 2) {
223 Item item = (Item) jList1.getSelectedValue();
224
225 try {
226 java.awt.Desktop.getDesktop().browse(new URI(item.getURL()));
227 } catch (IOException ex) {
228 Logger.getLogger(InstaDiscView.class.getName()).log(Level.SEVERE, null, ex);
229 } catch (URISyntaxException ex) {
230 Logger.getLogger(InstaDiscView.class.getName()).log(Level.SEVERE, null, ex);
231 }
232 }
233 }//GEN-LAST:event_jList1MouseClicked
202 234
203 // Variables declaration - do not modify//GEN-BEGIN:variables 235 // Variables declaration - do not modify//GEN-BEGIN:variables
204 private javax.swing.JList jList1; 236 private javax.swing.JList jList1;
@@ -210,12 +242,20 @@ public class InstaDiscView extends FrameView {
210 private javax.swing.JLabel statusMessageLabel; 242 private javax.swing.JLabel statusMessageLabel;
211 private javax.swing.JPanel statusPanel; 243 private javax.swing.JPanel statusPanel;
212 // End of variables declaration//GEN-END:variables 244 // End of variables declaration//GEN-END:variables
213
214 private final Timer messageTimer; 245 private final Timer messageTimer;
215 private final Timer busyIconTimer; 246 private final Timer busyIconTimer;
216 private final Icon idleIcon; 247 private final Icon idleIcon;
217 private final Icon[] busyIcons = new Icon[15]; 248 private final Icon[] busyIcons = new Icon[15];
218 private int busyIconIndex = 0; 249 private int busyIconIndex = 0;
219
220 private JDialog aboutBox; 250 private JDialog aboutBox;
251 private DefaultListModel lm = new DefaultListModel();
252
253 public void refreshItemPane() {
254 lm.capacity();
255 Item[] items = Wrapper.getAllItem();
256 int i = 0;
257 for (i = 0; i < items.length; i++) {
258 lm.addElement(items[i]);
259 }
260 }
221} 261}
diff --git a/client/trunk/src/com/fourisland/instadisc/Item/Categories/Blogpost.java b/client/trunk/src/com/fourisland/instadisc/Item/Categories/Blogpost.java new file mode 100644 index 0000000..72f7a1d --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/Item/Categories/Blogpost.java
@@ -0,0 +1,6 @@
1package com.fourisland.instadisc.Item.Categories;
2
3public class Blogpost
4{
5 public static byte[] blogpost = new byte[] {-119,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0,0,31,-13,-1,97,0,0,0,4,103,65,77,65,0,0,-81,-56,55,5,-118,-23,0,0,0,25,116,69,88,116,83,111,102,116,119,97,114,101,0,65,100,111,98,101,32,73,109,97,103,101,82,101,97,100,121,113,-55,101,60,0,0,2,36,73,68,65,84,56,-53,-115,-109,-53,107,26,81,24,-59,-77,-80,116,19,-92,-69,-18,-78,8,-123,-18,-69,-18,-86,127,75,-1,-125,46,-69,-11,49,-66,80,20,21,-83,18,81,107,20,-33,111,-93,-125,72,-117,-117,82,-120,-94,24,81,17,105,-15,77,-43,56,104,109,-124,-26,-12,-69,3,17,-46,88,-101,-59,-64,-99,-57,-17,-36,115,-50,-3,-26,8,-64,-47,-95,43,-99,78,75,19,-119,68,62,22,-117,113,-31,112,88,-14,-9,-5,-57,-64,-123,104,52,-70,10,-123,66,66,32,16,-32,124,62,-97,-28,81,2,-87,84,74,26,-113,-57,25,-68,30,-113,-57,88,-83,86,32,-8,-58,-29,-15,112,46,-105,-21,-23,65,-127,59,56,18,-119,-84,-121,-61,33,104,13,-118,0,65,16,112,118,118,-10,-37,-31,112,36,109,54,-37,-109,-67,2,-55,100,82,74,31,-13,119,48,3,-49,-49,-49,65,113,-80,88,44,68,39,4,11,22,-117,-123,51,-103,76,-110,-67,48,-107,-75,30,12,6,32,-5,-52,54,-56,17,46,59,3,-24,-45,13,-60,-66,126,-125,-39,108,-66,53,26,-115,37,-67,94,-1,108,7,83,89,82,2,120,42,75,-124,-55,1,-68,94,47,72,20,-77,-39,12,-26,-117,38,-34,126,-8,-126,119,-98,75,124,-17,15,65,-80,-96,-43,106,95,-17,-123,-55,1,-88,44,49,-5,116,58,69,-87,84,-62,-113,-39,28,-17,3,21,4,62,53,-111,-32,63,67,-93,-47,108,57,-114,123,35,10,-48,110,124,48,24,-36,78,38,19,-112,8,-36,110,-73,-104,-99,-63,36,-114,98,-79,-120,94,-81,-121,70,-85,-117,-113,113,-98,-63,55,4,-65,-38,-107,72,112,-34,-17,-9,-33,-10,-5,125,116,58,29,-28,-13,121,17,102,14,50,-103,12,-70,-35,46,26,-115,6,-78,-71,11,-88,-43,-22,-115,82,-87,60,-67,119,-116,-44,-78,80,-85,-43,112,125,125,-115,118,-69,-115,86,-85,37,58,96,-51,95,93,93,-95,90,-83,34,-101,-51,66,-91,82,-3,36,-8,-28,-63,32,81,89,-93,114,-71,44,126,52,-97,-49,-47,108,54,69,17,-74,107,-91,82,17,93,48,88,-95,80,-100,-20,29,101,-102,-84,-25,78,-89,115,91,40,20,-60,-93,99,-83,47,-105,75,-44,-21,117,-16,60,15,-54,-5,75,46,-105,-97,-18,27,-70,-35,-62,110,-73,31,91,-83,-42,41,-37,-115,29,33,-53,-99,-53,-27,24,-68,33,-8,-27,-65,70,-2,-34,13,77,-42,-79,-63,96,24,-79,-4,-84,64,-54,-69,-111,-55,100,47,14,-3,112,15,30,-24,116,-70,99,106,122,68,-80,-16,63,-104,93,127,0,-8,-48,-15,71,-51,96,66,-31,0,0,0,0,73,69,78,68,-82,66,96,-126,-1};
6}
diff --git a/client/trunk/src/com/fourisland/instadisc/Item/Categories/Category.java b/client/trunk/src/com/fourisland/instadisc/Item/Categories/Category.java new file mode 100644 index 0000000..497d323 --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/Item/Categories/Category.java
@@ -0,0 +1,36 @@
1/*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5
6package com.fourisland.instadisc.Item.Categories;
7
8import com.fourisland.instadisc.Item.WellFormedItem;
9import java.util.HashMap;
10import javax.swing.Icon;
11import javax.swing.ImageIcon;
12
13/**
14 *
15 * @author hatkirby
16 */
17public class Category {
18
19 public static Icon iconFromCategory(String category)
20 {
21 if (category.equals("blog-post"))
22 {
23 return new ImageIcon(Blogpost.blogpost);
24 }
25 return null;
26 }
27
28 public static boolean checkForRequiredSemantics(HashMap<String, String> headerMap) {
29 boolean good = true;
30 if (headerMap.get("Category").equals("forum-post")) {
31 good = (good ? WellFormedItem.checkForRequiredHeader(headerMap, "forum") : false);
32 }
33 return good;
34 }
35
36}
diff --git a/client/trunk/src/com/fourisland/instadisc/Item/Item.java b/client/trunk/src/com/fourisland/instadisc/Item/Item.java index 56bc03c..a186ddb 100644 --- a/client/trunk/src/com/fourisland/instadisc/Item/Item.java +++ b/client/trunk/src/com/fourisland/instadisc/Item/Item.java
@@ -2,33 +2,66 @@
2 * To change this template, choose Tools | Templates 2 * To change this template, choose Tools | Templates
3 * and open the template in the editor. 3 * and open the template in the editor.
4 */ 4 */
5
6package com.fourisland.instadisc.Item; 5package com.fourisland.instadisc.Item;
7 6
7import com.fourisland.instadisc.Database.Wrapper;
8import com.fourisland.instadisc.InstaDiscApp;
9import com.fourisland.instadisc.InstaDiscView;
8import com.fourisland.instadisc.XmlRpc; 10import com.fourisland.instadisc.XmlRpc;
11import java.net.MalformedURLException;
12import java.net.URL;
9import java.util.HashMap; 13import java.util.HashMap;
14import java.util.logging.Level;
15import java.util.logging.Logger;
10 16
11/** 17/**
12 * 18 *
13 * @author hatkirby 19 * @author hatkirby
14 */ 20 */
15public class Item { 21public class Item {
16
17 HashMap<String,String> headerMap;
18 22
19 public Item(HashMap<String,String> headerMap) 23 HashMap<String, String> headerMap;
20 { 24
25 public Item(HashMap<String, String> headerMap) {
21 this.headerMap = headerMap; 26 this.headerMap = headerMap;
22 } 27 }
23 28
24 public void start() 29 public void start() {
25 {
26 WellFormedItem wfi = new WellFormedItem(this); 30 WellFormedItem wfi = new WellFormedItem(this);
27 if (wfi.check()) 31 if (wfi.check()) {
28 {
29 XmlRpc xmlrpc = new XmlRpc("deleteItem"); 32 XmlRpc xmlrpc = new XmlRpc("deleteItem");
30 xmlrpc.addParam(Integer.decode(headerMap.get("ID"))); 33 xmlrpc.addParam(Integer.decode(headerMap.get("ID")));
31 xmlrpc.execute(); 34 //xmlrpc.execute();
35
36 if (Wrapper.countItem() >= Integer.decode(Wrapper.getConfig("itemsToHold")))
37 {
38 Wrapper.dropFromTopItem();
39 }
40
41 try {
42 com.fourisland.instadisc.Database.Item di = new com.fourisland.instadisc.Database.Item();
43 di.setID(Integer.decode(headerMap.get("ID")));
44 di.setSubscription(headerMap.get("Subscription"));
45 di.setTitle(headerMap.get("Title"));
46 di.setAuthor(headerMap.get("Author"));
47 di.setURL(new URL(headerMap.get("URL")).toString());
48
49 HashMap<String, String> temp = headerMap;
50 temp.remove("ID");
51 temp.remove("Verification");
52 temp.remove("Verification-ID");
53 temp.remove("Subscription");
54 temp.remove("Category");
55 temp.remove("Title");
56 temp.remove("URL");
57 di.setSemantics(temp);
58
59 Wrapper.addItem(di);
60 } catch (MalformedURLException ex) {
61 Logger.getLogger(Item.class.getName()).log(Level.SEVERE, null, ex);
62 }
63
64 ((InstaDiscView)InstaDiscApp.getApplication().getMainView()).refreshItemPane();
32 } 65 }
33 } 66 }
34} 67}
diff --git a/client/trunk/src/com/fourisland/instadisc/Item/Verification.java b/client/trunk/src/com/fourisland/instadisc/Item/Verification.java index 57c69f4..9646397 100644 --- a/client/trunk/src/com/fourisland/instadisc/Item/Verification.java +++ b/client/trunk/src/com/fourisland/instadisc/Item/Verification.java
@@ -41,7 +41,6 @@ public class Verification {
41 String temp = username + ":" + Wrapper.getConfig("password") + ":" + id; 41 String temp = username + ":" + Wrapper.getConfig("password") + ":" + id;
42 MD5 md5 = new MD5(temp); 42 MD5 md5 = new MD5(temp);
43 hash = md5.hash(); 43 hash = md5.hash();
44 System.out.println(temp);
45 } 44 }
46 45
47 public Verification(String username, String password) { 46 public Verification(String username, String password) {
diff --git a/client/trunk/src/com/fourisland/instadisc/resources/InstaDiscApp.properties b/client/trunk/src/com/fourisland/instadisc/resources/InstaDiscApp.properties index 9bb23b0..d3daad1 100644 --- a/client/trunk/src/com/fourisland/instadisc/resources/InstaDiscApp.properties +++ b/client/trunk/src/com/fourisland/instadisc/resources/InstaDiscApp.properties
@@ -1,11 +1,11 @@
1# Application global resources 1# Application global resources
2 2
3Application.name = InstaDisc 3Application.name = InstaDisc
4Application.title = Basic Application Example 4Application.title = InstaDisc
5Application.version = 1.0 5Application.version = 1.0
6Application.vendor = Sun Microsystems Inc. 6Application.vendor = Four Island
7Application.homepage = http://appframework.dev.java.net 7Application.homepage = http://fourisland.com/projects/instadisc
8Application.description = A simple java desktop application based on Swing Application Framework 8Application.description = A productivity-increasing notification program
9Application.vendorId = Sun 9Application.vendorId = Hatkirby
10Application.id = ${Application.name} 10Application.id = InstaDisc
11Application.lookAndFeel = system 11Application.lookAndFeel = system
diff --git a/client/trunk/src/com/fourisland/instadisc/resources/InstaDiscView.properties b/client/trunk/src/com/fourisland/instadisc/resources/InstaDiscView.properties index 9825f7e..b0d7474 100644 --- a/client/trunk/src/com/fourisland/instadisc/resources/InstaDiscView.properties +++ b/client/trunk/src/com/fourisland/instadisc/resources/InstaDiscView.properties
@@ -30,3 +30,5 @@ StatusBar.busyIcons[11] = busyicons/busy-icon11.png
30StatusBar.busyIcons[12] = busyicons/busy-icon12.png 30StatusBar.busyIcons[12] = busyicons/busy-icon12.png
31StatusBar.busyIcons[13] = busyicons/busy-icon13.png 31StatusBar.busyIcons[13] = busyicons/busy-icon13.png
32StatusBar.busyIcons[14] = busyicons/busy-icon14.png 32StatusBar.busyIcons[14] = busyicons/busy-icon14.png
33
34blog-post.icon = newspaper.png \ No newline at end of file