179 lines
6.7 KiB
Java
179 lines
6.7 KiB
Java
package test.local.view;
|
|
|
|
/**
|
|
* ImagePageView
|
|
*/
|
|
public class ImagePageView 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 UPLOAD_IMAGE_BUTTON_COMPONENT = "uploadImageButton";
|
|
public static final String DOWNLOAD_IMAGE_BUTTON_COMPONENT = "downloadImageButton";
|
|
public static final String IMAGE_PAGE_VIEW_COMPONENT = "ImagePageView";
|
|
|
|
//Method Association Identifiers//
|
|
protected static final int UPLOAD_IMAGE_BUTTON_SELECTION_METHOD_ASSOCIATION = 0;
|
|
protected static final int DOWNLOAD_IMAGE_BUTTON_SELECTION_METHOD_ASSOCIATION = 1;
|
|
|
|
//View Components//
|
|
private com.foundation.view.swt.ValueHolder controllerHolder = null;
|
|
private com.foundation.view.swt.Button uploadImageButton = null;
|
|
private com.foundation.view.swt.Button downloadImageButton = null;
|
|
/**
|
|
* ImagePageView 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 ImagePageView() {
|
|
}//ImagePageView()//
|
|
/**
|
|
* ImagePageView 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 ImagePageView(com.foundation.controller.ViewController controller, com.foundation.view.IView parentComponent) {
|
|
super((com.foundation.view.IAbstractContainer) parentComponent, IMAGE_PAGE_VIEW_COMPONENT, 0);
|
|
|
|
setController(controller);
|
|
}//ImagePageView()//
|
|
public void initializeControllerHolder(com.foundation.view.swt.Container parent) {
|
|
controllerHolder = new com.foundation.view.swt.ValueHolder(parent, CONTROLLER_HOLDER_COMPONENT, test.local.view.controller.ImagePageViewController.class);
|
|
}//initializeControllerHolder()//
|
|
public void initializeUploadImageButton(com.foundation.view.swt.Container parent) {
|
|
uploadImageButton = new com.foundation.view.swt.Button(parent, UPLOAD_IMAGE_BUTTON_COMPONENT, 0);
|
|
|
|
uploadImageButton.setText("Upload Image");
|
|
uploadImageButton.setSelectionMethod(new com.foundation.view.MethodAssociation(this, UPLOAD_IMAGE_BUTTON_SELECTION_METHOD_ASSOCIATION, uploadImageButton, "controllerHolder", null, null));
|
|
}//initializeUploadImageButton()//
|
|
public void initializeDownloadImageButton(com.foundation.view.swt.Container parent) {
|
|
downloadImageButton = new com.foundation.view.swt.Button(parent, DOWNLOAD_IMAGE_BUTTON_COMPONENT, 0);
|
|
|
|
downloadImageButton.setText("Download Image");
|
|
downloadImageButton.setSelectionMethod(new com.foundation.view.MethodAssociation(this, DOWNLOAD_IMAGE_BUTTON_SELECTION_METHOD_ASSOCIATION, downloadImageButton, "controllerHolder", null, null));
|
|
}//initializeDownloadImageButton()//
|
|
/* (non-Javadoc)
|
|
* @see com.foundation.view.IView#internalViewInitialize()
|
|
*/
|
|
public void internalViewInitialize() {
|
|
initializeControllerHolder(this);
|
|
initializeUploadImageButton(this);
|
|
initializeDownloadImageButton(this);
|
|
com.foundation.view.swt.FillLayout layout = new com.foundation.view.swt.FillLayout(this);
|
|
|
|
layout.setType(org.eclipse.swt.SWT.VERTICAL);
|
|
this.setLayout(layout);
|
|
this.setTabOrder(new com.common.util.LiteList(new Object[] {}));
|
|
this.setDefaultContainerTitle("Image");
|
|
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 UPLOAD_IMAGE_BUTTON_SELECTION_METHOD_ASSOCIATION:
|
|
((test.local.view.controller.ImagePageViewController) value).doUploadImage();
|
|
break;
|
|
case DOWNLOAD_IMAGE_BUTTON_SELECTION_METHOD_ASSOCIATION:
|
|
((test.local.view.controller.ImagePageViewController) value).doDownloadImage();
|
|
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) {
|
|
default:
|
|
com.common.debug.Debug.log("Association (getter) broken.");
|
|
break;
|
|
}//switch//
|
|
|
|
}//if//
|
|
else if(flags == INVOKE_ORIGINAL_VALUE_GETTER_METHOD_FLAG) {
|
|
switch(associationNumber) {
|
|
default:
|
|
com.common.debug.Debug.log("Association (original value getter) broken.");
|
|
break;
|
|
}//switch//
|
|
|
|
}//if//
|
|
else {
|
|
switch(associationNumber) {
|
|
default:
|
|
com.common.debug.Debug.log("Association (setter) broken.");
|
|
break;
|
|
}//switch//
|
|
|
|
}//else//
|
|
return result;
|
|
}//invokeMethod()//
|
|
/**
|
|
* Lays out the components.
|
|
*/
|
|
public void layoutComponents() {
|
|
}//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.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.Button getVpUploadImageButton() {
|
|
return uploadImageButton;
|
|
}//getVpUploadImageButton()//
|
|
/**
|
|
* 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.Button getVpDownloadImageButton() {
|
|
return downloadImageButton;
|
|
}//getVpDownloadImageButton()//
|
|
}//ImagePageView// |