xlawrence 2004/12/09 13:57:25 CET
Modified files:
src/java/org/jahia/suite/calendar/test DummyCalServerGUI.java
Log:
Dummy Test Server now works perfectly with the GUI. Full test program that
can be used for testing the synchronization
Revision Changes Path
1.2 +48 -4
uwcal_JSR168/src/java/org/jahia/suite/calendar/test/DummyCalServerGUI.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/src/java/org/jahia/suite/calendar/test/DummyCalServerGUI.java.diff?r1=1.1&r2=1.2&f=h
Index: DummyCalServerGUI.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/src/java/org/jahia/suite/calendar/test/DummyCalServerGUI.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DummyCalServerGUI.java 8 Dec 2004 16:02:30 -0000 1.1
+++ DummyCalServerGUI.java 9 Dec 2004 12:57:25 -0000 1.2
@@ -50,7 +50,7 @@
private DummyCalendarServer server;
private DefaultListModel listContent;
- private static final String[] comboValues = {"NEW", "MODIFIED",
"DELETED",
+ public static final String[] comboValues = {"NEW", "MODIFIED", "DELETED",
"SYNCHRONIZED", "UNKNOWN"};
/**
@@ -292,15 +292,37 @@
}//GEN-END:initComponents
private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt)
{//GEN-FIRST:event_deleteButtonActionPerformed
- // TODO add your handling code here:
+ String key = (String)keyList.getSelectedValue();
+ if (key == null) {
+ JOptionPane.showMessageDialog(this,
+ "You must first select a key in the list", "Error",
+ JOptionPane.ERROR_MESSAGE);
+ return;
+ }
+ server.getCalendar().removeEvent(key);
+ removeItem(key);
+
}//GEN-LAST:event_deleteButtonActionPerformed
private void newButtonActionPerformed(java.awt.event.ActionEvent evt)
{//GEN-FIRST:event_newButtonActionPerformed
- // TODO add your handling code here:
+ SyncEventDialog dialog = new SyncEventDialog(this, "key_" +
+ server.getCalendar().getEvents().length, "Create new SyncEvent",
true);
+ setFrameLocation(dialog);
+ dialog.show();
}//GEN-LAST:event_newButtonActionPerformed
private void editButtonActionPerformed(java.awt.event.ActionEvent evt)
{//GEN-FIRST:event_editButtonActionPerformed
- // TODO add your handling code here:
+ String key = (String)keyList.getSelectedValue();
+ if (key == null) {
+ JOptionPane.showMessageDialog(this,
+ "You must first select a key in the list", "Error",
+ JOptionPane.ERROR_MESSAGE);
+ return;
+ }
+ SyncEventDialog dialog = new SyncEventDialog(this, key
+ , "Edit SyncEvent", false);
+ setFrameLocation(dialog);
+ dialog.show();
}//GEN-LAST:event_editButtonActionPerformed
private void clearButtonActionPerformed(java.awt.event.ActionEvent evt)
{//GEN-FIRST:event_clearButtonActionPerformed
@@ -415,6 +437,21 @@
this.setLocation((screenSize.width - frameSize.width) / 2,
(screenSize.height - frameSize.height) / 2);
}
+
+ /**
+ *
+ */
+ public void setFrameLocation(JDialog frame) {
+ Dimension screenSize = Toolkit.getDefaultToolkit().
+ getScreenSize();
+ Dimension frameSize = frame.getSize();
+ if (frameSize.height > screenSize.height)
+ frameSize.height = screenSize.height;
+ if (frameSize.width > screenSize.width)
+ frameSize.width = screenSize.width;
+ frame.setLocation((screenSize.width - frameSize.width) / 2,
+ (screenSize.height - frameSize.height) / 2);
+ }
/**
*
@@ -429,4 +466,11 @@
public void removeItem(String key) {
listContent.removeElement(key);
}
+
+ /**
+ *
+ */
+ public DummyCalendarServer getServer() {
+ return server;
+ }
}