Initial commit from SVN.

This commit is contained in:
wcrisman
2014-05-30 10:31:51 -07:00
commit b45e56b890
1968 changed files with 370949 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="src"/>
<classpathentry combineaccessrules="false" kind="src" path="/Application Foundation"/>
<classpathentry combineaccessrules="false" kind="src" path="/SWT"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Foundation Multi User Test Application</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.declarativeengineering.jetson.vmlBuilderId</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.declarativeengineering.jetson.resourceBuilderId</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.declarativeengineering.jetson.htmlBuilderId</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>com.declarativeengineering.jetson.jefNatureId</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1 @@
Place your client accessable jars here.

View File

@@ -0,0 +1 @@
"./JRE_1.6.0_05/bin/java.exe" -Dabv=0.6.0 -Dgenerate.proxies=false -cp ./"DE Foundation TCV SWT Client.jar";./swt.jar;./JRE_1.6.0_05/lib/rt.jar com.foundation.tcv.swt.client.application.ThinSwtClientApplication Unlicensed.SampleApplication stinker:9110 stinker:9111 1.0

View File

@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<!--
<repository name='MYSQL' class='com.foundation.transaction.jdbc.mysql.MySQLRepositoryManager'>
<properties user-name='my_user_name' user-password='my_password' database-url='jdbc:mysql://localhost/my_database'/>
<class class-name=';'package;base'.model.User' repository-name='USER'>
<attribute attribute-name='id' repository-name='ID' repository-type='INTEGER' is-key='true' is-auto-generated='true'/>
<attribute attribute-name='name' attribute-type='String' repository-name='NAME' repository-type='VARCHAR'/>
<attribute attribute-name='password' attribute-type='String' repository-name='PASSWORD' repository-type='BLOB'/>
<properties/>
</class>
</repository>
-->

View File

@@ -0,0 +1,3 @@
Method #0 = com.foundation.attribute.IReflectUpdateHandler.update(long;com.foundation.attribute.AbstractReflectData;int;long;
Method #1 = com.foundation.attribute.IReflectUpdateHandler.joinReflections(long;long;int;int;
Method #2 = com.foundation.attribute.IReflectUpdateHandler.getNextProcessId

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
"./JRE_1.6.0_05/bin/java.exe" -Xmx1000M -Dserver.address=stinker:9110 -Dgenerate.proxies="false" -cp "./Multi User Test Application.jar";"./DE Application Foundation.jar";./swt.jar;./JRE_1.6.0_05/lib/rt.jar com.de22.test.multiuser.application.TestMultiUserApplication

View File

@@ -0,0 +1,169 @@
package com.de22.test.multiuser.application;
import java.io.File;
import com.common.debug.*;
import com.common.orb.Orb;
import com.common.thread.*;
import com.common.util.*;
import com.de22.orb.Address;
import com.de22.orb.optional.*;
import com.foundation.util.*;
import com.foundation.view.*;
import com.foundation.controller.*;
import com.foundation.application.Application;
import com.foundation.tcv.controller.IThinServerController;
import com.foundation.tcv.server.controller.ApplicationBrowserService;
import com.foundation.tcv.server.controller.IInitialViewFactory;
import com.foundation.view.resource.ResourceService;
import com.foundation.view.swt.SwtViewContext;
/**
* Simple test application that allows multiple users to type in two numbers that cannot be equal.
* This app shows off what happens when two people try to modify the same data at the same time.
*/
public class TestMultiUserApplication extends Application {
/** The property name that determines whether we generate proxies. This should only be true during development. */
private static final String PROPERTY_GENERATE_PROXIES = "generate.proxies";
/** The property name that gives us the ip:port for starting the server socket listener. */
private static final String PROPERTY_SERVER_ADDRESS = "server.address";
private static final String SERVER_SOCKET_NAME = "testApplicationServerSocket";
private static final Object THIN_VIEW_PERMISSION = new Object();
private static final String APPLICATION_NAME = "Unlicensed.SampleApplication";
private static final TestMultiUserApplication singleton = new TestMultiUserApplication();
/**
* Starts the Foundation Multi User Test Application application.
* @param args None expected.
*/
public static void main(String[] args) {
getSingleton().startup();
getSingleton().waitForShutdown();
}//main()//
/**
* Gets the one and only instance of the application.
* @return The singleton instance.
*/
public static TestMultiUserApplication getSingleton() {
return singleton;
}//getSingleton()//
/**
* TestMultiUserApplication constructor.
*/
public TestMultiUserApplication() {
super();
}//TestMultiUserApplication()//
/* (non-Javadoc)
* @see com.foundation.application.Application#getDefaultRepositoryIdentifier()
*/
public Object getDefaultRepositoryIdentifier() {
return null;
}//getDefaultRepositoryIdentifier()//
/* (non-Javadoc)
* @see com.foundation.application.Application#getMetadataLocation()
*/
public Object getMetadataLocation() {
return "metadata.xml";
}//getMetadataLocation()//
/* (non-Javadoc)
* @see com.foundation.application.Application#initializeResources(com.foundation.view.resource.ResourceService)
*/
protected void initializeResources(ResourceService resourceService) {
}//initializeResources()//
/* (non-Javadoc)
* @see com.foundation.application.Application#internalShutdown()
*/
protected void internalShutdown() {
try {
Orb.closeServerSocket(SERVER_SOCKET_NAME);
}//try//
catch(Throwable e) {
Debug.log(e);
}//catch//
SwtViewContext.getSingleton().shutdown();
Scheduler.shutdown();
ActiveScheduler.getSingleton().shutdown();
super.internalShutdown();
}//internalShutdown()//
/* (non-Javadoc)
* @see com.foundation.application.Application#startup()
*/
protected void startup() {
String generateProxiesProperty = System.getProperty(PROPERTY_GENERATE_PROXIES);
boolean generateProxies = (generateProxiesProperty != null) && ((generateProxiesProperty.equals("yes")) || (generateProxiesProperty.equals("on")) || (generateProxiesProperty.equals("true")));
//Setup the debug log.//
Debug.setLog(new DefaultLog());
//Setup the metadata service.//
setupMetadataService();
//Setup the resource server.//
setupResourceService();
//Setup the ORB.//
Orb.setOrbWrapper(new com.de22.orb.optional.CommonOrbWrapper(generateProxies ? new com.de22.orb.development.OrbClassLoader(".\\proxies\\") : null, null, null));
try {
//Start the application specific code.//
startApplication();
}//try//
catch(Throwable e) {
//Log all errors that are not caught earlier in the program.//
Debug.log(e);
}//catch//
}//startup()//
/**
* Starts the actual application.
*/
private void startApplication() {
try {
LiteHashSet permissionSet = new LiteHashSet(1);
Address tcvServerAddress;
if(System.getProperty(PROPERTY_SERVER_ADDRESS) == null) {
throw new IllegalArgumentException("Must provide a property named " + PROPERTY_SERVER_ADDRESS);
}//if//
else {
tcvServerAddress = new Address(System.getProperty(PROPERTY_SERVER_ADDRESS));
}//else//
Debug.log("Starting the remote view server on " + tcvServerAddress);
//Create the set of permissions.//
permissionSet.add(THIN_VIEW_PERMISSION);
if(Orb.openServerSocket(SERVER_SOCKET_NAME, new ServerSocketOptions(tcvServerAddress, tcvServerAddress, new SocketOptions(), null, 0, 0, null)) != null) {
ManagedList serverAddresses = new ManagedList();
ManagedList downloadAddresses = new ManagedList();
ApplicationBrowserService service = new ApplicationBrowserService(this);
serverAddresses.add(tcvServerAddress.toString());
//Create the thin view controller.//
service.registerApplication(APPLICATION_NAME, new IInitialViewFactory() {
public RemoteViewController createInitialView(final IViewContext viewContext) {
return new com.de22.test.multiuser.remote.view.controller.MainViewController(viewContext);
}//createInitialView()//
}, "0.6.0", "1.0", null, null, downloadAddresses, serverAddresses, new File("./Client Libraries"));
//Bind the controller to the server socket.//
Orb.bind(Orb.getProxy(service, IThinServerController.class), IThinServerController.BOUND_NAME, null);
}//if//
else {
Debug.log("Could not create a server socket on the specified ip:port");
}//else//
}//try//
catch(Throwable e) {
Debug.log(e, "Unable to open the view service.");
}//catch//
try {
Debug.log("Type a character to exit the application.");
System.in.read();
}//try//
catch(Throwable e) {
Debug.log(e);
}//catch//
System.exit(0);
}//startApplication()//
}//TestMultiUserApplication//

View File

@@ -0,0 +1,23 @@
package com.de22.test.multiuser.model;
import com.foundation.application.*;
import com.de22.test.multiuser.application.*;
/**
*
*/
public abstract class AbstractModel extends com.foundation.model.Model {
/**
* AbstractModel constructor.
*/
public AbstractModel() {
super();
}//AbstractModel()//
/**
* Gets the application object that this object is running under. The application object provides the object various services that it will need.
* @return The application reference for the application this object is running under.
*/
public IApplication getApplication() {
return TestMultiUserApplication.getSingleton();
}//getApplication()//
}//AbstractModel//

View File

@@ -0,0 +1,44 @@
package com.de22.test.multiuser.model;
import com.foundation.metadata.Attribute;
/**
* Copyright Declarative Engineering LLC 2008<p>
*/
public class Data extends AbstractModel {
public static final Attribute NUMBER_1 = registerAttribute(Data.class, "number1", new Integer(1));
public static final Attribute NUMBER_2 = registerAttribute(Data.class, "number2", new Integer(2));
/**
* Data constructor.
*/
public Data() {
}//Data()//
/**
* Gets the number1 value.
* @return The number1 value.
*/
public Integer getNumber1() {
return (Integer) getAttributeValue(NUMBER_1);
}//getNumber1()//
/**
* Sets the number1 value.
* @param number1 The number1 value.
*/
public void setNumber1(Integer number1) {
setAttributeValue(NUMBER_1, number1);
}//setNumber1()//
/**
* Gets the number2 value.
* @return The number2 value.
*/
public Integer getNumber2() {
return (Integer) getAttributeValue(NUMBER_2);
}//getNumber2()//
/**
* Sets the number2 value.
* @param number2 The number2 value.
*/
public void setNumber2(Integer number2) {
setAttributeValue(NUMBER_2, number2);
}//setNumber2()//
}//Data//

View File

@@ -0,0 +1,23 @@
package com.de22.test.multiuser.model.controller;
import com.foundation.application.*;
import com.de22.test.multiuser.application.*;
/**
*
*/
public abstract class AbstractController extends com.foundation.controller.Controller {
/**
* AbstractController constructor.
*/
public AbstractController() {
super();
}//AbstractController()//
/**
* Gets the application object that this object is running under. The application object provides the object various services that it will need.
* @return The application reference for the application this object is running under.
*/
public IApplication getApplication() {
return TestMultiUserApplication.getSingleton();
}//getApplication()//
}//AbstractController//

View File

@@ -0,0 +1,35 @@
package com.de22.test.multiuser.model.controller;
import com.de22.test.multiuser.model.*;
import com.foundation.metadata.Attribute;
/**
* Copyright Declarative Engineering LLC 2008<p>
* A simple controller that allows multiple client's access to a single data object.
*/
public class DataController extends AbstractController {
private static final Attribute DATA = registerAttribute(DataController.class, "data");
/** The only instance of this controller. */
private static final DataController singleton = new DataController();
/**
* Gets the one and only instance of this class.
* @return The only instance of this controller.
*/
public static DataController getSingleton() {
return singleton;
}//getSingleton()//
/**
* DataController constructor.
*/
public DataController() {
setAttributeValue(DATA, new Data());
}//DataController()//
/**
* Gets the data object that is shared by all users.
* @return The shared data object.
*/
public Data getData() {
return (Data) getAttributeValue(DATA);
}//getData()//
}//DataController//

View File

@@ -0,0 +1,376 @@
package com.de22.test.multiuser.remote.view;
/**
* MainView
*/
public class MainView extends com.foundation.tcv.swt.server.Window implements com.foundation.view.IAssociationHandler {
//Component Names//
public static final String CONTROLLER_HOLDER_COMPONENT = "controllerHolder";
public static final String DATA_HOLDER_COMPONENT = "dataHolder";
public static final String MAIN_COMPONENT = "main";
public static final String NUMBER1_TEXT_COMPONENT = "number1Text";
public static final String NUMBER2_TEXT_COMPONENT = "number2Text";
public static final String APPLY_BUTTON_COMPONENT = "applyButton";
public static final String CANCEL_BUTTON_COMPONENT = "cancelButton";
public static final String MAIN_VIEW_COMPONENT = "MainView";
//Association Identifiers//
protected static final int DATA_HOLDER_ASSOCIATION_PARENT_ASSOCIATION_0 = 0;
protected static final int NUMBER1_TEXT_FORMAT_FORMAT_ASSOCIATION_VALUE_ASSOCIATION_0 = 1;
protected static final int NUMBER2_TEXT_FORMAT_FORMAT_ASSOCIATION_VALUE_ASSOCIATION_0 = 2;
//Method Association Identifiers//
protected static final int THIS_CLOSED_METHOD_ASSOCIATION = 0;
protected static final int APPLY_BUTTON_SELECTION_METHOD_ASSOCIATION = 1;
protected static final int CANCEL_BUTTON_SELECTION_METHOD_ASSOCIATION = 2;
//View Components//
private com.foundation.tcv.swt.server.ValueHolder controllerHolder = null;
private com.foundation.tcv.swt.server.ValueHolder dataHolder = null;
private com.foundation.tcv.swt.server.Panel main = null;
private com.foundation.tcv.swt.server.Label unnamedComponent0 = null;
private com.foundation.tcv.swt.server.TextField number1Text = null;
private com.foundation.tcv.swt.server.Label unnamedComponent1 = null;
private com.foundation.tcv.swt.server.TextField number2Text = null;
private com.foundation.tcv.swt.server.Button applyButton = null;
private com.foundation.tcv.swt.server.Button cancelButton = null;
/**
* MainView default constructor.
* <p>Warning: This constructor is intended for use by the metadata service <b>only</b>. This constructor should <b>never</b> be called by the view's controller.</p>
*/
public MainView() {
}//MainView()//
/**
* MainView non-modal constructor.
* @param controller The view's view controller reference.
*/
public MainView(com.foundation.controller.RemoteViewController controller) {
super((controller.getParent() != null ? ((com.foundation.tcv.swt.server.Component) (((com.foundation.controller.RemoteViewController) controller.getParent()).getView())).getContainingWindow() : null), (com.foundation.tcv.server.controller.SessionViewController) controller.getRemoteViewContext(), MAIN_VIEW_COMPONENT, com.foundation.tcv.swt.server.Window.STYLE_SHELL_TRIM, controller);
}//MainView()//
public void initializeControllerHolder(com.foundation.tcv.swt.server.Container parent) {
controllerHolder = new com.foundation.tcv.swt.server.ValueHolder(parent, CONTROLLER_HOLDER_COMPONENT, com.de22.test.multiuser.remote.view.controller.MainViewController.class);
}//initializeControllerHolder()//
public void initializeDataHolder(com.foundation.tcv.swt.server.Container parent) {
dataHolder = new com.foundation.tcv.swt.server.ValueHolder(parent, DATA_HOLDER_COMPONENT, com.de22.test.multiuser.model.Data.class);
dataHolder.setParentAssociation(new com.foundation.view.SingleAssociationContainer("controllerHolder", new com.foundation.view.SingleAssociation[] {new com.foundation.view.SingleAssociation(com.de22.test.multiuser.remote.view.controller.MainViewController.class, DATA_HOLDER_ASSOCIATION_PARENT_ASSOCIATION_0, this, false, null, null, new com.foundation.view.EventAssociation[] {new com.foundation.view.EventAssociation(null, null, null, com.de22.test.multiuser.remote.view.controller.MainViewController.class, com.de22.test.multiuser.remote.view.controller.MainViewController.DATA)}, null,true)}));
}//initializeDataHolder()//
public void initializeUnnamedComponent0(com.foundation.tcv.swt.server.Container parent) {
unnamedComponent0 = new com.foundation.tcv.swt.server.Label(parent, null, 0);
unnamedComponent0.setText("First Number: (not auto-synchronizing)");
}//initializeUnnamedComponent0()//
public void initializeNumber1Text(com.foundation.tcv.swt.server.Container parent) {
number1Text = new com.foundation.tcv.swt.server.TextField(parent, NUMBER1_TEXT_COMPONENT, com.foundation.tcv.swt.server.TextField.STYLE_BORDER);
com.foundation.tcv.swt.server.TextField.IntegerFormat number1TextFormat = (com.foundation.tcv.swt.server.TextField.IntegerFormat) number1Text.initializeFormat(com.foundation.tcv.swt.server.TextField.IntegerFormat.class);
number1TextFormat.setValueAssociation(new com.foundation.view.SingleAssociationContainer("dataHolder", new com.foundation.view.SingleAssociation[] {new com.foundation.view.SingleAssociation(com.de22.test.multiuser.model.Data.class, NUMBER1_TEXT_FORMAT_FORMAT_ASSOCIATION_VALUE_ASSOCIATION_0, this, false, null, null, new com.foundation.view.EventAssociation[] {new com.foundation.view.EventAssociation(null, null, null, com.de22.test.multiuser.model.Data.class, com.de22.test.multiuser.model.Data.NUMBER_1)}, null,true,com.de22.test.multiuser.model.Data.NUMBER_1)}));
number1Text.setAutoSynchronizeValue(false);
number1Text.setAutoValidate(false);
}//initializeNumber1Text()//
public void initializeUnnamedComponent1(com.foundation.tcv.swt.server.Container parent) {
unnamedComponent1 = new com.foundation.tcv.swt.server.Label(parent, null, 0);
unnamedComponent1.setText("Second Number: (auto-synchronizing)");
}//initializeUnnamedComponent1()//
public void initializeNumber2Text(com.foundation.tcv.swt.server.Container parent) {
number2Text = new com.foundation.tcv.swt.server.TextField(parent, NUMBER2_TEXT_COMPONENT, com.foundation.tcv.swt.server.TextField.STYLE_BORDER);
com.foundation.tcv.swt.server.TextField.IntegerFormat number2TextFormat = (com.foundation.tcv.swt.server.TextField.IntegerFormat) number2Text.initializeFormat(com.foundation.tcv.swt.server.TextField.IntegerFormat.class);
number2TextFormat.setValueAssociation(new com.foundation.view.SingleAssociationContainer("dataHolder", new com.foundation.view.SingleAssociation[] {new com.foundation.view.SingleAssociation(com.de22.test.multiuser.model.Data.class, NUMBER2_TEXT_FORMAT_FORMAT_ASSOCIATION_VALUE_ASSOCIATION_0, this, false, null, null, new com.foundation.view.EventAssociation[] {new com.foundation.view.EventAssociation(null, null, null, com.de22.test.multiuser.model.Data.class, com.de22.test.multiuser.model.Data.NUMBER_2)}, null,true,com.de22.test.multiuser.model.Data.NUMBER_2)}));
number2Text.setAutoSynchronizeValue(true);
number2Text.setAutoValidate(true);
}//initializeNumber2Text()//
public void initializeMain(com.foundation.tcv.swt.server.Container parent) {
main = new com.foundation.tcv.swt.server.Panel(parent, MAIN_COMPONENT, 0);
initializeUnnamedComponent0(main);
initializeNumber1Text(main);
initializeUnnamedComponent1(main);
initializeNumber2Text(main);
com.foundation.tcv.swt.server.GridLayout layout = new com.foundation.tcv.swt.server.GridLayout(main);
layout.setNumColumns(1);
layout.setMarginHeight(3);
layout.setMarginWidth(3);
main.setLayout(layout);
main.setTabOrder(new com.common.util.LiteList(new Object[] {number1Text, number2Text}));
}//initializeMain()//
public void initializeApplyButton(com.foundation.tcv.swt.server.Container parent) {
applyButton = new com.foundation.tcv.swt.server.Button(parent, APPLY_BUTTON_COMPONENT, 0);
applyButton.setText("Apply");
applyButton.setSelectionMethod(new com.foundation.view.MethodAssociation(this, APPLY_BUTTON_SELECTION_METHOD_ASSOCIATION, applyButton, "controllerHolder", null, null));
}//initializeApplyButton()//
public void initializeCancelButton(com.foundation.tcv.swt.server.Container parent) {
cancelButton = new com.foundation.tcv.swt.server.Button(parent, CANCEL_BUTTON_COMPONENT, 0);
cancelButton.setText("Cancel");
cancelButton.setSelectionMethod(new com.foundation.view.MethodAssociation(this, CANCEL_BUTTON_SELECTION_METHOD_ASSOCIATION, cancelButton, "controllerHolder", null, null));
}//initializeCancelButton()//
/* (non-Javadoc)
* @see com.foundation.view.IView#internalViewInitialize()
*/
public void internalViewInitialize() {
this.setClosedMethod(new com.foundation.view.MethodAssociation(this, THIS_CLOSED_METHOD_ASSOCIATION, this, "controllerHolder", null, null));
initializeControllerHolder(this);
initializeDataHolder(this);
initializeMain(this);
initializeApplyButton(this);
initializeCancelButton(this);
com.foundation.tcv.swt.server.GridLayout layout = new com.foundation.tcv.swt.server.GridLayout(this);
layout.setNumColumns(2);
layout.setMarginHeight(3);
layout.setMarginWidth(3);
this.setLayout(layout);
this.setTabOrder(new com.common.util.LiteList(new Object[] {main}));
this.setDefaultChangeText("Another user has changed\n the underlying data.");
this.setDefaultChangeImage(new com.foundation.view.resource.ResourceReference("res://Application/General/WarningImage"));
this.setDefaultUpdateText("The value has changed in the model.");
this.setDefaultUpdateImage(new com.foundation.view.resource.ResourceReference("res://Application/General/InformationImage"));
this.setDefaultUpdateTimeout(new Integer(8000));
this.setDefaultContainerTitle("Main");
this.setDefaultContainerImage(new com.foundation.view.resource.ResourceReference("res://Application/General/WarningImage"));
layoutComponents();
super.internalViewInitialize();
setupLinkages();
}//internalViewInitialize()//
/* (non-Javadoc)
* @see com.foundation.view.IAssociationHandler#invokeGetMethod(int, Object)
*/
public Object invokeGetMethod(int associationNumber, Object value) {
Object retVal = null;
switch(associationNumber) {
default:
com.common.debug.Debug.log("Attribute association broken.");
break;
}//switch//
return retVal;
}//invokeGetMethod()//
/* (non-Javadoc)
* @see com.foundation.view.IAssociationHandler#invokeSetMethod(int, Object, Object)
*/
public void invokeSetMethod(int associationNumber, Object value, Object parameter) {
switch(associationNumber) {
default:
com.common.debug.Debug.log("Attribute association broken.");
break;
}//switch//
}//invokeSetMethod()//
/* (non-Javadoc)
* @see com.foundation.view.IAssociationHandler#invokeMethod(int, Object, Object[])
*/
public Object invokeMethod(int associationNumber, Object value, Object[] parameters) {
Object retVal = null;
switch(associationNumber) {
case THIS_CLOSED_METHOD_ASSOCIATION:
((com.de22.test.multiuser.remote.view.controller.MainViewController) value).doClose();
break;
case APPLY_BUTTON_SELECTION_METHOD_ASSOCIATION:
((com.de22.test.multiuser.remote.view.controller.MainViewController) value).doApply();
break;
case CANCEL_BUTTON_SELECTION_METHOD_ASSOCIATION:
((com.de22.test.multiuser.remote.view.controller.MainViewController) value).doCancel();
break;
default:
com.common.debug.Debug.log("Method association broken.");
break;
}//switch//
return retVal;
}//invokeMethod()//
/* (non-Javadoc)
* @see com.foundation.view.IAssociationHandler#invokeMethod(int, Object, Object[], byte)
*/
public Object invokeMethod(int associationNumber, Object value, Object[] parameters, byte flags) {
Object result = null;
if(flags == INVOKE_GETTER_METHOD_FLAG) {
switch(associationNumber) {
case DATA_HOLDER_ASSOCIATION_PARENT_ASSOCIATION_0:
result = ((com.de22.test.multiuser.remote.view.controller.MainViewController) value).getData();
break;
case NUMBER1_TEXT_FORMAT_FORMAT_ASSOCIATION_VALUE_ASSOCIATION_0:
result = ((com.de22.test.multiuser.model.Data) value).getNumber1();
break;
case NUMBER2_TEXT_FORMAT_FORMAT_ASSOCIATION_VALUE_ASSOCIATION_0:
result = ((com.de22.test.multiuser.model.Data) value).getNumber2();
break;
default:
com.common.debug.Debug.log("Association (getter) broken.");
break;
}//switch//
}//if//
else if(flags == INVOKE_ORIGINAL_VALUE_GETTER_METHOD_FLAG) {
switch(associationNumber) {
case DATA_HOLDER_ASSOCIATION_PARENT_ASSOCIATION_0:
result = ((com.de22.test.multiuser.remote.view.controller.MainViewController) value).getOldAttributeValue(com.de22.test.multiuser.remote.view.controller.MainViewController.DATA);
break;
case NUMBER1_TEXT_FORMAT_FORMAT_ASSOCIATION_VALUE_ASSOCIATION_0:
result = ((com.de22.test.multiuser.model.Data) value).getOldAttributeValue(com.de22.test.multiuser.model.Data.NUMBER_1);
break;
case NUMBER2_TEXT_FORMAT_FORMAT_ASSOCIATION_VALUE_ASSOCIATION_0:
result = ((com.de22.test.multiuser.model.Data) value).getOldAttributeValue(com.de22.test.multiuser.model.Data.NUMBER_2);
break;
default:
com.common.debug.Debug.log("Association (original value getter) broken.");
break;
}//switch//
}//if//
else {
switch(associationNumber) {
case NUMBER1_TEXT_FORMAT_FORMAT_ASSOCIATION_VALUE_ASSOCIATION_0:
((com.de22.test.multiuser.model.Data) value).setNumber1((java.lang.Integer) parameters[0]);
break;
case NUMBER2_TEXT_FORMAT_FORMAT_ASSOCIATION_VALUE_ASSOCIATION_0:
((com.de22.test.multiuser.model.Data) value).setNumber2((java.lang.Integer) parameters[0]);
break;
default:
com.common.debug.Debug.log("Association (setter) broken.");
break;
}//switch//
}//else//
return result;
}//invokeMethod()//
/**
* Lays out the components.
*/
public void layoutComponents() {
{ //main//
com.foundation.tcv.swt.GridLayoutData layoutData = new com.foundation.tcv.swt.GridLayoutData();
layoutData.verticalAlignment = com.foundation.tcv.swt.GridLayoutData.FILL;
layoutData.horizontalAlignment = com.foundation.tcv.swt.GridLayoutData.FILL;
layoutData.horizontalSpan = 2;
layoutData.grabExcessHorizontalSpace = true;
layoutData.grabExcessVerticalSpace = true;
main.setLayoutData(layoutData);
}//block//
{ //null//
com.foundation.tcv.swt.GridLayoutData layoutData = new com.foundation.tcv.swt.GridLayoutData();
layoutData.horizontalAlignment = com.foundation.tcv.swt.GridLayoutData.FILL;
layoutData.grabExcessHorizontalSpace = true;
unnamedComponent0.setLayoutData(layoutData);
}//block//
{ //number1Text//
com.foundation.tcv.swt.GridLayoutData layoutData = new com.foundation.tcv.swt.GridLayoutData();
layoutData.horizontalAlignment = com.foundation.tcv.swt.GridLayoutData.FILL;
layoutData.grabExcessHorizontalSpace = true;
number1Text.setLayoutData(layoutData);
}//block//
{ //null//
com.foundation.tcv.swt.GridLayoutData layoutData = new com.foundation.tcv.swt.GridLayoutData();
layoutData.horizontalAlignment = com.foundation.tcv.swt.GridLayoutData.FILL;
layoutData.grabExcessHorizontalSpace = true;
unnamedComponent1.setLayoutData(layoutData);
}//block//
{ //number2Text//
com.foundation.tcv.swt.GridLayoutData layoutData = new com.foundation.tcv.swt.GridLayoutData();
layoutData.horizontalAlignment = com.foundation.tcv.swt.GridLayoutData.FILL;
layoutData.grabExcessHorizontalSpace = true;
number2Text.setLayoutData(layoutData);
}//block//
{ //applyButton//
com.foundation.tcv.swt.GridLayoutData layoutData = new com.foundation.tcv.swt.GridLayoutData();
layoutData.horizontalAlignment = com.foundation.tcv.swt.GridLayoutData.CENTER;
layoutData.grabExcessHorizontalSpace = true;
applyButton.setLayoutData(layoutData);
}//block//
{ //cancelButton//
com.foundation.tcv.swt.GridLayoutData layoutData = new com.foundation.tcv.swt.GridLayoutData();
layoutData.horizontalAlignment = com.foundation.tcv.swt.GridLayoutData.CENTER;
layoutData.grabExcessHorizontalSpace = true;
cancelButton.setLayoutData(layoutData);
}//block//
}//layoutComponents()//
/**
* Initializes the direct linkages between the components.
*/
public void setupLinkages() {
}//setupLinkages()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.tcv.swt.server.ValueHolder getVpControllerHolder() {
return controllerHolder;
}//getVpControllerHolder()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.tcv.swt.server.ValueHolder getVpDataHolder() {
return dataHolder;
}//getVpDataHolder()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.tcv.swt.server.Panel getVpMain() {
return main;
}//getVpMain()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.tcv.swt.server.Label getVpUnnamedComponent0() {
return unnamedComponent0;
}//getVpUnnamedComponent0()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.tcv.swt.server.TextField getVpNumber1Text() {
return number1Text;
}//getVpNumber1Text()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.tcv.swt.server.Label getVpUnnamedComponent1() {
return unnamedComponent1;
}//getVpUnnamedComponent1()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.tcv.swt.server.TextField getVpNumber2Text() {
return number2Text;
}//getVpNumber2Text()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.tcv.swt.server.Button getVpApplyButton() {
return applyButton;
}//getVpApplyButton()//
/**
* Gets the view component.
* <p>Warning: This accessor to allow for the very rare and highly discouraged derived view class.</p>
* @return The view component.
*/
protected com.foundation.tcv.swt.server.Button getVpCancelButton() {
return cancelButton;
}//getVpCancelButton()//
}//MainView//

View File

@@ -0,0 +1,48 @@
<?xml version="1.0"?>
<vml>
<metadata>
<platform name="thin:swt"/>
</metadata>
<window name="MainView" style="window trim" container-image="res://Application/General/WarningImage" container-title="Main" change-image="res://Application/General/WarningImage" change-text="Another user has changed\\n the underlying data." update-image="res://Application/General/InformationImage" update-text="The value has changed in the model." update-timeout="8000">
<grid-layout margin-height="3" margin-width="3" column-count="2"/>
<method function="closed" name="doClose" signature="" value-holder="controllerHolder"/>
<value-holder name="controllerHolder" type="com.de22.test.multiuser.remote.view.controller.MainViewController"/>
<value-holder name="dataHolder" type="com.de22.test.multiuser.model.Data">
<association function="parent" attribute="data" value-holder="controllerHolder"/>
</value-holder>
<panel name="main" style="" tab-order="1">
<grid-layout column-count="1" margin-height="3" margin-width="3"/>
<grid-layout-data horizontal-span="2" horizontal-fill="true" vertical-fill="true" horizontal-alignment="fill" vertical-alignment="fill"/>
<label text="First Number: (not auto-synchronizing)">
<grid-layout-data horizontal-alignment='fill' horizontal-fill='true'/>
</label>
<text name="number1Text" style='border' tab-order="1" auto-synchronize-text="false" auto-validate="false">
<grid-layout-data horizontal-alignment='fill' horizontal-fill='true'/>
<integer-format>
<association function="value" attribute="number1" value-holder="dataHolder" decorate="true"/>
</integer-format>
</text>
<label text="Second Number: (auto-synchronizing)">
<grid-layout-data horizontal-alignment='fill' horizontal-fill='true'/>
</label>
<text name="number2Text" style='border' tab-order="1" auto-synchronize-text="true" auto-validate="true">
<grid-layout-data horizontal-alignment='fill' horizontal-fill='true'/>
<integer-format>
<association function="value" attribute="number2" value-holder="dataHolder" decorate="true"/>
</integer-format>
</text>
</panel>
<button name="applyButton" style="" text="Apply">
<grid-layout-data horizontal-fill="true" horizontal-alignment="center"/>
<method function="selection" name="doApply" value-holder="controllerHolder"/>
</button>
<button name="cancelButton" style="" text="Cancel">
<grid-layout-data horizontal-fill="true" horizontal-alignment="center"/>
<method function="selection" name="doCancel" value-holder="controllerHolder"/>
</button>
</window>
</vml>

View File

@@ -0,0 +1,35 @@
package com.de22.test.multiuser.remote.view.controller;
import com.foundation.controller.RemoteViewController;
import com.foundation.view.IViewContext;
import com.foundation.application.*;
import com.foundation.attribute.ReflectionContext;
import com.de22.test.multiuser.application.*;
/**
*
*/
public abstract class AbstractViewController extends RemoteViewController {
/**
* AbstractViewController constructor.
* @param viewContext The view's context under which it will operate.
*/
public AbstractViewController(IViewContext viewContext) {
super(viewContext);
}//AbstractViewController()//
/**
* AbstractViewController constructor.
* @param viewContext The view's context under which it will operate.
* @param reflectionContext The reflection context to be used by the view.
*/
public AbstractViewController(IViewContext context, ReflectionContext reflectionContext) {
super(context, reflectionContext);
}//AbstractViewController()//
/**
* Gets the application object that this object is running under. The application object provides the object various services that it will need.
* @return The application reference for the application this object is running under.
*/
public IApplication getApplication() {
return TestMultiUserApplication.getSingleton();
}//getApplication()//
}//AbstractViewController//

View File

@@ -0,0 +1,90 @@
package com.de22.test.multiuser.remote.view.controller;
import com.foundation.view.ControlDecoration;
import com.foundation.view.IViewContext;
import com.common.comparison.Comparator;
import com.common.debug.Debug;
import com.de22.test.multiuser.model.Data;
import com.de22.test.multiuser.model.controller.DataController;
import com.de22.test.multiuser.remote.view.MainView;
import com.foundation.metadata.Attribute;
/**
* The main view.
*/
public class MainViewController extends AbstractViewController {
public static final Attribute DATA = registerAttribute(MainViewController.class, "data");
/**
* MainViewController constructor.
* @param viewContext
*/
public MainViewController(IViewContext viewContext) {
super(viewContext);
setData((Data) getReflectionManager().createReflection(DataController.getSingleton().getData()));
}//MainViewController()//
/* (non-Javadoc)
* @see com.foundation.controller.RemoteViewController#getViewClass()
*/
protected Class getViewClass() {
return MainView.class;
}//getViewClass()//
/* (non-Javadoc)
* @see com.foundation.controller.ViewController#validate()
*/
public boolean validate() {
boolean result = true;
getDecorationManager().clearDecorations(null, null);
if(Comparator.equals(getData().getNumber1(), getData().getNumber2())) {
getDecorationManager().addDecoration(getData(), Data.NUMBER_1, new ControlDecoration("res://Application/General/ErrorImage", "The two numbers cannot be the same."));
getDecorationManager().addDecoration(getData(), Data.NUMBER_2, new ControlDecoration("res://Application/General/ErrorImage", "The two numbers cannot be the same."));
result = false;
}//if//
getDecorationManager().applyDecorationChanges();
return result;
}//validate()//
/**
* Closes the main view.
*/
public void doClose() {
close();
}//doClose()//
/**
* Closes the main view.
*/
public void doApply() {
synchronize();
if(getReflectionManager().synchronizeAll()) {
Debug.log("Synchronize success.");
}//if//
else {
Debug.log("Synchronize failed.");
}//else//
}//doApply()//
/**
* Cancels any changes.
*/
public void doCancel() {
synchronize();
getData().reverseObjectChanges();
validate();
}//doCancel()//
/**
* Gets the data value.
* @return The data value.
*/
public Data getData() {
return (Data) getAttributeValue(DATA);
}//getData()//
/**
* Sets the data value.
* @param data The data value.
*/
public void setData(Data data) {
setAttributeValue(DATA, data);
}//setData()//
}//MainViewController//