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/src/com/fourisland/instadisc/Database/Wrapper.java14
-rw-r--r--client/trunk/src/com/fourisland/instadisc/InstaDiscView.form11
-rw-r--r--client/trunk/src/com/fourisland/instadisc/InstaDiscView.java49
-rw-r--r--client/trunk/src/com/fourisland/instadisc/UnreadFlagPopupMenu.java37
-rw-r--r--client/trunk/src/com/fourisland/instadisc/resources/InstaDiscView.properties1
5 files changed, 111 insertions, 1 deletions
diff --git a/client/trunk/src/com/fourisland/instadisc/Database/Wrapper.java b/client/trunk/src/com/fourisland/instadisc/Database/Wrapper.java index 40040d9..1448893 100644 --- a/client/trunk/src/com/fourisland/instadisc/Database/Wrapper.java +++ b/client/trunk/src/com/fourisland/instadisc/Database/Wrapper.java
@@ -453,4 +453,18 @@ public class Wrapper {
453 } 453 }
454 } 454 }
455 } 455 }
456
457 public static Item getItem(Integer id) {
458 synchronized (item)
459 {
460 try
461 {
462 return item.get(id);
463 } catch (DatabaseException ex)
464 {
465 Logger.getLogger(Wrapper.class.getName()).log(Level.SEVERE, null, ex);
466 return null;
467 }
468 }
469 }
456} 470}
diff --git a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form index 5ca439a..c08ee2f 100644 --- a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form +++ b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form
@@ -40,6 +40,8 @@
40 </Properties> 40 </Properties>
41 <Events> 41 <Events>
42 <EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jList1MouseClicked"/> 42 <EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jList1MouseClicked"/>
43 <EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jList1MousePressed"/>
44 <EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jList1MouseReleased"/>
43 <EventHandler event="componentShown" listener="java.awt.event.ComponentListener" parameters="java.awt.event.ComponentEvent" handler="jList1ComponentShown"/> 45 <EventHandler event="componentShown" listener="java.awt.event.ComponentListener" parameters="java.awt.event.ComponentEvent" handler="jList1ComponentShown"/>
44 </Events> 46 </Events>
45 </Component> 47 </Component>
@@ -136,6 +138,15 @@
136 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem4ActionPerformed"/> 138 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem4ActionPerformed"/>
137 </Events> 139 </Events>
138 </MenuItem> 140 </MenuItem>
141 <MenuItem class="javax.swing.JMenuItem" name="jMenuItem8">
142 <Properties>
143 <Property name="text" type="java.lang.String" resourceKey="jMenuItem8.text"/>
144 <Property name="name" type="java.lang.String" value="jMenuItem8" noResource="true"/>
145 </Properties>
146 <Events>
147 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem8ActionPerformed"/>
148 </Events>
149 </MenuItem>
139 <MenuItem class="javax.swing.JMenuItem" name="jMenuItem5"> 150 <MenuItem class="javax.swing.JMenuItem" name="jMenuItem5">
140 <Properties> 151 <Properties>
141 <Property name="text" type="java.lang.String" resourceKey="jMenuItem5.text"/> 152 <Property name="text" type="java.lang.String" resourceKey="jMenuItem5.text"/>
diff --git a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java index a7a3308..3448197 100644 --- a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java +++ b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java
@@ -9,6 +9,7 @@ import com.fourisland.instadisc.Item.Categories.InstaDiscIcon;
9import java.awt.AWTException; 9import java.awt.AWTException;
10import java.awt.SystemTray; 10import java.awt.SystemTray;
11import java.awt.TrayIcon; 11import java.awt.TrayIcon;
12import java.awt.event.MouseEvent;
12import org.jdesktop.application.Action; 13import org.jdesktop.application.Action;
13import org.jdesktop.application.ResourceMap; 14import org.jdesktop.application.ResourceMap;
14import org.jdesktop.application.SingleFrameApplication; 15import org.jdesktop.application.SingleFrameApplication;
@@ -150,6 +151,7 @@ public class InstaDiscView extends FrameView {
150 jMenuItem7 = new javax.swing.JMenuItem(); 151 jMenuItem7 = new javax.swing.JMenuItem();
151 jMenuItem3 = new javax.swing.JMenuItem(); 152 jMenuItem3 = new javax.swing.JMenuItem();
152 jMenuItem4 = new javax.swing.JMenuItem(); 153 jMenuItem4 = new javax.swing.JMenuItem();
154 jMenuItem8 = new javax.swing.JMenuItem();
153 jMenuItem5 = new javax.swing.JMenuItem(); 155 jMenuItem5 = new javax.swing.JMenuItem();
154 javax.swing.JMenu helpMenu = new javax.swing.JMenu(); 156 javax.swing.JMenu helpMenu = new javax.swing.JMenu();
155 jMenuItem6 = new javax.swing.JMenuItem(); 157 jMenuItem6 = new javax.swing.JMenuItem();
@@ -170,6 +172,12 @@ public class InstaDiscView extends FrameView {
170 public void mouseClicked(java.awt.event.MouseEvent evt) { 172 public void mouseClicked(java.awt.event.MouseEvent evt) {
171 jList1MouseClicked(evt); 173 jList1MouseClicked(evt);
172 } 174 }
175 public void mousePressed(java.awt.event.MouseEvent evt) {
176 jList1MousePressed(evt);
177 }
178 public void mouseReleased(java.awt.event.MouseEvent evt) {
179 jList1MouseReleased(evt);
180 }
173 }); 181 });
174 jList1.addComponentListener(new java.awt.event.ComponentAdapter() { 182 jList1.addComponentListener(new java.awt.event.ComponentAdapter() {
175 public void componentShown(java.awt.event.ComponentEvent evt) { 183 public void componentShown(java.awt.event.ComponentEvent evt) {
@@ -253,6 +261,15 @@ public class InstaDiscView extends FrameView {
253 }); 261 });
254 jMenu1.add(jMenuItem4); 262 jMenu1.add(jMenuItem4);
255 263
264 jMenuItem8.setText(resourceMap.getString("jMenuItem8.text")); // NOI18N
265 jMenuItem8.setName("jMenuItem8"); // NOI18N
266 jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
267 public void actionPerformed(java.awt.event.ActionEvent evt) {
268 jMenuItem8ActionPerformed(evt);
269 }
270 });
271 jMenu1.add(jMenuItem8);
272
256 jMenuItem5.setText(resourceMap.getString("jMenuItem5.text")); // NOI18N 273 jMenuItem5.setText(resourceMap.getString("jMenuItem5.text")); // NOI18N
257 jMenuItem5.setName("jMenuItem5"); // NOI18N 274 jMenuItem5.setName("jMenuItem5"); // NOI18N
258 jMenuItem5.addActionListener(new java.awt.event.ActionListener() { 275 jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
@@ -324,7 +341,7 @@ public class InstaDiscView extends FrameView {
324 setStatusBar(statusPanel); 341 setStatusBar(statusPanel);
325 }// </editor-fold>//GEN-END:initComponents 342 }// </editor-fold>//GEN-END:initComponents
326 private void jList1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList1MouseClicked 343 private void jList1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList1MouseClicked
327 if (evt.getClickCount() == 2) { 344 if ((evt.getButton() == MouseEvent.BUTTON1) && (evt.getClickCount() == 2)) {
328 Item item = (Item) jList1.getSelectedValue(); 345 Item item = (Item) jList1.getSelectedValue();
329 346
330 try { 347 try {
@@ -397,6 +414,35 @@ public class InstaDiscView extends FrameView {
397 cpf.setVisible(true); 414 cpf.setVisible(true);
398 }//GEN-LAST:event_jMenuItem7ActionPerformed 415 }//GEN-LAST:event_jMenuItem7ActionPerformed
399 416
417 private void jList1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList1MouseReleased
418 int i = jList1.locationToIndex(evt.getPoint());
419 if ((evt.isPopupTrigger()) && (i != -1))
420 {
421 jList1.setSelectedIndex(i);
422 new UnreadFlagPopupMenu((Item) jList1.getSelectedValue()).show(jList1, evt.getX(), evt.getY());
423 }
424 }//GEN-LAST:event_jList1MouseReleased
425
426 private void jList1MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList1MousePressed
427 int i = jList1.locationToIndex(evt.getPoint());
428 if ((evt.isPopupTrigger()) && (i != -1))
429 {
430 jList1.setSelectedIndex(i);
431 new UnreadFlagPopupMenu((Item) jList1.getSelectedValue()).show(jList1, evt.getX(), evt.getY());
432 }
433 }//GEN-LAST:event_jList1MousePressed
434
435 private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem8ActionPerformed
436 Item[] items = Wrapper.getAllItem();
437 int i = 0;
438 for (i=0; i < items.length; i++)
439 {
440 Wrapper.setUnreadFlagItem(items[i].getID(), false);
441 }
442
443 refreshItemPane();
444 }//GEN-LAST:event_jMenuItem8ActionPerformed
445
400 // Variables declaration - do not modify//GEN-BEGIN:variables 446 // Variables declaration - do not modify//GEN-BEGIN:variables
401 private javax.swing.JList jList1; 447 private javax.swing.JList jList1;
402 private javax.swing.JMenu jMenu1; 448 private javax.swing.JMenu jMenu1;
@@ -407,6 +453,7 @@ public class InstaDiscView extends FrameView {
407 private javax.swing.JMenuItem jMenuItem5; 453 private javax.swing.JMenuItem jMenuItem5;
408 private javax.swing.JMenuItem jMenuItem6; 454 private javax.swing.JMenuItem jMenuItem6;
409 private javax.swing.JMenuItem jMenuItem7; 455 private javax.swing.JMenuItem jMenuItem7;
456 private javax.swing.JMenuItem jMenuItem8;
410 private javax.swing.JScrollPane jScrollPane1; 457 private javax.swing.JScrollPane jScrollPane1;
411 private javax.swing.JSeparator jSeparator1; 458 private javax.swing.JSeparator jSeparator1;
412 private javax.swing.JPanel mainPanel; 459 private javax.swing.JPanel mainPanel;
diff --git a/client/trunk/src/com/fourisland/instadisc/UnreadFlagPopupMenu.java b/client/trunk/src/com/fourisland/instadisc/UnreadFlagPopupMenu.java new file mode 100644 index 0000000..25cca54 --- /dev/null +++ b/client/trunk/src/com/fourisland/instadisc/UnreadFlagPopupMenu.java
@@ -0,0 +1,37 @@
1package com.fourisland.instadisc;
2
3import com.fourisland.instadisc.Database.Item;
4import com.fourisland.instadisc.Database.Wrapper;
5import java.awt.event.ActionEvent;
6import java.awt.event.ActionListener;
7import javax.swing.JList;
8import javax.swing.JMenuItem;
9import javax.swing.JPopupMenu;
10
11public class UnreadFlagPopupMenu extends JPopupMenu
12{
13 private Item item;
14
15 public UnreadFlagPopupMenu(Item item)
16 {
17 super();
18 this.item = item;
19
20 JMenuItem action = new JMenuItem("Mark as " + (item.getUnread() ? "Read" : "Unread"));
21 action.addActionListener(new ActionListener() {
22
23 public void actionPerformed(ActionEvent arg0) {
24 flipUnreadFlag();
25 }
26 });
27
28 add(action);
29 }
30
31 private void flipUnreadFlag()
32 {
33 Wrapper.setUnreadFlagItem(item.getID(), !item.getUnread());
34
35 ((InstaDiscView) InstaDiscApp.getApplication().getMainView()).refreshItemPane();
36 }
37} \ No newline at end of file
diff --git a/client/trunk/src/com/fourisland/instadisc/resources/InstaDiscView.properties b/client/trunk/src/com/fourisland/instadisc/resources/InstaDiscView.properties index d7bcf10..927eecf 100644 --- a/client/trunk/src/com/fourisland/instadisc/resources/InstaDiscView.properties +++ b/client/trunk/src/com/fourisland/instadisc/resources/InstaDiscView.properties
@@ -38,3 +38,4 @@ jMenuItem4.text=Request Retained Items
38jMenuItem5.text=Advanced Settings 38jMenuItem5.text=Advanced Settings
39jMenuItem6.text=InstaDisc Website 39jMenuItem6.text=InstaDisc Website
40jMenuItem7.text=Change Password 40jMenuItem7.text=Change Password
41jMenuItem8.text=Mark all as Read