From a912b00194ef2344f3205b820231216bf69819d1 Mon Sep 17 00:00:00 2001
From: Kelly Rauchenberger <fefferburbia@gmail.com>
Date: Tue, 29 Jul 2008 21:54:17 +0000
Subject: Client: Completed path

Finally, the Item has the ability to be displayed on the Form. However, the Client now also requires to keep a list of the active Subscriptions and verify each incoming Item against it, which means that a method of subscribing to subscriptions must be implemented before further testing.
---
 client/trunk/nbproject/project.properties          | 19 +++--
 .../com/fourisland/instadisc/Database/Item.java    | 85 ++++++++++++++++++++++
 .../instadisc/Database/Subscription.java           | 52 +++++++++++++
 .../com/fourisland/instadisc/Database/Wrapper.java | 79 ++++++++++++++++++++
 .../com/fourisland/instadisc/FirstRun/Step2.java   |  1 +
 .../instadisc/IDItemListCellRenderer.java          | 54 ++++++++++++++
 .../src/com/fourisland/instadisc/InstaDiscApp.java |  4 +
 .../com/fourisland/instadisc/InstaDiscThread.java  |  2 +-
 .../com/fourisland/instadisc/InstaDiscView.form    |  3 +
 .../com/fourisland/instadisc/InstaDiscView.java    | 52 +++++++++++--
 .../instadisc/Item/Categories/Blogpost.java        |  6 ++
 .../instadisc/Item/Categories/Category.java        | 36 +++++++++
 .../src/com/fourisland/instadisc/Item/Item.java    | 55 +++++++++++---
 .../fourisland/instadisc/Item/Verification.java    |  1 -
 .../instadisc/resources/InstaDiscApp.properties    | 12 +--
 .../instadisc/resources/InstaDiscView.properties   |  2 +
 16 files changed, 433 insertions(+), 30 deletions(-)
 create mode 100644 client/trunk/src/com/fourisland/instadisc/Database/Item.java
 create mode 100644 client/trunk/src/com/fourisland/instadisc/Database/Subscription.java
 create mode 100644 client/trunk/src/com/fourisland/instadisc/IDItemListCellRenderer.java
 create mode 100644 client/trunk/src/com/fourisland/instadisc/Item/Categories/Blogpost.java
 create mode 100644 client/trunk/src/com/fourisland/instadisc/Item/Categories/Category.java

(limited to 'client')

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 @@
-application.desc=A simple java desktop application based on Swing Application Framework
-application.homepage=http://appframework.dev.java.net
-application.title=Basic Application Example
-application.vendor=Sun Microsystems Inc.
+application.desc=A productivity-increasing notification program
+application.homepage=http://fourisland.com/projects/instadisc
+application.title=InstaDisc
+application.vendor=Four Island
 build.classes.dir=${build.dir}/classes
 build.classes.excludes=**/*.java,**/*.form
 # This directory is removed when the project is cleaned:
@@ -29,7 +29,8 @@ javac.classpath=\
     ${libs.XML-RPC.classpath}:\
     ${libs.BDB.classpath}:\
     ${file.reference.commons-logging-1.1.jar}:\
-    ${file.reference.ws-commons-util-1.0.2.jar}
+    ${file.reference.ws-commons-util-1.0.2.jar}:\
+    ${libs.beans-binding.classpath}
 # Space-separated list of extra javac options
 javac.compilerargs=
 javac.deprecation=false
@@ -51,9 +52,17 @@ javadoc.splitindex=true
 javadoc.use=true
 javadoc.version=false
 javadoc.windowtitle=
+jnlp.codebase.type=local
+jnlp.codebase.url=file:/home/hatkirby/NetBeansProjects/InstaDisc/dist/
+jnlp.enabled=false
+jnlp.offline-allowed=false
+jnlp.signed=false
 # Property libs.BDB.classpath is set here just to make sharing of project simpler.
 # The library definition has always preference over this property.
 libs.BDB.classpath=lib/je-3.3.62.jar
+# Property libs.beans-binding.classpath is set here just to make sharing of project simpler.
+# The library definition has always preference over this property.
+libs.beans-binding.classpath=../../../../usr/share/netbeans/6.0.1/java1/modules/ext/beansbinding-1.2.1.jar
 # Property libs.XML-RPC.classpath is set here just to make sharing of project simpler.
 # The library definition has always preference over this property.
 libs.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 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.fourisland.instadisc.Database;
+
+import com.sleepycat.persist.model.Entity;
+import com.sleepycat.persist.model.PrimaryKey;
+import java.util.HashMap;
+
+/**
+ *
+ * @author hatkirby
+ */
+@Entity
+public class Item {
+
+    @PrimaryKey
+    private Integer id;
+    private String subscription;
+    private String title;
+    private String author;
+    private String url;
+    private HashMap<String, String> semantics;
+
+    public Item() {
+        semantics = new HashMap<String, String>();
+    }
+
+    public Integer getID() {
+        return id;
+    }
+
+    public String getSubscription() {
+        return subscription;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public String getAuthor() {
+        return author;
+    }
+
+    public String getURL() {
+        return url;
+    }
+
+    public HashMap<String, String> getSemantics() {
+        return semantics;
+    }
+
+    public void setID(Integer id) {
+        this.id = id;
+    }
+
+    public void setSubscription(String subscription) {
+        this.subscription = subscription;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public void setAuthor(String author) {
+        this.author = author;
+    }
+
+    public void setURL(String url) {
+        this.url = url;
+    }
+
+    public void setSemantics(HashMap<String, String> semantics) {
+        this.semantics = semantics;
+    }
+
+    public String getSemantics(String key) {
+        return semantics.get(key);
+    }
+
+    public void putSemantics(String key, String value) {
+        semantics.put(key, value);
+    }
+}
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 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package com.fourisland.instadisc.Database;
+
+import com.sleepycat.persist.model.Entity;
+import com.sleepycat.persist.model.PrimaryKey;
+
+/**
+ *
+ * @author hatkirby
+ */
+@Entity
+public class Subscription {
+
+    @PrimaryKey
+    private String url;
+    private String category;
+    private String title;
+    
+    public String getURL()
+    {
+        return url;
+    }
+    
+    public String getCategory()
+    {
+        return category;
+    }
+    
+    public String getTitle()
+    {
+        return title;
+    }
+    
+    public void setURL(String url)
+    {
+        this.url = url;
+    }
+    
+    public void setCategory(String category)
+    {
+        this.category = category;
+    }
+    
+    public void setTitle(String title)
+    {
+        this.title = title;
+    }
+}
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 {
     public static EntityStore es = null;
     public static PrimaryIndex<Integer, OldVerID> oldVerID;
     public static PrimaryIndex<String, IDConfig> idConfig;
+    public static PrimaryIndex<Integer, Item> item;
+    public static PrimaryIndex<String, Subscription> subscription;
 
     public static void init(String loc) {
 
@@ -46,6 +48,8 @@ public class Wrapper {
         try {
             oldVerID = es.getPrimaryIndex(Integer.class, OldVerID.class);
             idConfig = es.getPrimaryIndex(String.class, IDConfig.class);
+            item = es.getPrimaryIndex(Integer.class, Item.class);
+            subscription = es.getPrimaryIndex(String.class, Subscription.class);
         } catch (DatabaseException ex) {
             Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex);
         }
@@ -126,4 +130,79 @@ public class Wrapper {
             Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex);
         }
     }
+    
+    public static void addItem(Item m_item)
+    {
+        try {
+            item.put(m_item);
+        } catch (DatabaseException ex) {
+            Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex);
+        }
+    }
+    
+    public static int countItem()
+    {
+        try {
+            return (int) item.count();
+        } catch (DatabaseException ex) {
+            Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex);
+            return 0;
+        }
+    }
+    
+    public static void dropFromTopItem()
+    {
+        try {
+            Integer[] keySet = (Integer[]) item.map().keySet().toArray();
+            item.delete(keySet[0]);
+        } catch (DatabaseException ex) {
+            Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex);
+        }
+    }
+    
+    public static Item[] getAllItem()
+    {
+        try {
+            Iterator<Item> i = item.entities().iterator();
+            Item[] temp = new Item[0];
+            int len = 0;
+            
+            while (i.hasNext())
+            {
+                Item[] temp2 = new Item[len+1];
+                int j=0;
+                for (j=0;j<len;j++)
+                {
+                    temp2[j] = temp[j];
+                }
+                temp2[len] = i.next();
+                temp = temp2;
+            }
+            
+            return temp;
+        } catch (DatabaseException ex) {
+            Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex);
+            return new Item[0];
+        }
+    }
+    
+    public static Subscription getSubscription(String url)
+    {
+        try {
+            return subscription.get(url);
+        } catch (DatabaseException ex) {
+            Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex);
+            return null;
+        }
+    }
+    
+    public static boolean existsSubscription(String url)
+    {
+        try {
+            return subscription.contains(url);
+        } catch (DatabaseException ex) {
+            Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex);
+            return false;
+        }
+    }
 }
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 {
                             Wrapper.setConfig("username", jTextField1.getText());
                             Wrapper.setConfig("password", md5.hash());
                             Wrapper.setConfig("centralServerURL", jTextField3.getText());
+                            Wrapper.setConfig("itemsToHold", "10");
                             
                             StepEndResults.ok = true;
                             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 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.fourisland.instadisc;
+
+import com.fourisland.instadisc.Database.Item;
+import com.fourisland.instadisc.Database.Wrapper;
+import com.fourisland.instadisc.Item.Categories.Category;
+import java.awt.Color;
+import java.awt.Component;
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.ListCellRenderer;
+
+/**
+ *
+ * @author hatkirby
+ */
+public class IDItemListCellRenderer extends JLabel implements ListCellRenderer {
+    
+    String base;
+    
+    public IDItemListCellRenderer(String base)
+    {
+        this.base = base;
+    }
+
+    public Component getListCellRendererComponent(JList arg0, Object arg1, int arg2, boolean arg3, boolean arg4) {
+        Item item = (Item) arg1;
+
+        this.setIcon(Category.iconFromCategory(Wrapper.getSubscription(item.getSubscription()).getCategory()));
+        this.setText("<HTML><I>" + Wrapper.getSubscription(item.getSubscription()).getTitle() + "</I><B>" + item.getTitle() + "</B> by " + item.getAuthor());
+
+        /*if (item.getUnread()) {
+            this.setBackground(Color.YELLOW);
+        } else */{
+            if (arg3) {
+                this.setForeground(arg0.getSelectionForeground());
+                this.setBackground(arg0.getSelectionBackground());
+            } else {
+                this.setForeground(arg0.getForeground());
+                this.setBackground(arg0.getBackground());
+            }
+        }
+
+        this.setOpaque(true);
+        this.setFont(arg0.getFont());
+        this.setEnabled(arg0.isEnabled());
+
+        return this;
+    }
+}
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;
  * The main class of the application.
  */
 public class InstaDiscApp extends SingleFrameApplication {
+    
+    public static String base;
 
     /**
      * At startup create and show the main frame of the application.
@@ -44,6 +46,8 @@ public class InstaDiscApp extends SingleFrameApplication {
      */
     public static void main(String[] args) {
         if (args.length > 0) {
+            base = args[0];
+            
             File db = new File(args[0] + "db");
             if (!db.exists()) {
                 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 {
                 i++;
             }
 
-            Logger.getLogger(HandleItemThread.class.getName()).log(Level.INFO, headerMap.toString());
+            //Logger.getLogger(HandleItemThread.class.getName()).log(Level.INFO, headerMap.toString());
             try {
                 s.close();
             } 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 @@
                 <Property name="selectionMode" type="int" value="0"/>
                 <Property name="name" type="java.lang.String" value="jList1" noResource="true"/>
               </Properties>
+              <Events>
+                <EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jList1MouseClicked"/>
+              </Events>
             </Component>
           </SubComponents>
         </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 @@
 /*
  * InstaDiscView.java
  */
-
 package com.fourisland.instadisc;
 
+import com.fourisland.instadisc.Database.Item;
+import com.fourisland.instadisc.Database.Wrapper;
 import org.jdesktop.application.Action;
 import org.jdesktop.application.ResourceMap;
 import org.jdesktop.application.SingleFrameApplication;
@@ -11,6 +12,12 @@ import org.jdesktop.application.FrameView;
 import org.jdesktop.application.TaskMonitor;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.DefaultListModel;
 import javax.swing.Timer;
 import javax.swing.Icon;
 import javax.swing.JDialog;
@@ -30,6 +37,7 @@ public class InstaDiscView extends FrameView {
         ResourceMap resourceMap = getResourceMap();
         int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
         messageTimer = new Timer(messageTimeout, new ActionListener() {
+
             public void actionPerformed(ActionEvent e) {
                 statusMessageLabel.setText("");
             }
@@ -40,6 +48,7 @@ public class InstaDiscView extends FrameView {
             busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
         }
         busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
+
             public void actionPerformed(ActionEvent e) {
                 busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                 statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
@@ -52,6 +61,7 @@ public class InstaDiscView extends FrameView {
         // connecting action tasks to status bar via TaskMonitor
         TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
         taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
+
             public void propertyChange(java.beans.PropertyChangeEvent evt) {
                 String propertyName = evt.getPropertyName();
                 if ("started".equals(propertyName)) {
@@ -68,18 +78,22 @@ public class InstaDiscView extends FrameView {
                     progressBar.setVisible(false);
                     progressBar.setValue(0);
                 } else if ("message".equals(propertyName)) {
-                    String text = (String)(evt.getNewValue());
+                    String text = (String) (evt.getNewValue());
                     statusMessageLabel.setText((text == null) ? "" : text);
                     messageTimer.restart();
                 } else if ("progress".equals(propertyName)) {
-                    int value = (Integer)(evt.getNewValue());
+                    int value = (Integer) (evt.getNewValue());
                     progressBar.setVisible(true);
                     progressBar.setIndeterminate(false);
                     progressBar.setValue(value);
                 }
             }
         });
-        
+
+        jList1.setCellRenderer(new IDItemListCellRenderer(InstaDiscApp.base));
+        jList1.setModel(lm);
+        refreshItemPane();
+
         InstaDiscThread idt = new InstaDiscThread();
         Thread idtt = new Thread(idt);
         idtt.start();
@@ -123,6 +137,11 @@ public class InstaDiscView extends FrameView {
 
         jList1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
         jList1.setName("jList1"); // NOI18N
+        jList1.addMouseListener(new java.awt.event.MouseAdapter() {
+            public void mouseClicked(java.awt.event.MouseEvent evt) {
+                jList1MouseClicked(evt);
+            }
+        });
         jScrollPane1.setViewportView(jList1);
 
         javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
@@ -199,6 +218,19 @@ public class InstaDiscView extends FrameView {
         setMenuBar(menuBar);
         setStatusBar(statusPanel);
     }// </editor-fold>//GEN-END:initComponents
+    private void jList1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList1MouseClicked
+        if (evt.getClickCount() == 2) {
+            Item item = (Item) jList1.getSelectedValue();
+
+            try {
+                java.awt.Desktop.getDesktop().browse(new URI(item.getURL()));
+            } catch (IOException ex) {
+                Logger.getLogger(InstaDiscView.class.getName()).log(Level.SEVERE, null, ex);
+            } catch (URISyntaxException ex) {
+                Logger.getLogger(InstaDiscView.class.getName()).log(Level.SEVERE, null, ex);
+            }
+        }
+    }//GEN-LAST:event_jList1MouseClicked
 
     // Variables declaration - do not modify//GEN-BEGIN:variables
     private javax.swing.JList jList1;
@@ -210,12 +242,20 @@ public class InstaDiscView extends FrameView {
     private javax.swing.JLabel statusMessageLabel;
     private javax.swing.JPanel statusPanel;
     // End of variables declaration//GEN-END:variables
-
     private final Timer messageTimer;
     private final Timer busyIconTimer;
     private final Icon idleIcon;
     private final Icon[] busyIcons = new Icon[15];
     private int busyIconIndex = 0;
-
     private JDialog aboutBox;
+    private DefaultListModel lm = new DefaultListModel();
+
+    public void refreshItemPane() {
+        lm.capacity();
+        Item[] items = Wrapper.getAllItem();
+        int i = 0;
+        for (i = 0; i < items.length; i++) {
+            lm.addElement(items[i]);
+        }
+    }
 }
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 @@
+package com.fourisland.instadisc.Item.Categories;
+
+public class Blogpost
+{
+	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};
+}
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 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package com.fourisland.instadisc.Item.Categories;
+
+import com.fourisland.instadisc.Item.WellFormedItem;
+import java.util.HashMap;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+
+/**
+ *
+ * @author hatkirby
+ */
+public class Category {
+
+    public static Icon iconFromCategory(String category)
+    {
+        if (category.equals("blog-post"))
+        {
+            return new ImageIcon(Blogpost.blogpost);
+        }
+        return null;
+    }
+    
+    public static boolean checkForRequiredSemantics(HashMap<String, String> headerMap) {
+        boolean good = true;
+        if (headerMap.get("Category").equals("forum-post")) {
+            good = (good ? WellFormedItem.checkForRequiredHeader(headerMap, "forum") : false);
+        }
+        return good;
+    }
+    
+}
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 @@
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
-
 package com.fourisland.instadisc.Item;
 
+import com.fourisland.instadisc.Database.Wrapper;
+import com.fourisland.instadisc.InstaDiscApp;
+import com.fourisland.instadisc.InstaDiscView;
 import com.fourisland.instadisc.XmlRpc;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.HashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 /**
  *
  * @author hatkirby
  */
 public class Item {
-    
-    HashMap<String,String> headerMap;
 
-    public Item(HashMap<String,String> headerMap)
-    {
+    HashMap<String, String> headerMap;
+
+    public Item(HashMap<String, String> headerMap) {
         this.headerMap = headerMap;
     }
-    
-    public void start()
-    {
+
+    public void start() {
         WellFormedItem wfi = new WellFormedItem(this);
-        if (wfi.check())
-        {
+        if (wfi.check()) {
             XmlRpc xmlrpc = new XmlRpc("deleteItem");
             xmlrpc.addParam(Integer.decode(headerMap.get("ID")));
-            xmlrpc.execute();
+            //xmlrpc.execute();
+            
+            if (Wrapper.countItem() >= Integer.decode(Wrapper.getConfig("itemsToHold")))
+            {
+                Wrapper.dropFromTopItem();
+            }
+            
+            try {
+                com.fourisland.instadisc.Database.Item di = new com.fourisland.instadisc.Database.Item();
+                di.setID(Integer.decode(headerMap.get("ID")));
+                di.setSubscription(headerMap.get("Subscription"));
+                di.setTitle(headerMap.get("Title"));
+                di.setAuthor(headerMap.get("Author"));
+                di.setURL(new URL(headerMap.get("URL")).toString());
+                
+                HashMap<String, String> temp = headerMap;
+                temp.remove("ID");
+                temp.remove("Verification");
+                temp.remove("Verification-ID");
+                temp.remove("Subscription");
+                temp.remove("Category");
+                temp.remove("Title");
+                temp.remove("URL");
+                di.setSemantics(temp);
+                
+                Wrapper.addItem(di);
+            } catch (MalformedURLException ex) {
+                Logger.getLogger(Item.class.getName()).log(Level.SEVERE, null, ex);
+            }
+
+            ((InstaDiscView)InstaDiscApp.getApplication().getMainView()).refreshItemPane();
         }
     }
 }
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 {
         String temp = username + ":" + Wrapper.getConfig("password") + ":" + id;
         MD5 md5 = new MD5(temp);
         hash = md5.hash();
-        System.out.println(temp);
     }
 
     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 @@
 # Application global resources
 
 Application.name = InstaDisc
-Application.title = Basic Application Example
+Application.title = InstaDisc
 Application.version = 1.0
-Application.vendor = Sun Microsystems Inc.
-Application.homepage = http://appframework.dev.java.net
-Application.description = A simple java desktop application based on Swing Application Framework
-Application.vendorId = Sun
-Application.id = ${Application.name}
+Application.vendor = Four Island
+Application.homepage = http://fourisland.com/projects/instadisc
+Application.description = A productivity-increasing notification program
+Application.vendorId = Hatkirby
+Application.id = InstaDisc
 Application.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
 StatusBar.busyIcons[12] = busyicons/busy-icon12.png
 StatusBar.busyIcons[13] = busyicons/busy-icon13.png
 StatusBar.busyIcons[14] = busyicons/busy-icon14.png
+
+blog-post.icon = newspaper.png
\ No newline at end of file
-- 
cgit 1.4.1