Files
Brainstorm/Foundation Widget Test Application/src/test/local/view/EnhancedListPageView.java

306 lines
16 KiB
Java
Raw Normal View History

2014-05-30 10:31:51 -07:00
package test.local.view;
/**
* EnhancedListPageView
*/
public class EnhancedListPageView extends com.foundation.view.swt.Panel implements com.foundation.view.IAssociationHandler {
//Component Names//
public static final String CONTROLLER_HOLDER_COMPONENT = "controllerHolder";
public static final String SAMPLE_LIST1_LABEL_COMPONENT = "sampleList1Label";
public static final String SAMPLE_LIST1_COMPONENT = "sampleList1";
public static final String INNER_VIEW_COMPONENT = "innerView";
public static final String ENHANCED_LIST_PAGE_VIEW_COMPONENT = "EnhancedListPageView";
//Association Identifiers//
protected static final int SAMPLE_LIST1_ASSOCIATION_COLLECTION_ASSOCIATION_0 = 0;
protected static final int SAMPLE_LIST1_ASSOCIATION_SELECTION_ASSOCIATION_0 = 1;
protected static final int SAMPLE_LIST1_ASSOCIATION_DATA_0_ASSOCIATION_0 = 2;
protected static final int SAMPLE_LIST1_ASSOCIATION_ITEM_TEXT_ASSOCIATION_0 = 3;
protected static final int SAMPLE_LIST1_ASSOCIATION_ITEM_IMAGE_ASSOCIATION_0 = 4;
protected static final int INNER_VIEW_ASSOCIATION_CONTROLLER_ASSOCIATION_0 = 5;
protected static final int INNER_VIEW_ASSOCIATION_IS_VISIBLE_ASSOCIATION_0 = 6;
//Method Association Identifiers//
protected static final int UNNAMED_COMPONENT1_SELECTION_METHOD_ASSOCIATION = 0;
//View Components//
private com.foundation.view.swt.ValueHolder controllerHolder = null;
private com.foundation.view.swt.Label sampleList1Label = null;
private com.foundation.view.swt.EnhancedList sampleList1 = null;
private com.foundation.view.swt.EnhancedList.IHiddenColor sampleList1HiddenDataPart0 = null;
private com.foundation.view.swt.Menu unnamedComponent0 = null;
private com.foundation.view.swt.Menu unnamedComponent1 = null;
private com.foundation.view.swt.PanelViewer innerView = null;
/**
* EnhancedListPageView 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 EnhancedListPageView() {
}//EnhancedListPageView()//
/**
* EnhancedListPageView constructor.
* @param controller The view controller which will be assigned to the value holder(s) that don't depend on another value holder for their value.
* @param parentComponent The non-null parent view component which this frame will be contained in.
*/
public EnhancedListPageView(com.foundation.controller.ViewController controller, com.foundation.view.IView parentComponent) {
super((com.foundation.view.IAbstractContainer) parentComponent, ENHANCED_LIST_PAGE_VIEW_COMPONENT, 0);
setController(controller);
}//EnhancedListPageView()//
public void initializeControllerHolder(com.foundation.view.swt.Container parent) {
controllerHolder = new com.foundation.view.swt.ValueHolder(parent, CONTROLLER_HOLDER_COMPONENT, test.local.view.controller.EnhancedListPageViewController.class);
}//initializeControllerHolder()//
public void initializeSampleList1Label(com.foundation.view.swt.Container parent) {
sampleList1Label = new com.foundation.view.swt.Label(parent, SAMPLE_LIST1_LABEL_COMPONENT, 0);
sampleList1Label.setText("Sample list box:");
}//initializeSampleList1Label()//
public void initializeSampleList1PopupMenu(com.foundation.view.IAbstractComponent parent) {
unnamedComponent0 = new com.foundation.view.swt.Menu(sampleList1, null, com.foundation.view.swt.Menu.STYLE_POPUP);
unnamedComponent1 = new com.foundation.view.swt.Menu(unnamedComponent0, null, com.foundation.view.swt.Menu.STYLE_PUSH);
unnamedComponent1.setText("Test Menu Item");
unnamedComponent1.setSelectionMethod(new com.foundation.view.MethodAssociation(this, UNNAMED_COMPONENT1_SELECTION_METHOD_ASSOCIATION, unnamedComponent1, "controllerHolder", null, null));
}//initializeSampleList1PopupMenu()//
public void initializeSampleList1(com.foundation.view.swt.Container parent) {
sampleList1 = new com.foundation.view.swt.EnhancedList(parent, SAMPLE_LIST1_COMPONENT, com.foundation.view.swt.EnhancedList.STYLE_BORDER|com.foundation.view.swt.EnhancedList.STYLE_H_SCROLL);
sampleList1.setDecorateItems(true);
sampleList1.setAutoSynchronizeSelection(true);
sampleList1.setCollectionAssociation(new com.foundation.view.SingleAssociationContainer("controllerHolder", new com.foundation.view.SingleAssociation[] {new com.foundation.view.SingleAssociation(test.local.view.controller.EnhancedListPageViewController.class, SAMPLE_LIST1_ASSOCIATION_COLLECTION_ASSOCIATION_0, this, false, null, null, new com.foundation.view.EventAssociation[] {new com.foundation.view.EventAssociation(null, null, null, test.local.view.controller.EnhancedListPageViewController.class, test.local.view.controller.EnhancedListPageViewController.PROJECTS)}, null,true)}));
sampleList1.setSelectionAssociation(new com.foundation.view.SingleAssociationContainer("controllerHolder", new com.foundation.view.SingleAssociation[] {new com.foundation.view.SingleAssociation(test.local.view.controller.EnhancedListPageViewController.class, SAMPLE_LIST1_ASSOCIATION_SELECTION_ASSOCIATION_0, this, false, null, null, new com.foundation.view.EventAssociation[] {new com.foundation.view.EventAssociation(null, null, null, test.local.view.controller.EnhancedListPageViewController.class, test.local.view.controller.EnhancedListPageViewController.SELECTION)}, null,true)}));
sampleList1HiddenDataPart0 = sampleList1.addHiddenColor();
sampleList1HiddenDataPart0.setData(new com.foundation.view.JefColor("(255,255,0,0)"));
sampleList1HiddenDataPart0.setDataAssociation(new com.foundation.view.MultiAssociationContainer(new com.foundation.view.MultiAssociation[] {new com.foundation.view.MultiAssociation(java.lang.Object.class, SAMPLE_LIST1_ASSOCIATION_DATA_0_ASSOCIATION_0, this, false, null, null, new com.foundation.view.EventAssociation[0],"controllerHolder",true)}));
initializeSampleList1PopupMenu(sampleList1);
sampleList1.setItemTextAssociation(new com.foundation.view.MultiAssociationContainer(new com.foundation.view.MultiAssociation[] {new com.foundation.view.MultiAssociation(test.model.Project.class, SAMPLE_LIST1_ASSOCIATION_ITEM_TEXT_ASSOCIATION_0, this, false, null, null, new com.foundation.view.EventAssociation[] {new com.foundation.view.EventAssociation(null, null, null, test.model.Project.class, test.model.Project.NAME)}, null,true)}));
sampleList1.setItemImageAssociation(new com.foundation.view.MultiAssociationContainer(new com.foundation.view.MultiAssociation[] {new com.foundation.view.MultiAssociation(test.model.Project.class, SAMPLE_LIST1_ASSOCIATION_ITEM_IMAGE_ASSOCIATION_0, this, false, null, null, new com.foundation.view.EventAssociation[0],"controllerHolder",true)}));
}//initializeSampleList1()//
public void initializeInnerView(com.foundation.view.swt.Container parent) {
innerView = new com.foundation.view.swt.PanelViewer(parent, INNER_VIEW_COMPONENT, com.foundation.view.swt.PanelViewer.STYLE_BORDER);
innerView.setControllerAssociation(new com.foundation.view.SingleAssociationContainer("controllerHolder", new com.foundation.view.SingleAssociation[] {new com.foundation.view.SingleAssociation(test.local.view.controller.EnhancedListPageViewController.class, INNER_VIEW_ASSOCIATION_CONTROLLER_ASSOCIATION_0, this, false, null, null, new com.foundation.view.EventAssociation[] {new com.foundation.view.EventAssociation(null, null, null, test.local.view.controller.EnhancedListPageViewController.class, test.local.view.controller.EnhancedListPageViewController.EDITOR)}, null,true)}));
com.foundation.view.swt.FillLayout layout = new com.foundation.view.swt.FillLayout(innerView);
innerView.setLayout(layout);
innerView.setTabOrder(new com.common.util.LiteList(new Object[] {}));
innerView.setDefaultIsVisible(false);
innerView.setIsVisibleAssociation(new com.foundation.view.SingleAssociationContainer("controllerHolder", new com.foundation.view.SingleAssociation[] {new com.foundation.view.SingleAssociation(test.local.view.controller.EnhancedListPageViewController.class, INNER_VIEW_ASSOCIATION_IS_VISIBLE_ASSOCIATION_0, this, false, null, null, new com.foundation.view.EventAssociation[] {new com.foundation.view.EventAssociation(null, null, null, test.local.view.controller.EnhancedListPageViewController.class, test.local.view.controller.EnhancedListPageViewController.EDITOR)}, null,true)}));
}//initializeInnerView()//
/* (non-Javadoc)
* @see com.foundation.view.IView#internalViewInitialize()
*/
public void internalViewInitialize() {
initializeControllerHolder(this);
initializeSampleList1Label(this);
initializeSampleList1(this);
initializeInnerView(this);
com.foundation.view.swt.GridLayout layout = new com.foundation.view.swt.GridLayout(this);
layout.setNumColumns(1);
layout.setMarginHeight(5);
layout.setMarginWidth(5);
this.setLayout(layout);
this.setTabOrder(new com.common.util.LiteList(new Object[] {}));
this.setDefaultContainerTitle("Enhanced List");
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 UNNAMED_COMPONENT1_SELECTION_METHOD_ASSOCIATION:
((test.local.view.controller.EnhancedListPageViewController) value).doSomething();
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 SAMPLE_LIST1_ASSOCIATION_COLLECTION_ASSOCIATION_0:
result = ((test.local.view.controller.EnhancedListPageViewController) value).getProjects();
break;
case SAMPLE_LIST1_ASSOCIATION_SELECTION_ASSOCIATION_0:
result = ((test.local.view.controller.EnhancedListPageViewController) value).getSelection();
break;
case SAMPLE_LIST1_ASSOCIATION_DATA_0_ASSOCIATION_0:
result = ((test.local.view.controller.EnhancedListPageViewController) value).getObjectColor((java.lang.Object) parameters[0]);
break;
case SAMPLE_LIST1_ASSOCIATION_ITEM_TEXT_ASSOCIATION_0:
result = ((test.model.Project) value).getName();
break;
case SAMPLE_LIST1_ASSOCIATION_ITEM_IMAGE_ASSOCIATION_0:
result = ((test.local.view.controller.EnhancedListPageViewController) value).getImage((test.model.Project) parameters[0]);
break;
case INNER_VIEW_ASSOCIATION_CONTROLLER_ASSOCIATION_0:
result = ((test.local.view.controller.EnhancedListPageViewController) value).getEditor();
break;
case INNER_VIEW_ASSOCIATION_IS_VISIBLE_ASSOCIATION_0:
result = ((test.local.view.controller.EnhancedListPageViewController) value).getEditor();
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 SAMPLE_LIST1_ASSOCIATION_COLLECTION_ASSOCIATION_0:
result = ((test.local.view.controller.EnhancedListPageViewController) value).getOldAttributeValue(test.local.view.controller.EnhancedListPageViewController.PROJECTS);
break;
case SAMPLE_LIST1_ASSOCIATION_SELECTION_ASSOCIATION_0:
result = ((test.local.view.controller.EnhancedListPageViewController) value).getOldAttributeValue(test.local.view.controller.EnhancedListPageViewController.SELECTION);
break;
case SAMPLE_LIST1_ASSOCIATION_ITEM_TEXT_ASSOCIATION_0:
result = ((test.model.Project) value).getOldAttributeValue(test.model.Project.NAME);
break;
case INNER_VIEW_ASSOCIATION_CONTROLLER_ASSOCIATION_0:
result = ((test.local.view.controller.EnhancedListPageViewController) value).getOldAttributeValue(test.local.view.controller.EnhancedListPageViewController.EDITOR);
break;
case INNER_VIEW_ASSOCIATION_IS_VISIBLE_ASSOCIATION_0:
result = ((test.local.view.controller.EnhancedListPageViewController) value).getOldAttributeValue(test.local.view.controller.EnhancedListPageViewController.EDITOR);
break;
default:
com.common.debug.Debug.log("Association (original value getter) broken.");
break;
}//switch//
}//if//
else {
switch(associationNumber) {
case SAMPLE_LIST1_ASSOCIATION_SELECTION_ASSOCIATION_0:
((test.local.view.controller.EnhancedListPageViewController) value).setSelection((java.lang.Object) 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() {
{ //sampleList1//
com.foundation.view.swt.layout.GridData layoutData = new com.foundation.view.swt.layout.GridData();
layoutData.verticalAlignment = com.foundation.view.swt.layout.GridData.FILL;
layoutData.horizontalAlignment = com.foundation.view.swt.layout.GridData.FILL;
layoutData.grabExcessHorizontalSpace = true;
layoutData.grabExcessVerticalSpace = true;
sampleList1.setLayoutData(layoutData);
}//block//
{ //innerView//
com.foundation.view.swt.layout.GridData layoutData = new com.foundation.view.swt.layout.GridData();
layoutData.horizontalAlignment = com.foundation.view.swt.layout.GridData.FILL;
layoutData.grabExcessHorizontalSpace = true;
innerView.setLayoutData(layoutData);
}//block//
}//layoutComponents()//
/**
* Initializes the direct linkages between the components.
*/
public void setupLinkages() {
sampleList1HiddenDataPart0.addSelectionLink(new com.foundation.view.LinkData(sampleList1Label, com.foundation.view.swt.Label.LINK_TARGET_BACKGROUND_COLOR, null, false, false));
}//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.view.swt.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.view.swt.Label getVpSampleList1Label() {
return sampleList1Label;
}//getVpSampleList1Label()//
/**
* 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.view.swt.EnhancedList getVpSampleList1() {
return sampleList1;
}//getVpSampleList1()//
/**
* 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.view.swt.EnhancedList.IHiddenColor getVpSampleList1HiddenDataPart0() {
return sampleList1HiddenDataPart0;
}//getVpSampleList1HiddenDataPart0()//
/**
* 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.view.swt.Menu 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.view.swt.Menu 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.view.swt.PanelViewer getVpInnerView() {
return innerView;
}//getVpInnerView()//
}//EnhancedListPageView//