javaclient-cvs Mailing List for Java Client
Status: Alpha
Brought to you by:
rimmeraj
You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(13) |
Aug
(14) |
Sep
|
Oct
(54) |
Nov
|
Dec
|
|---|
|
From: cuongnt <cu...@us...> - 2004-10-25 14:05:41
|
Update of /cvsroot/javaclient/javaclient/net/sourceforge/javaclient/tools/xsl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26882/net/sourceforge/javaclient/tools/xsl Modified Files: ClassGenerator.java WorkArea.java Log Message: add getWorkArea() method Index: ClassGenerator.java =================================================================== RCS file: /cvsroot/javaclient/javaclient/net/sourceforge/javaclient/tools/xsl/ClassGenerator.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ClassGenerator.java 22 Oct 2004 21:00:12 -0000 1.5 --- ClassGenerator.java 25 Oct 2004 14:05:29 -0000 1.6 *************** *** 319,323 **** --- 319,325 ---- if(rootElement.equals("Display")) + { out.println("\tprivate Display dpy;"); + } else if(rootElement.equals("Dialog")) { Index: WorkArea.java =================================================================== RCS file: /cvsroot/javaclient/javaclient/net/sourceforge/javaclient/tools/xsl/WorkArea.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** WorkArea.java 27 Jul 2004 15:08:06 -0000 1.1 --- WorkArea.java 25 Oct 2004 14:05:30 -0000 1.2 *************** *** 11,19 **** addImport("org.eclipse.swt.widgets.Group"); addImport("net.sourceforge.javaclient.client.component.JCFactory"); ! setComponentId("workArea"); } public StringBuffer getCode() { ! StringBuffer b = new StringBuffer("\t\tGroup workArea = JCFactory.newWorkArea(parent,"+margin); b.append(");\n"); return(b); --- 11,21 ---- addImport("org.eclipse.swt.widgets.Group"); addImport("net.sourceforge.javaclient.client.component.JCFactory"); ! setComponentId("workArea", "org.eclipse.swt.widgets.Group"); } public StringBuffer getCode() { ! StringBuffer b = new StringBuffer("\t\t"); ! b.append(getComponentId()); ! b.append(" = JCFactory.newWorkArea(parent," + margin); b.append(");\n"); return(b); |
|
From: cuongnt <cu...@us...> - 2004-10-25 14:05:39
|
Update of /cvsroot/javaclient/javaclient/metadata In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26882/metadata Modified Files: jc.xsl Log Message: add getWorkArea() method Index: jc.xsl =================================================================== RCS file: /cvsroot/javaclient/javaclient/metadata/jc.xsl,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** jc.xsl 14 Oct 2004 20:13:25 -0000 1.9 --- jc.xsl 25 Oct 2004 14:05:28 -0000 1.10 *************** *** 45,49 **** <xsl:value-of select="jc:addComponent($class,$window,true())"/> <xsl:variable name="workArea" select="jc:WorkArea.new(@margin)"/> ! <xsl:value-of select="jc:addComponent($class,$workArea,true())"/> <xsl:call-template name="processWidgets"/> <xsl:value-of select="jc:endComponent($class)"/> --- 45,49 ---- <xsl:value-of select="jc:addComponent($class,$window,true())"/> <xsl:variable name="workArea" select="jc:WorkArea.new(@margin)"/> ! <xsl:value-of select="jc:addComponent($class,$workArea, true())"/> <xsl:call-template name="processWidgets"/> <xsl:value-of select="jc:endComponent($class)"/> |
|
From: cuongnt <cu...@us...> - 2004-10-22 21:00:21
|
Update of /cvsroot/javaclient/javaclient/net/sourceforge/javaclient/tools/xsl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14324/net/sourceforge/javaclient/tools/xsl Modified Files: ClassGenerator.java Log Message: donot put pack(), open() in create() but in open() method Index: ClassGenerator.java =================================================================== RCS file: /cvsroot/javaclient/javaclient/net/sourceforge/javaclient/tools/xsl/ClassGenerator.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ClassGenerator.java 14 Oct 2004 20:13:25 -0000 1.4 --- ClassGenerator.java 22 Oct 2004 21:00:12 -0000 1.5 *************** *** 258,264 **** } out.println("\t\tshell.setVisible(isVisible);"); out.println("\t\tshell.pack();"); out.println("\t\tshell.open();"); ! out.println("\t}"); if(rootElement.equals("Dialog")) --- 258,268 ---- } out.println("\t\tshell.setVisible(isVisible);"); + out.println("\t}\n"); + + out.println("\tpublic void open()"); + out.println("\t{"); out.println("\t\tshell.pack();"); out.println("\t\tshell.open();"); ! out.println("\t}\n"); if(rootElement.equals("Dialog")) |
|
From: cuongnt <cu...@us...> - 2004-10-14 20:14:07
|
Update of /cvsroot/javaclient/javaclient/net/sourceforge/javaclient/client/component In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27665/net/sourceforge/javaclient/client/component Modified Files: JCFactory.java Log Message: add dialog widget Index: JCFactory.java =================================================================== RCS file: /cvsroot/javaclient/javaclient/net/sourceforge/javaclient/client/component/JCFactory.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** JCFactory.java 5 Oct 2004 20:51:09 -0000 1.5 --- JCFactory.java 14 Oct 2004 20:13:25 -0000 1.6 *************** *** 34,37 **** --- 34,48 ---- } + public static Shell newShell(Shell parent, int style) + { + Shell s = new Shell(parent, style); + GridLayout shellLayout = Layout.newGridLayout(1, 0); + shellLayout.marginHeight = 0; + shellLayout.marginWidth = 0; + shellLayout.verticalSpacing = 0; + s.setLayout(shellLayout); + return(s); + } + public static Text newText(Widget parent, int cols, int rows, int justify, int span,int limit, boolean readOnly) { |
|
From: cuongnt <cu...@us...> - 2004-10-14 20:14:05
|
Update of /cvsroot/javaclient/javaclient/net/sourceforge/javaclient/tools/xsl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27665/net/sourceforge/javaclient/tools/xsl Modified Files: ClassGenerator.java Log Message: add dialog widget Index: ClassGenerator.java =================================================================== RCS file: /cvsroot/javaclient/javaclient/net/sourceforge/javaclient/tools/xsl/ClassGenerator.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ClassGenerator.java 13 Oct 2004 21:09:51 -0000 1.3 --- ClassGenerator.java 14 Oct 2004 20:13:25 -0000 1.4 *************** *** 163,176 **** String externControllerName = externControllerInterface.size()>0 ? name+"ExternController" : null; String modelName = name+"Model"; ! String displayName = name + display; ! PrintStream out = openFile(name + display + "java"); out.println("package "+packageName+";\n"); out.println("import java.util.Stack;"); ! out.println("import org.eclipse.swt.widgets." + display + ";"); ! out.println("import org.eclipse.swt.widgets.Widget;"); - out.println("import org.eclipse.swt.events.ShellListener;"); - out.println("import org.eclipse.swt.events.ShellAdapter;"); - out.println("import org.eclipse.swt.events.ShellEvent;"); out.println("import net.sourceforge.javaclient.client.proxy.ClientModelProxy;"); out.println("import "+packageName+".model."+modelName+";"); --- 163,184 ---- String externControllerName = externControllerInterface.size()>0 ? name+"ExternController" : null; String modelName = name+"Model"; ! String rootElementName = name + rootElement; ! PrintStream out = openFile(name + rootElement + ".java"); out.println("package "+packageName+";\n"); out.println("import java.util.Stack;"); ! out.println("import org.eclipse.swt.widgets.Display;"); ! if(rootElement.equals("Dialog")) ! { ! out.println("import org.eclipse.swt.widgets.Shell;"); ! out.println("import org.eclipse.swt.widgets.Dialog;"); ! } ! else ! { ! out.println("import org.eclipse.swt.events.ShellListener;"); ! out.println("import org.eclipse.swt.events.ShellAdapter;"); ! out.println("import org.eclipse.swt.events.ShellEvent;"); ! } ! out.println("import org.eclipse.swt.widgets.Widget;"); out.println("import net.sourceforge.javaclient.client.proxy.ClientModelProxy;"); out.println("import "+packageName+".model."+modelName+";"); *************** *** 181,185 **** out.println("import "+i.next()+";"); } ! if(display.equals("Display")) { out.println("\npublic abstract class "+ name + --- 189,201 ---- out.println("import "+i.next()+";"); } ! ! if(rootElement.equals("Dialog")) ! { ! out.println("\npublic abstract class "+ name + ! "Dialog extends Dialog\n{"); ! out.print("\tpublic " + name + ! "Dialog(Shell parent)\n\t{\n\t\tsuper(parent);\n\t}\n"); ! } ! else { out.println("\npublic abstract class "+ name + *************** *** 191,201 **** "Display(Display aDpy)\n\t{\t\tdpy = aDpy;\n\t}\n"); } ! else ! { ! out.println("\npublic abstract class "+ name + ! "Dialog extends Dialog\n{"); ! out.print("\tpublic " + name + ! "Dialog(Shell parent)\n\t{\t\tsuper(parent);\n\t}\n"); ! } out.print("\tpublic void create(boolean isVisible)\n\t{\n"); out.print("\t\tWidget parent = null;\n"); --- 207,211 ---- "Display(Display aDpy)\n\t{\t\tdpy = aDpy;\n\t}\n"); } ! out.print("\tpublic void create(boolean isVisible)\n\t{\n"); out.print("\t\tWidget parent = null;\n"); *************** *** 223,229 **** out.println("\t\t} catch(Exception e) { throw new RuntimeException(\"Fatal error in getting ejb\"); }"); ! if(display.equals("Display")) out.println("\t\tif(dpy == null)\n\t\t{\n\t\t\tdpy = Display.getDefault();\n\t\t}\n"); out.println("\t\tStack parentStack = new Stack();"); // get rid of extra PopStack while(components.get(components.size()-1) instanceof PopStack) --- 233,248 ---- out.println("\t\t} catch(Exception e) { throw new RuntimeException(\"Fatal error in getting ejb\"); }"); ! if(rootElement.equals("Display")) out.println("\t\tif(dpy == null)\n\t\t{\n\t\t\tdpy = Display.getDefault();\n\t\t}\n"); out.println("\t\tStack parentStack = new Stack();"); + if(rootElement.equals("Dialog")) + { + out.print("\t\tshell ="); + out.print("\t\t\t\tJCFactory.newShell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);\n"); + if(title != null) + out.print("\t\tshell.setText(\"" + title + "\");"); + out.print("\t\tparentStack.push(parent);"); + out.print("\t\tparent = shell;\n"); + } // get rid of extra PopStack while(components.get(components.size()-1) instanceof PopStack) *************** *** 242,248 **** out.println("\t\tshell.open();"); out.println("\t}"); out.println("\tpublic "+modelName+" getModel()"); out.println("\t{\n\t\treturn(("+modelName+")proxy.getInstance());\n\t}\n"); - out.println("\tpublic void shellClosed(ShellEvent e) {}"); i = dpyObjects.keySet().iterator(); --- 261,286 ---- out.println("\t\tshell.open();"); out.println("\t}"); + + if(rootElement.equals("Dialog")) + { + out.println("\n\tpublic Object open()"); + out.println("\t{"); + out.println("\t\tDisplay dpy = shell.getDisplay();"); + out.println("\t\twhile (!shell.isDisposed())"); + out.println("\t\t{"); + out.println("\t\t\tif(!dpy.readAndDispatch())"); + out.println("\t\t\t\t dpy.sleep();"); + out.println("\t\t}"); + + out.println("\t\treturn(retVal);"); + out.println("\t}\n"); + } + else + { + out.println("\tpublic void shellClosed(ShellEvent e) {}"); + } + out.println("\tpublic "+modelName+" getModel()"); out.println("\t{\n\t\treturn(("+modelName+")proxy.getInstance());\n\t}\n"); i = dpyObjects.keySet().iterator(); *************** *** 276,280 **** ! out.println("\tprivate Display dpy;"); out.println("\tprivate ClientModelProxy proxy;"); i = dpyObjects.keySet().iterator(); --- 314,324 ---- ! if(rootElement.equals("Display")) ! out.println("\tprivate Display dpy;"); ! else if(rootElement.equals("Dialog")) ! { ! out.println("\tprotected Shell shell;"); ! out.println("\tprotected Object retVal = null;"); ! } out.println("\tprivate ClientModelProxy proxy;"); i = dpyObjects.keySet().iterator(); *************** *** 361,365 **** public void setToDialog() { ! display = "Dialog"; } --- 405,414 ---- public void setToDialog() { ! rootElement = "Dialog"; ! } ! ! public void setTitle(String aTitle) ! { ! title = aTitle; } *************** *** 383,387 **** private ArrayList modelNames; private ArrayList models; ! private String display = "Display"; } --- 432,437 ---- private ArrayList modelNames; private ArrayList models; ! private String rootElement = "Display"; ! private String title = null; } |
|
From: cuongnt <cu...@us...> - 2004-10-14 20:14:04
|
Update of /cvsroot/javaclient/javaclient/metadata In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27665/metadata Modified Files: jc.xsl Log Message: add dialog widget Index: jc.xsl =================================================================== RCS file: /cvsroot/javaclient/javaclient/metadata/jc.xsl,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** jc.xsl 13 Oct 2004 21:09:51 -0000 1.8 --- jc.xsl 14 Oct 2004 20:13:25 -0000 1.9 *************** *** 22,30 **** <xsl:template match="dialog"> <xsl:value-of select="jc:setToDialog($class)"/> <xsl:value-of select="jc:setOutputPath($class,$outputPath)"/> <xsl:value-of select="jc:setPackage($class,@package)"/> <xsl:value-of select="jc:setName($class,@name)"/> <xsl:value-of select="jc:setEvent($class,@event)"/> ! <xsl:apply-templates select="window"/> <xsl:value-of select="jc:makeClasses($class)"/> --- 22,36 ---- <xsl:template match="dialog"> <xsl:value-of select="jc:setToDialog($class)"/> + <xsl:value-of select="jc:setTitle($class, @title)"/> <xsl:value-of select="jc:setOutputPath($class,$outputPath)"/> <xsl:value-of select="jc:setPackage($class,@package)"/> <xsl:value-of select="jc:setName($class,@name)"/> <xsl:value-of select="jc:setEvent($class,@event)"/> ! ! <xsl:variable name="workArea" select="jc:WorkArea.new(@margin)"/> ! <xsl:value-of select="jc:addComponent($class,$workArea,true())"/> ! <xsl:call-template name="processWidgets"/> ! <xsl:value-of select="jc:endComponent($class)"/> ! <xsl:value-of select="jc:endComponent($class)"/> <xsl:value-of select="jc:makeClasses($class)"/> |
|
From: cuongnt <cu...@us...> - 2004-10-13 21:10:17
|
Update of /cvsroot/javaclient/javaclient/metadata In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30909/metadata Modified Files: jc.xsl Log Message: develop jc dialog Index: jc.xsl =================================================================== RCS file: /cvsroot/javaclient/javaclient/metadata/jc.xsl,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** jc.xsl 7 Oct 2004 15:23:29 -0000 1.7 --- jc.xsl 13 Oct 2004 21:09:51 -0000 1.8 *************** *** 20,23 **** --- 20,35 ---- </xsl:template> + <xsl:template match="dialog"> + <xsl:value-of select="jc:setToDialog($class)"/> + <xsl:value-of select="jc:setOutputPath($class,$outputPath)"/> + <xsl:value-of select="jc:setPackage($class,@package)"/> + <xsl:value-of select="jc:setName($class,@name)"/> + <xsl:value-of select="jc:setEvent($class,@event)"/> + <xsl:apply-templates select="window"/> + + <xsl:value-of select="jc:makeClasses($class)"/> + </xsl:template> + + <xsl:template match="window"> <xsl:variable name="window" select="jc:Shell.new(@id)"/> |
|
From: cuongnt <cu...@us...> - 2004-10-13 21:10:17
|
Update of /cvsroot/javaclient/javaclient/net/sourceforge/javaclient/tools/xsl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30909/net/sourceforge/javaclient/tools/xsl Modified Files: ClassGenerator.java Log Message: develop jc dialog Index: ClassGenerator.java =================================================================== RCS file: /cvsroot/javaclient/javaclient/net/sourceforge/javaclient/tools/xsl/ClassGenerator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ClassGenerator.java 7 Oct 2004 14:46:47 -0000 1.2 --- ClassGenerator.java 13 Oct 2004 21:09:51 -0000 1.3 *************** *** 163,171 **** String externControllerName = externControllerInterface.size()>0 ? name+"ExternController" : null; String modelName = name+"Model"; ! String displayName = name+"Display"; ! PrintStream out = openFile(name+"Display.java"); out.println("package "+packageName+";\n"); out.println("import java.util.Stack;"); ! out.println("import org.eclipse.swt.widgets.Display;"); out.println("import org.eclipse.swt.widgets.Widget;"); out.println("import org.eclipse.swt.events.ShellListener;"); --- 163,172 ---- String externControllerName = externControllerInterface.size()>0 ? name+"ExternController" : null; String modelName = name+"Model"; ! String displayName = name + display; ! PrintStream out = openFile(name + display + "java"); out.println("package "+packageName+";\n"); out.println("import java.util.Stack;"); ! out.println("import org.eclipse.swt.widgets." + display + ";"); ! out.println("import org.eclipse.swt.widgets.Widget;"); out.println("import org.eclipse.swt.events.ShellListener;"); *************** *** 180,192 **** out.println("import "+i.next()+";"); } ! out.println("\npublic abstract class "+name+"Display extends ShellAdapter {"); ! ! // Constructor ! out.println("\tpublic " + name+"Display(){}"); ! out.print("\tpublic " + name+"Display(Display aDpy)\n\t{\t\tdpy = aDpy;\n\t}\n"); out.print("\tpublic void create(boolean isVisible)\n\t{\n"); out.print("\t\tWidget parent = null;\n"); ! out.println("\t\tproxy = new ClientModelProxy("+packageName+".model."+modelName+".class,this);"); i = listClasses.keySet().iterator(); while(i.hasNext()) --- 181,205 ---- out.println("import "+i.next()+";"); } ! if(display.equals("Display")) ! { ! out.println("\npublic abstract class "+ name + ! "Display extends ShellAdapter\n{"); ! // Constructor ! out.println("\tpublic " + name+"Display(){}"); ! out.print("\tpublic " + name+ ! "Display(Display aDpy)\n\t{\t\tdpy = aDpy;\n\t}\n"); ! } ! else ! { ! out.println("\npublic abstract class "+ name + ! "Dialog extends Dialog\n{"); ! out.print("\tpublic " + name + ! "Dialog(Shell parent)\n\t{\t\tsuper(parent);\n\t}\n"); ! } out.print("\tpublic void create(boolean isVisible)\n\t{\n"); out.print("\t\tWidget parent = null;\n"); ! out.println("\t\tproxy = new ClientModelProxy("+ ! packageName+".model."+modelName+".class,this);"); i = listClasses.keySet().iterator(); while(i.hasNext()) *************** *** 196,204 **** if(classInfo[0].indexOf('.') == -1) { ! out.println("\t\tproxy.addListClass(\""+key+"List\","+packageName+".model."+classInfo[0]+".class,\""+classInfo[1]+"\");"); } else { ! out.println("\t\tproxy.addListClass(\""+key+"List\","+classInfo[0]+",\""+classInfo[1]+"\");"); } } --- 209,219 ---- if(classInfo[0].indexOf('.') == -1) { ! out.println("\t\tproxy.addListClass(\""+ key + "List\"," + ! packageName+".model."+classInfo[0]+".class,\""+classInfo[1]+"\");"); } else { ! out.println("\t\tproxy.addListClass(\""+key+"List\","+ ! classInfo[0]+",\""+classInfo[1]+"\");"); } } *************** *** 208,212 **** out.println("\t\t} catch(Exception e) { throw new RuntimeException(\"Fatal error in getting ejb\"); }"); ! out.println("\t\tif(dpy == null)\n\t\t{\n\t\t\tdpy = Display.getDefault();\n\t\t}\n"); out.println("\t\tStack parentStack = new Stack();"); // get rid of extra PopStack --- 223,228 ---- out.println("\t\t} catch(Exception e) { throw new RuntimeException(\"Fatal error in getting ejb\"); }"); ! if(display.equals("Display")) ! out.println("\t\tif(dpy == null)\n\t\t{\n\t\t\tdpy = Display.getDefault();\n\t\t}\n"); out.println("\t\tStack parentStack = new Stack();"); // get rid of extra PopStack *************** *** 343,346 **** --- 359,367 ---- } + public void setToDialog() + { + display = "Dialog"; + } + private HashMap imports = new HashMap(); private HashMap dpyObjects = new HashMap(); *************** *** 362,365 **** --- 383,387 ---- private ArrayList modelNames; private ArrayList models; + private String display = "Display"; } |
|
From: Dave S. <rim...@us...> - 2004-10-08 13:57:52
|
Update of /cvsroot/javaclient/javaclient/swt/gtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4353/swt/gtk Added Files: libswt-atk-gtk-3063.so libswt-awt-gtk-3063.so libswt-gnome-gtk-3063.so libswt-gtk-3063.so libswt-mozilla-gtk-3063.so libswt-pi-gtk-3063.so swt-mozilla.jar swt-pi.jar swt.jar Log Message: Added swt 3.0.1 --- NEW FILE: swt-mozilla.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: libswt-pi-gtk-3063.so --- (This appears to be a binary file; contents omitted.) --- NEW FILE: libswt-gtk-3063.so --- (This appears to be a binary file; contents omitted.) --- NEW FILE: libswt-mozilla-gtk-3063.so --- (This appears to be a binary file; contents omitted.) --- NEW FILE: swt-pi.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: libswt-gnome-gtk-3063.so --- (This appears to be a binary file; contents omitted.) --- NEW FILE: swt.jar --- (This appears to be a binary file; contents omitted.) --- NEW FILE: libswt-atk-gtk-3063.so --- (This appears to be a binary file; contents omitted.) --- NEW FILE: libswt-awt-gtk-3063.so --- (This appears to be a binary file; contents omitted.) |
|
From: Dave S. <rim...@us...> - 2004-10-08 13:57:51
|
Update of /cvsroot/javaclient/javaclient/swt/win In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4353/swt/win Added Files: swt-awt-win32-3063.dll swt-win32-3063.dll swt.jar Log Message: Added swt 3.0.1 --- NEW FILE: swt-awt-win32-3063.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: swt-win32-3063.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: swt.jar --- (This appears to be a binary file; contents omitted.) |
|
From: Dave S. <rim...@us...> - 2004-10-08 13:55:09
|
Update of /cvsroot/javaclient/javaclient/swt/win In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3965/win Log Message: Directory /cvsroot/javaclient/javaclient/swt/win added to the repository |
|
From: Dave S. <rim...@us...> - 2004-10-08 13:55:09
|
Update of /cvsroot/javaclient/javaclient/swt/gtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3965/gtk Log Message: Directory /cvsroot/javaclient/javaclient/swt/gtk added to the repository |
|
From: Dave S. <rim...@us...> - 2004-10-08 13:55:00
|
Update of /cvsroot/javaclient/javaclient/swt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3887/swt Log Message: Directory /cvsroot/javaclient/javaclient/swt added to the repository |
|
From: Dave S. <rim...@us...> - 2004-10-08 13:41:34
|
Update of /cvsroot/javaclient/javaclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1116 Modified Files: build.xml Log Message: Speced out life thread. Needs to be tested Index: build.xml =================================================================== RCS file: /cvsroot/javaclient/javaclient/build.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** build.xml 8 Oct 2004 12:35:26 -0000 1.6 --- build.xml 8 Oct 2004 13:41:17 -0000 1.7 *************** *** 29,36 **** <target name="client-compile" depends="init"> <javac srcdir="${basedir}" ! destdir="${build.client}" classpath="${swt.jar}:${jboss.jar}"> <include name="net/sourceforge/javaclient/client/**"/> <include name="net/sourceforge/javaclient/model/**"/> <include name="net/sf/javaclient/model/**"/> </javac> </target> --- 29,37 ---- <target name="client-compile" depends="init"> <javac srcdir="${basedir}" ! destdir="${build.client}" classpath="${swt.jar}:${jboss.jar}:${build.ejb}"> <include name="net/sourceforge/javaclient/client/**"/> <include name="net/sourceforge/javaclient/model/**"/> <include name="net/sf/javaclient/model/**"/> + <include name="net/sf/javaclient/client/**"/> </javac> </target> |
|
From: Dave S. <rim...@us...> - 2004-10-08 13:41:34
|
Update of /cvsroot/javaclient/javaclient/net/sf/javaclient/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1116/net/sf/javaclient/client Modified Files: JavaClient.java Log Message: Speced out life thread. Needs to be tested Index: JavaClient.java =================================================================== RCS file: /cvsroot/javaclient/javaclient/net/sf/javaclient/client/JavaClient.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JavaClient.java 8 Oct 2004 12:35:27 -0000 1.1 --- JavaClient.java 8 Oct 2004 13:41:17 -0000 1.2 *************** *** 1,9 **** package net.sf.javaclient.client; public class JavaClient { ! // register with server to get client id ! // start ping thread ! public static final Long clientId = null; } --- 1,81 ---- package net.sf.javaclient.client; + import javax.naming.InitialContext; + import net.sf.javaclient.server.ejb.JavaclientServer; + import net.sf.javaclient.server.ejb.JavaclientServerHome; + public class JavaClient + implements Runnable { ! public static Long clientId; ! ! public JavaClient() ! throws Exception ! { ! if(ping !=null) ! { ! return; ! } ! InitialContext ctx = new InitialContext(); ! Object objRef = ctx.lookup(JavaclientServerHome.JNDI_NAME); ! JavaclientServerHome home = null; ! if (JavaclientServerHome.class.isInstance(java.rmi.Remote.class)) ! { ! home = (JavaclientServerHome)javax.rmi.PortableRemoteObject.narrow(objRef, JavaclientServerHome.class); ! } ! else ! { ! home = (JavaclientServerHome)objRef; ! } ! server=home.create(); ! ctx.close(); ! clientId=server.getClientId(); ! ping = new Thread(this,"JavaClient"); ! ping.start(); ! } ! public void close() ! { ! if(ping != null) ! { ! ping.interrupt(); ! try ! { ! ping.join(); ! } ! catch(InterruptedException intr) ! { ! } ! } ! } ! ! public void run() ! { ! try ! { ! while(true) ! { ! Thread.sleep(1000*60*5); ! server.ping(clientId); ! } ! } ! catch(InterruptedException inter) ! { ! try ! { ! server.exit(clientId); ! } ! catch(Exception err) ! { ! err.printStackTrace(); ! } ! } ! catch(Exception e) ! { ! e.printStackTrace(); ! } ! } ! ! private JavaclientServer server; ! private static Thread ping = null; } |
|
From: Dave S. <rim...@us...> - 2004-10-08 13:41:34
|
Update of /cvsroot/javaclient/javaclient/net/sf/javaclient/server/ejb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1116/net/sf/javaclient/server/ejb Modified Files: JavaclientServer.java JavaclientServerBean.java Log Message: Speced out life thread. Needs to be tested Index: JavaclientServerBean.java =================================================================== RCS file: /cvsroot/javaclient/javaclient/net/sf/javaclient/server/ejb/JavaclientServerBean.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JavaclientServerBean.java 7 Oct 2004 15:23:31 -0000 1.2 --- JavaclientServerBean.java 8 Oct 2004 13:41:17 -0000 1.3 *************** *** 22,28 **** @ejb:interface-method view-type="remote" */ ! public String testString(String myArg) { ! return(myArg); } --- 22,47 ---- @ejb:interface-method view-type="remote" */ ! public void ping(Long clientId) { ! } ! ! /** ! @ejb:interface-method view-type="remote" ! */ ! public void exit(Long clientId) ! { ! } ! ! /** ! @ejb:interface-method view-type="remote" ! */ ! public Long getClientId() ! { ! synchronized(clientId) ! { ! Long id = clientId; ! clientId = new Long(clientId.longValue()+1); ! return(id); ! } } *************** *** 39,42 **** --- 58,62 ---- public void ejbRemove() {} private SessionContext ctx; + private static Long clientId = new Long(1); } Index: JavaclientServer.java =================================================================== RCS file: /cvsroot/javaclient/javaclient/net/sf/javaclient/server/ejb/JavaclientServer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JavaclientServer.java 7 Oct 2004 15:23:30 -0000 1.1 --- JavaclientServer.java 8 Oct 2004 13:41:17 -0000 1.2 *************** *** 11,16 **** { ! public java.lang.String testString( java.lang.String myArg ) throws java.rmi.RemoteException; } --- 11,21 ---- { ! public void ping( java.lang.Long clientId ) throws java.rmi.RemoteException; + public void exit( java.lang.Long clientId ) + throws java.rmi.RemoteException; + + public java.lang.Long getClientId() + throws java.rmi.RemoteException; } |
|
From: Dave S. <rim...@us...> - 2004-10-08 12:35:45
|
Update of /cvsroot/javaclient/javaclient/net/sf/javaclient/server/jboss In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18766/net/sf/javaclient/server/jboss Modified Files: DeSerializeModel.java Log Message: Layout what the invokers will do. they should not get in the way of any of current ejb code Index: DeSerializeModel.java =================================================================== RCS file: /cvsroot/javaclient/javaclient/net/sf/javaclient/server/jboss/DeSerializeModel.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DeSerializeModel.java 7 Oct 2004 15:23:31 -0000 1.2 --- DeSerializeModel.java 8 Oct 2004 12:35:28 -0000 1.3 *************** *** 6,9 **** --- 6,10 ---- import java.util.HashMap; import net.sf.javaclient.client.jboss.JCResponse; + import net.sf.javaclient.server.ModelCache; public class DeSerializeModel extends AbstractInterceptor *************** *** 12,23 **** throws Exception { ! Object args[] = mi.getArguments(); ! if(args != null) { ! args[0]="My Server string"; ! mi.setArguments(args); } - Object returnVal = getNext().invoke(mi); - return(new JCResponse(returnVal,null)); } } --- 13,36 ---- throws Exception { ! Long clientId = (Long)mi.getValue("jc.clientId"); ! if(clientId != null) { ! Object args[] = mi.getArguments(); ! for(int i=0;i<args.length;i++) ! { ! HashMap changes = (HashMap)mi.getValue("jc.args."+i); ! if(changes != null) ! { ! Long serverId = (Long)mi.getValue("jc.args."+i+".serverId"); ! args[i] = ModelCache.getModel(clientId,serverId,changes); ! } ! } ! Object returnVal = getNext().invoke(mi); ! return(new JCResponse(returnVal,ModelCache.getClientModelChanges(clientId))); ! } ! else ! { ! return(getNext().invoke(mi)); } } } |
|
From: Dave S. <rim...@us...> - 2004-10-08 12:35:45
|
Update of /cvsroot/javaclient/javaclient/net/sf/javaclient/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18766/net/sf/javaclient/server Added Files: ModelCache.java Log Message: Layout what the invokers will do. they should not get in the way of any of current ejb code --- NEW FILE: ModelCache.java --- package net.sf.javaclient.server; import java.util.HashMap; public class ModelCache { public static Object getModel(Long clientId,Long serverId,HashMap changes) { return(null); } public static HashMap getClientModelChanges(Long clientId) { return(null); } public static void flushClient(Long clientId) { } } |
|
From: Dave S. <rim...@us...> - 2004-10-08 12:35:44
|
Update of /cvsroot/javaclient/javaclient/net/sf/javaclient/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18766/net/sf/javaclient/model Modified Files: Model.java ObjectReplication.java Log Message: Layout what the invokers will do. they should not get in the way of any of current ejb code Index: Model.java =================================================================== RCS file: /cvsroot/javaclient/javaclient/net/sf/javaclient/model/Model.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Model.java 8 Oct 2004 03:14:45 -0000 1.2 --- Model.java 8 Oct 2004 12:35:27 -0000 1.3 *************** *** 102,113 **** return(serverId); } - public Long getClientId() - { - return(clientId); - } - public void setClientId(Long aClientId) - { - clientId=aClientId; - } public void firePropertyVetoChange(String property,Object oldVal,Object newVal) throws PropertyVetoException {} --- 102,105 ---- *************** *** 116,120 **** private HashMap values,changeEvent; private Class modelClass; ! private Long serverId,clientId; private boolean isUpdate=false; } --- 108,112 ---- private HashMap values,changeEvent; private Class modelClass; ! private Long serverId; private boolean isUpdate=false; } Index: ObjectReplication.java =================================================================== RCS file: /cvsroot/javaclient/javaclient/net/sf/javaclient/model/ObjectReplication.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ObjectReplication.java 7 Oct 2004 20:41:01 -0000 1.1 --- ObjectReplication.java 8 Oct 2004 12:35:27 -0000 1.2 *************** *** 9,14 **** public Long getServerId(); public void setServerId(Long value); - public Long getClientId(); - public void setClientId(Long value); } --- 9,12 ---- |
|
From: Dave S. <rim...@us...> - 2004-10-08 12:35:44
|
Update of /cvsroot/javaclient/javaclient/net/sf/javaclient/client/jboss In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18766/net/sf/javaclient/client/jboss Modified Files: SerializeModel.java Log Message: Layout what the invokers will do. they should not get in the way of any of current ejb code Index: SerializeModel.java =================================================================== RCS file: /cvsroot/javaclient/javaclient/net/sf/javaclient/client/jboss/SerializeModel.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SerializeModel.java 7 Oct 2004 15:23:29 -0000 1.2 --- SerializeModel.java 8 Oct 2004 12:35:27 -0000 1.3 *************** *** 5,8 **** --- 5,9 ---- import org.jboss.proxy.Interceptor; import org.jboss.invocation.Invocation; + import net.sf.javaclient.model.ObjectReplication; *************** *** 11,20 **** public Object invoke(Invocation mi) throws Throwable { ! //mi.setValue("jc.client",getClientId); ! //mi.setValue("jc.arg0",mi.args[0].mapId); ! mi.args[0]=null; ! JCResponse r =(JCResponse)(getNext().invoke(mi)); ! //curModel.updateChanges(r.changes); ! return(r.response); } } --- 12,37 ---- public Object invoke(Invocation mi) throws Throwable { ! if(mi.args != null) ! { ! boolean serializeArgs = false; ! for(int i=0;i<mi.args.length;i++) ! { ! if(mi.args[i] instanceof ObjectReplication) ! { ! serializeArgs=true; ! mi.setValue("jc.args."+i,((ObjectReplication)mi.args[i]).getChangeEvents()); ! mi.setValue("jc.args."+i+".server",((ObjectReplication)mi.args[i]).getServerId()); ! serializeArgs=true; ! mi.args[i]=null; ! } ! } ! if(serializeArgs) ! { ! mi.setValue("jc.clientId",net.sf.javaclient.client.JavaClient.clientId); ! JCResponse r =(JCResponse)(getNext().invoke(mi)); ! return(r.response); ! } ! } ! return(getNext().invoke(mi)); } } |
|
From: Dave S. <rim...@us...> - 2004-10-08 12:35:42
|
Update of /cvsroot/javaclient/javaclient/net/sf/javaclient/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18766/net/sf/javaclient/client Added Files: JavaClient.java Log Message: Layout what the invokers will do. they should not get in the way of any of current ejb code --- NEW FILE: JavaClient.java --- package net.sf.javaclient.client; public class JavaClient { // register with server to get client id // start ping thread public static final Long clientId = null; } |
|
From: Dave S. <rim...@us...> - 2004-10-08 12:35:41
|
Update of /cvsroot/javaclient/javaclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18766 Modified Files: build.xml Log Message: Layout what the invokers will do. they should not get in the way of any of current ejb code Index: build.xml =================================================================== RCS file: /cvsroot/javaclient/javaclient/build.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** build.xml 8 Oct 2004 03:14:45 -0000 1.5 --- build.xml 8 Oct 2004 12:35:26 -0000 1.6 *************** *** 40,45 **** destdir="${build.server}" classpath="${jboss.jar}:${build.client}" ! includes="net/sf/javaclient/server/jboss/*.java,net/sf/javaclient/client/jboss/*.java"/> ! <jar jarfile="${dist}/jc-server.jar" basedir="${build.server}"/> </target> --- 40,46 ---- destdir="${build.server}" classpath="${jboss.jar}:${build.client}" ! includes="net/sf/javaclient/server/**,net/sf/javaclient/client/jboss/*.java,net/sf/javaclient/model/*.java" ! /> ! <jar jarfile="${dist}/javaclient-jboss.jar" basedir="${build.server}"/> </target> |
|
From: Dave S. <rim...@us...> - 2004-10-08 03:15:03
|
Update of /cvsroot/javaclient/javaclient/tests/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11774/tests/model Modified Files: TestList.java TestModel.java Added Files: MockListModel.java MockModel.java ModelSuite.java Log Message: Added tests for basic model handling and list handling. Now we need to handle the callbacks and updates from the List Index: TestModel.java =================================================================== RCS file: /cvsroot/javaclient/javaclient/tests/model/TestModel.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestModel.java 7 Oct 2004 20:41:01 -0000 1.1 --- TestModel.java 8 Oct 2004 03:14:46 -0000 1.2 *************** *** 1,6 **** package tests.model; ! ! import org.junit.*; public class TestModel extends TestCase --- 1,11 ---- package tests.model; ! import java.util.HashMap; ! import java.lang.reflect.Method; ! import java.beans.PropertyVetoException; ! import junit.framework.*; ! import net.sf.javaclient.model.Model; ! import net.sf.javaclient.model.CallbackModel; ! import net.sf.javaclient.model.ObjectReplication; public class TestModel extends TestCase *************** *** 11,14 **** --- 16,206 ---- } + public void testGetProxy() + { + Model m = new Model(MockModel.class); + Object o = m.getProxy(); + assertTrue("Not MockModel",o instanceof MockModel); + assertTrue("Not ObjectReplication",o instanceof ObjectReplication); + } + public void testSetProxyValues() + { + Model m = new Model(MockModel.class); + MockModel mock = (MockModel)m.getProxy(); + mock.setField("crap"); + assertEquals("crap",mock.getField()); + } + + public void testPropertySetGet() + throws Exception + { + Model m = new Model(MockModel.class); + m.setProperty("field","whoo"); + assertEquals("whoo",m.getProperty("field")); + } + + public void testPropertyChange() + throws Exception + { + Model m = new Model(MockModel.class); + m.setProperty("field","whoo"); + HashMap change = m.getChangeEvents(); + assertEquals(1,change.size()); + assertEquals("whoo",change.get("field")); + change = m.getChangeEvents(); + assertEquals(0,change.size()); + } + + public void testNoPropertyChangeNullChange() + throws Exception + { + Model m = new Model(MockModel.class); + m.setProperty("field","whoo"); + m.getChangeEvents(); + m.setProperty("field","whoo"); + m.setProperty("field1","crap"); + HashMap change = m.getChangeEvents(); + assertEquals(1,change.size()); + assertEquals("crap",change.get("field1")); + } + + public void testSetPropertyNull() + throws Exception + { + Model m = new Model(MockModel.class); + m.setProperty("field",null); + HashMap change = m.getChangeEvents(); + assertEquals(0,change.size()); + } + + public void testSetPropertyToNewNull() + throws Exception + { + Model m = new Model(MockModel.class); + m.setProperty("field1","abc"); + m.getChangeEvents(); + + m.setProperty("field1",null); + HashMap change = m.getChangeEvents(); + assertEquals(1,change.size()); + assertEquals(null,change.get("field1")); + } + + public void testUpdateProperty() + { + Model m = new Model(MockModel.class); + HashMap change = new HashMap(); + change.put("field","abc"); + change.put("field1","xyz"); + m.updateModel(change); + assertEquals("abc",m.getProperty("field")); + assertEquals("xyz",m.getProperty("field1")); + assertEquals(0,m.getChangeEvents().size()); + } + + public void testAddPropertyChangeListener() + throws PropertyVetoException + { + TestListener l = new TestListener(); + CallbackModel m = new CallbackModel(MockModel.class); + m.addPropertyChangeListener("field",l,TestListener.change); + m.setProperty("field","crap"); + assertTrue("Listener Not Called",l.called); + assertEquals(null,l.oldVal); + assertEquals("crap",l.newVal); + } + + public void testPropertyChangeListenerOnUpdate() + { + TestListener l = new TestListener(); + CallbackModel m = new CallbackModel(MockModel.class); + m.addPropertyChangeListener("field",l,TestListener.change); + + HashMap change = new HashMap(); + change.put("field","abc"); + m.updateModel(change); + assertTrue("Listener Not Called",l.called); + assertEquals(null,l.oldVal); + assertEquals("abc",l.newVal); + } + + public void testAddPropertyVetoListener() + throws PropertyVetoException + { + TestListener l = new TestListener(); + CallbackModel m = new CallbackModel(MockModel.class); + m.addVetoableChangeListener("field",l,TestListener.vetoChange); + m.setProperty("field","crap"); + assertTrue("Listener Not Called",l.vcalled); + assertEquals(null,l.oldVal); + assertEquals("crap",l.newVal); + } + + public void testPropertyVeto() + { + TestListener l = new TestListener(); + CallbackModel m = new CallbackModel(MockModel.class); + m.addVetoableChangeListener("field",l,TestListener.vetoChange); + l.veto=true; + try + { + m.setProperty("field","crap"); + fail("PropertyVetoException not thrown"); + } + catch(PropertyVetoException e) {} + + assertEquals(null,m.getProperty("field")); + } + + public void testPropertyVetoOnUpdate() + throws PropertyVetoException + { + TestListener l = new TestListener(); + CallbackModel m = new CallbackModel(MockModel.class); + m.addVetoableChangeListener("field",l,TestListener.vetoChange); + HashMap change = new HashMap(); + change.put("field","abc"); + m.updateModel(change); + assertTrue("Listener Called",!l.vcalled); + } + + public static class TestListener + { + public boolean called=false; + public boolean vcalled=false; + public boolean veto=false; + public Object oldVal; + public Object newVal; + + public void change(String anOldVal,String aNewVal) + { + called=true; + oldVal=anOldVal; + newVal=aNewVal; + } + public void vetoChange(String anOldVal,String aNewVal) + throws PropertyVetoException + { + vcalled=true; + oldVal=anOldVal; + newVal=aNewVal; + if(veto) + { + throw new PropertyVetoException("You wanted me to!",null); + } + } + + public static Method change = null; + public static Method vetoChange = null; + static + { + try + { + change = TestListener.class.getDeclaredMethod("change", new Class[] {String.class,String.class}); + vetoChange = TestListener.class.getDeclaredMethod("vetoChange", new Class[] {String.class,String.class}); + } catch(Exception e) {} + } + } + + } --- NEW FILE: MockListModel.java --- package tests.model; public interface MockListModel { public void setField(String field); public String getField(); // attribute Collection public MockModel newCollectionItem(); public MockModel newCollectionItem(int pos); public MockModel getCollectionItem(int pos); public void removeCollectionItem(int pos); public void clearCollectionItem(); public int sizeCollectionItem(); } --- NEW FILE: MockModel.java --- package tests.model; public interface MockModel { public void setField(String field); public String getField(); public void setField1(String field); public String getField1(); } --- NEW FILE: ModelSuite.java --- package tests.model; import junit.framework.*; public class ModelSuite { public static Test suite() throws Exception { TestSuite s = new TestSuite(); s.addTest(new TestSuite(tests.model.TestList.class)); s.addTest(new TestSuite(tests.model.TestModel.class)); return(s); } } Index: TestList.java =================================================================== RCS file: /cvsroot/javaclient/javaclient/tests/model/TestList.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestList.java 7 Oct 2004 20:41:01 -0000 1.1 --- TestList.java 8 Oct 2004 03:14:46 -0000 1.2 *************** *** 1,6 **** package tests.model; ! ! import org.junit.*; public class TestList extends TestCase --- 1,6 ---- package tests.model; ! import junit.framework.*; ! import net.sf.javaclient.model.ListModel; public class TestList extends TestCase *************** *** 11,14 **** --- 11,56 ---- } + public void testAddItem() + { + ListModel l = new ListModel(MockModel.class); + MockModel m = (MockModel)l.newListItem(); + assertTrue("Not a proxy",java.lang.reflect.Proxy.isProxyClass(m.getClass())); + assertEquals(1,l.size()); + m.setField("crap"); + m = (MockModel)l.get(0); + assertEquals("crap",m.getField()); + } + + public void testAddItemAtPos() + { + ListModel l = new ListModel(MockModel.class); + l.newListItem(); + MockModel m = (MockModel)l.newListItem(0); + assertEquals(2,l.size()); + m.setField("crap"); + m = (MockModel)l.get(0); + assertEquals("crap",m.getField()); + } + + public void testRemove() + { + ListModel l = new ListModel(MockModel.class); + l.newListItem(); + MockModel m = (MockModel)l.newListItem(); + m.setField("crap"); + l.remove(0); + assertEquals(1,l.size()); + m = (MockModel)l.get(0); + assertEquals("crap",m.getField()); + } + + public void testClear() + { + ListModel l = new ListModel(MockModel.class); + l.newListItem(); + l.clear(); + assertEquals(0,l.size()); + } + } |
|
From: Dave S. <rim...@us...> - 2004-10-08 03:15:01
|
Update of /cvsroot/javaclient/javaclient/net/sf/javaclient/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11774/net/sf/javaclient/model Modified Files: ListModel.java Model.java Added Files: CallbackModel.java Log Message: Added tests for basic model handling and list handling. Now we need to handle the callbacks and updates from the List Index: Model.java =================================================================== RCS file: /cvsroot/javaclient/javaclient/net/sf/javaclient/model/Model.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Model.java 7 Oct 2004 20:41:01 -0000 1.1 --- Model.java 8 Oct 2004 03:14:45 -0000 1.2 *************** *** 3,10 **** import java.util.HashMap; import java.util.ArrayList; import java.beans.PropertyVetoException; public class Model ! implements ObjectReplication { public Model(Class aModelClass) --- 3,14 ---- import java.util.HashMap; import java.util.ArrayList; + import java.util.Iterator; import java.beans.PropertyVetoException; + import java.lang.reflect.Method; + import java.lang.reflect.InvocationHandler; + import java.lang.reflect.Proxy; public class Model ! implements ObjectReplication,InvocationHandler { public Model(Class aModelClass) *************** *** 12,43 **** modelClass = aModelClass; values = new HashMap(); ! lists = new ArrayList(); ! parent=null; } ! public void addListClass(String attribute,Model m) ! { ! m.parent = this; ! ListModel list = new ListModel(m); ! lists.add(list); ! values.put(attribute,lists); ! } ! ! public Object getValue(String attribute) { ! return(values.get(attribute)); } ! public void setValue(String attribute,Object value) { ! values.put(attribute,value); } public HashMap getChangeEvents() { } public void updateModel(HashMap changed) { } public void setServerId(Long aServerId) { --- 16,97 ---- modelClass = aModelClass; values = new HashMap(); ! changeEvent = new HashMap(); } + public Object getProxy() + { + return(Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {modelClass,ObjectReplication.class},this)); + } ! public Object invoke(Object proxy, Method method, Object[] args) ! throws Throwable ! { ! String name = method.getName(); ! if(name.startsWith("get") && args == null) ! { ! return(getProperty(name.substring(3))); ! } ! else if(name.startsWith("set") && args.length == 1) ! { ! setProperty(name.substring(3),args[0]); ! return(null); ! } ! return(null); ! } ! public Object getProperty(String property) { ! return(values.get(property)); } ! ! public void setProperty(String property,Object value) ! throws PropertyVetoException { ! Object oldVal = values.get(property); ! if(value == null && oldVal == null) ! { ! return; ! } ! if(value != null && value.equals(oldVal)) ! { ! return; ! } ! if(!isUpdate) ! { ! firePropertyVetoChange(property,oldVal,value); ! } ! values.put(property,value); ! changeEvent.put(property,value); ! firePropertyChange(property,oldVal,value); } public HashMap getChangeEvents() { + HashMap returnVal = changeEvent; + changeEvent = new HashMap(); + return(returnVal); } + public void updateModel(HashMap changed) { + isUpdate=true; + Iterator it = changed.keySet().iterator(); + while(it.hasNext()) + { + String key = (String)it.next(); + try + { + setProperty(key,changed.get(key)); + } + catch(PropertyVetoException err) + { + System.out.println("This should not happen"); + err.printStackTrace(); + } + } + changeEvent = new HashMap(); + isUpdate=false; } + + public void setServerId(Long aServerId) { *************** *** 56,71 **** clientId=aClientId; } - // new<Attibute>Item() - // new<Attibute>Item(int pos) - // delete<Attribute>Item(int pos) - // clear<Attribute>Item() - // size<Attribute>Item() - // get<Attribute>Item(int pos) ! private HashMap values; private Class modelClass; - private Model parent; - private ArrayList lists; private Long serverId,clientId; } --- 110,121 ---- clientId=aClientId; } ! public void firePropertyVetoChange(String property,Object oldVal,Object newVal) throws PropertyVetoException {} ! public void firePropertyChange(String property,Object oldVal,Object newVal) {} ! ! private HashMap values,changeEvent; private Class modelClass; private Long serverId,clientId; + private boolean isUpdate=false; } --- NEW FILE: CallbackModel.java --- package net.sf.javaclient.model; import java.lang.reflect.Method; import java.lang.reflect.InvocationTargetException; import java.beans.PropertyVetoException; import java.util.HashMap; import java.util.ArrayList; import java.util.Iterator; public class CallbackModel extends Model { public CallbackModel(Class aModelClass) { super(aModelClass); changeListeners = new HashMap(); vetoableChangeListeners = new HashMap(); } public void addPropertyChangeListener(String property,Object target,Method method) { ArrayList l = (ArrayList)changeListeners.get(property); if(l == null) { l = new ArrayList(); changeListeners.put(property,l); } l.add(new ListenEvent(method,target)); } public void addVetoableChangeListener(String property,Object target,Method method) { ArrayList l = (ArrayList)vetoableChangeListeners.get(property); if(l == null) { l = new ArrayList(); vetoableChangeListeners.put(property,l); } l.add(new ListenEvent(method,target)); } public void firePropertyVetoChange(String property,Object oldVal,Object newVal) throws PropertyVetoException { ArrayList l = (ArrayList)vetoableChangeListeners.get(property); if(l == null) { return; } Iterator it = l.iterator(); while(it.hasNext()) { ((ListenEvent)it.next()).invoke(oldVal,newVal); } } public void firePropertyChange(String property,Object oldVal,Object newVal) { ArrayList l = (ArrayList)changeListeners.get(property); if(l == null) { return; } try { Iterator it = l.iterator(); while(it.hasNext()) { ((ListenEvent)it.next()).invoke(oldVal,newVal); } } catch(Exception e) { e.printStackTrace(); } } private static class ListenEvent { public ListenEvent(Method aMethod,Object aTarget) { method = aMethod; target = aTarget; } public void invoke(Object oldVal,Object newVal) throws PropertyVetoException { try { method.invoke(target,new Object[] {oldVal,newVal}); } catch(InvocationTargetException e) { if(e.getTargetException() instanceof PropertyVetoException) { throw (PropertyVetoException)e.getTargetException(); } e.printStackTrace(); } catch(Exception err) { err.printStackTrace(); } } private Method method; private Object target; } private HashMap changeListeners,vetoableChangeListeners; } Index: ListModel.java =================================================================== RCS file: /cvsroot/javaclient/javaclient/net/sf/javaclient/model/ListModel.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ListModel.java 7 Oct 2004 20:41:00 -0000 1.1 --- ListModel.java 8 Oct 2004 03:14:45 -0000 1.2 *************** *** 1,33 **** package net.sf.javaclient.model; public class ListModel { ! public ListModel(Model aListType) { } public Object newListItem() { ! return(null); } public Object newListItem(int pos) { ! return(null); } ! public void delete(int pos) { } public void clear() { } public int size() { ! return(0); } public Object get(int pos) { ! return(null); } ! // needs to note changes ! // new Model needs to know parent } --- 1,43 ---- package net.sf.javaclient.model; + import java.util.ArrayList; + public class ListModel { ! public ListModel(Class aListClass) { + list = new ArrayList(); + listClass = aListClass; } public Object newListItem() { ! return(newListItem(list.size())); } public Object newListItem(int pos) { ! Object o = (new Model(listClass)).getProxy(); ! list.add(pos,o); ! return(o); } ! public void remove(int pos) { + list.remove(pos); } public void clear() { + list.clear(); } public int size() { ! return(list.size()); } public Object get(int pos) { ! return(list.get(pos)); } ! ! private ArrayList list; ! private Class listClass; } + |
|
From: Dave S. <rim...@us...> - 2004-10-08 03:15:01
|
Update of /cvsroot/javaclient/javaclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11774 Modified Files: build.xml Log Message: Added tests for basic model handling and list handling. Now we need to handle the callbacks and updates from the List Index: build.xml =================================================================== RCS file: /cvsroot/javaclient/javaclient/build.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** build.xml 7 Oct 2004 15:23:18 -0000 1.4 --- build.xml 8 Oct 2004 03:14:45 -0000 1.5 *************** *** 32,35 **** --- 32,36 ---- <include name="net/sourceforge/javaclient/client/**"/> <include name="net/sourceforge/javaclient/model/**"/> + <include name="net/sf/javaclient/model/**"/> </javac> </target> *************** *** 83,87 **** </target> ! <target name="test-proxy" depends="test-proxy-compile"> <junit printsummary="yes" haltonfailure="no" haltonerror="no" fork="yes"> <classpath> --- 84,94 ---- </target> ! <target name="test-model" depends="test-model-compile"> ! <condition property="testmodel" value="tests.model.ModelSuite"> ! <not> ! <isset property="testmodel"/> ! </not> ! </condition> ! <junit printsummary="yes" haltonfailure="no" haltonerror="no" fork="yes"> <classpath> *************** *** 92,96 **** <formatter type="plain" usefile="false"/> ! <test name="test.javaclient.client.proxy.TestModelProxy" outfile="result-proxy"> <formatter type="xml"/> </test> --- 99,103 ---- <formatter type="plain" usefile="false"/> ! <test name="${testmodel}" outfile="result-model"> <formatter type="xml"/> </test> *************** *** 99,107 **** </target> ! <target name="test-proxy-compile" depends="init"> <javac srcdir="${basedir}" destdir="${build.test}" classpath="${build.client}:${junit.jar}"> ! <include name="test/javaclient/client/proxy/**"/> </javac> </target> --- 106,114 ---- </target> ! <target name="test-model-compile" depends="client-compile"> <javac srcdir="${basedir}" destdir="${build.test}" classpath="${build.client}:${junit.jar}"> ! <include name="tests/model/**"/> </javac> </target> |