Initial commit from SVN.
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2006,2009 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import test.application.TestViewApplication;
|
||||
|
||||
import com.foundation.application.IApplication;
|
||||
import com.foundation.attribute.ReflectionContext;
|
||||
import com.foundation.controller.ViewController;
|
||||
import com.foundation.view.IViewContext;
|
||||
|
||||
public abstract class AbstractViewController extends ViewController {
|
||||
/**
|
||||
* AbstractViewController constructor.
|
||||
* @param context The context underwhich the view is being created. This context manages the threading, resources, and request handling for the view as well as ties together related views.
|
||||
*/
|
||||
public AbstractViewController(IViewContext context) {
|
||||
super(context);
|
||||
}//AbstractViewController()//
|
||||
/**
|
||||
* AbstractViewController constructor.
|
||||
* @param context The context underwhich the view is being created. This context manages the threading, resources, and request handling for the view as well as ties together related views.
|
||||
* @param reflectionContext The reflection context to be used by the view.
|
||||
*/
|
||||
public AbstractViewController(IViewContext context, ReflectionContext reflectionContext) {
|
||||
super(context, reflectionContext);
|
||||
}//AbstractViewController()//
|
||||
/**
|
||||
* AbstractViewController constructor.
|
||||
* @param context
|
||||
* @param validateOnOpen
|
||||
*/
|
||||
public AbstractViewController(IViewContext context, boolean validateOnOpen) {
|
||||
super(context, validateOnOpen);
|
||||
}
|
||||
/**
|
||||
* AbstractViewController constructor.
|
||||
* @param context
|
||||
* @param reflectionContext
|
||||
* @param validateOnOpen
|
||||
*/
|
||||
public AbstractViewController(IViewContext context, ReflectionContext reflectionContext, boolean validateOnOpen) {
|
||||
super(context, reflectionContext, validateOnOpen);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#validate()
|
||||
*/
|
||||
public boolean validate() {
|
||||
return true;
|
||||
}//validate()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.common.IEntity#getApplication()
|
||||
*/
|
||||
public IApplication getApplication() {
|
||||
return TestViewApplication.getSingleton();
|
||||
}//getApplication()//
|
||||
}//AbstractViewController//
|
||||
@@ -0,0 +1,189 @@
|
||||
/*
|
||||
* Copyright (c) 2005,2007 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import test.local.view.ComboPageView;
|
||||
import test.model.EmailAddress;
|
||||
import test.model.Project;
|
||||
import test.model.StreetAddress;
|
||||
|
||||
import com.foundation.controller.ViewController;
|
||||
import com.foundation.metadata.Attribute;
|
||||
import com.foundation.util.IManagedList;
|
||||
import com.foundation.view.IViewContext;
|
||||
import com.foundation.view.JefColor;
|
||||
|
||||
public class ComboPageViewController extends AbstractViewController {
|
||||
public static final Attribute PROJECTS = registerCollection(ComboPageViewController.class, "projects", AO_REFERENCED);
|
||||
public static final Attribute EDITOR = registerAttribute(ComboPageViewController.class, "editor", AO_REFERENCED);
|
||||
public static final Attribute SELECTED_PROJECT = registerAttribute(ComboPageViewController.class, "selectedProject", AO_REFERENCED);
|
||||
public static final Attribute SELECTED_CONTACT = registerAttribute(ComboPageViewController.class, "selectedContact", AO_REFERENCED);
|
||||
public static final Attribute SELECTED_ADDRESS = registerAttribute(ComboPageViewController.class, "selectedAddress", AO_REFERENCED);
|
||||
public static final Attribute EDITABLE_CONTACT_NAME = registerAttribute(ComboPageViewController.class, "editableContactName", AO_REFERENCED);
|
||||
/**
|
||||
* ComboPageViewController constructor.
|
||||
* @param context The context underwhich the view is being created. This context manages the threading, resources, and request handling for the view as well as ties together related views.
|
||||
* @param projects The collection of displayed projects.
|
||||
*/
|
||||
public ComboPageViewController(IViewContext context, IManagedList projects) {
|
||||
super(context);
|
||||
|
||||
setProjects((IManagedList) getReflectionManager().createReflection(projects));
|
||||
}//ComboPageViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.common.Entity#lazyLoadAttribute(com.foundation.metadata.Attribute)
|
||||
*/
|
||||
protected Object lazyLoadAttribute(Attribute attribute) {
|
||||
Object result = null;
|
||||
|
||||
result = super.lazyLoadAttribute(attribute);
|
||||
|
||||
return result;
|
||||
}//lazyLoadAttribute()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return ComboPageView.class;
|
||||
}//getViewClass()//
|
||||
/**
|
||||
* Gets the collection of projects displayed in the collection.
|
||||
* @return The projects.
|
||||
*/
|
||||
public IManagedList getProjects() {
|
||||
return (IManagedList) getAttributeValue(PROJECTS);
|
||||
}//getProjects()//
|
||||
/**
|
||||
* Sets the collection of projects displayed in the collection.
|
||||
* @param projects The projects.
|
||||
*/
|
||||
private void setProjects(IManagedList projects) {
|
||||
setAttributeValue(PROJECTS, projects);
|
||||
}//setProjects()//
|
||||
/**
|
||||
* Gets the editor displayed under the collection.
|
||||
* @return The editor or null if no editor is visible.
|
||||
*/
|
||||
public ViewController getEditor() {
|
||||
return (ViewController) getAttributeValue(EDITOR);
|
||||
}//getEditor()//
|
||||
/**
|
||||
* Sets the editor displayed under the collection.
|
||||
* @param editor The editor or null if no editor is visible.
|
||||
*/
|
||||
private void setEditor(ViewController editor) {
|
||||
setAttributeValue(EDITOR, editor);
|
||||
}//setEditor()//
|
||||
/**
|
||||
* Gets the collection selected project.
|
||||
* @return The selected object in the collection.
|
||||
*/
|
||||
public Object getSelectedProject() {
|
||||
return (Object) getAttributeValue(SELECTED_PROJECT);
|
||||
}//getSelectedProject()//
|
||||
/**
|
||||
* Sets the collection selected project.
|
||||
* @param selectedProject The selected object in the collection.
|
||||
*/
|
||||
public void setSelectedProject(Object selectedProject) {
|
||||
if(getSelectedProject() != selectedProject) {
|
||||
setAttributeValue(SELECTED_PROJECT, selectedProject);
|
||||
setSelectedContact(null);
|
||||
setupEditor(selectedProject);
|
||||
}//if//
|
||||
}//setSelectedProject()//
|
||||
public String getProjectName() {
|
||||
return (String) ((Project) getSelectedProject()).getName();
|
||||
}
|
||||
public void setProjectName(String name) {
|
||||
if(getSelectedProject() != null) {
|
||||
((Project) getSelectedProject()).setName(name);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Gets the collection selected contact.
|
||||
* @return The selected object in the collection.
|
||||
*/
|
||||
public Object getSelectedContact() {
|
||||
return (Object) getAttributeValue(SELECTED_CONTACT);
|
||||
}//getSelectedContact()//
|
||||
/**
|
||||
* Sets the collection selected contact.
|
||||
* @param selectedContact The selected object in the collection.
|
||||
*/
|
||||
public void setSelectedContact(Object selectedContact) {
|
||||
if(getSelectedContact() != selectedContact) {
|
||||
setAttributeValue(SELECTED_CONTACT, selectedContact);
|
||||
setSelectedAddress(null);
|
||||
setupEditor(selectedContact);
|
||||
}//if//
|
||||
}//setSelectedContact()//
|
||||
/**
|
||||
* Gets the editable contact name which is used for testing the editable combo box.
|
||||
* @return The contact name.
|
||||
*/
|
||||
public Object getEditableContactName() {
|
||||
return (Object) getAttributeValue(EDITABLE_CONTACT_NAME);
|
||||
}//getEditableContactName()//
|
||||
/**
|
||||
* Sets the editable contact name which is used for testing the editable combo box.
|
||||
* @param editableContactName The contact name.
|
||||
*/
|
||||
public void setEditableContactName(Object editableContactName) {
|
||||
setAttributeValue(EDITABLE_CONTACT_NAME, editableContactName);
|
||||
}//setEditableContactName()//
|
||||
/**
|
||||
* Gets the collection selected address.
|
||||
* @return The selected object in the collection.
|
||||
*/
|
||||
public Object getSelectedAddress() {
|
||||
return (Object) getAttributeValue(SELECTED_ADDRESS);
|
||||
}//getSelectedAddress()//
|
||||
/**
|
||||
* Sets the collection selected address.
|
||||
* @param selectedAddress The selected object in the collection.
|
||||
*/
|
||||
public void setSelectedAddress(Object selectedAddress) {
|
||||
if(getSelectedAddress() != selectedAddress) {
|
||||
setAttributeValue(SELECTED_ADDRESS, selectedAddress);
|
||||
setupEditor(selectedAddress);
|
||||
}//if//
|
||||
}//setSelectedAddress()//
|
||||
/**
|
||||
* Sets up the editor for the given selection.
|
||||
* @param selection The selection whose editor must be setup.
|
||||
*/
|
||||
private void setupEditor(Object selection) {
|
||||
ViewController editor = null;
|
||||
|
||||
if(selection instanceof EmailAddress) {
|
||||
editor = new EmailAddressEditorViewController(getContext(), new Runnable() {
|
||||
public void run() {
|
||||
getReflectionManager().synchronizeAll();
|
||||
}//run()//
|
||||
}, (EmailAddress) selection);
|
||||
}//if//
|
||||
else if(selection instanceof StreetAddress) {
|
||||
editor = new StreetAddressEditorViewController(getContext(), new Runnable() {
|
||||
public void run() {
|
||||
getReflectionManager().synchronizeAll();
|
||||
}//run()//
|
||||
}, (StreetAddress) selection);
|
||||
}//else if//
|
||||
|
||||
setEditor(editor);
|
||||
}//setupEditor()//
|
||||
/**
|
||||
* Gets the color associated with the given object.
|
||||
* @param object The object for which a color will be generated.
|
||||
* @return The object's color.
|
||||
*/
|
||||
public JefColor getObjectColor(Object object) {
|
||||
return new JefColor((object.hashCode() & 0xFF), (object.hashCode() & 0xFF00) >> 8, 255 - ((object.hashCode() & 0xFF00) >> 8));
|
||||
}//getObjectColor()//
|
||||
}//ComboPageViewController//
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import test.local.view.ContactEditorView;
|
||||
import test.model.Contact;
|
||||
|
||||
import com.foundation.metadata.Attribute;
|
||||
import com.foundation.view.IViewContext;
|
||||
|
||||
public class ContactEditorViewController extends AbstractViewController {
|
||||
public static final Attribute CONTACT = registerAttribute(ContactEditorViewController.class, "contact");
|
||||
private Runnable changeListener;
|
||||
/**
|
||||
* ContactEditorViewController constructor.
|
||||
* @param context The context underwhich the view is being created. This context manages the threading, resources, and request handling for the view as well as ties together related views.
|
||||
* @param changeListener The optional listener called when changes are applied to the contact.
|
||||
* @param contact The edited contact.
|
||||
*/
|
||||
public ContactEditorViewController(IViewContext context, Runnable changeListener, Contact contact) {
|
||||
super(context);
|
||||
this.changeListener = changeListener;
|
||||
setContact((Contact) getReflectionManager().createReflection(contact));
|
||||
}//ContactEditorViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return ContactEditorView.class;
|
||||
}//getViewClass()//
|
||||
/**
|
||||
* Applies changes to the contact.
|
||||
*/
|
||||
public void doApply() {
|
||||
synchronize();
|
||||
getReflectionManager().synchronizeAll();
|
||||
|
||||
if(changeListener != null) {
|
||||
changeListener.run();
|
||||
}//if//
|
||||
}//doApply()//
|
||||
/**
|
||||
* Rejects changes to the contact.
|
||||
*/
|
||||
public void doCancel() {
|
||||
synchronize();
|
||||
getContact().reverseObjectChanges();
|
||||
}//doCancel()//
|
||||
/**
|
||||
* Gets the contact being edited.
|
||||
* @return The edited contact.
|
||||
*/
|
||||
public Contact getContact() {
|
||||
return (Contact) getAttributeValue(CONTACT);
|
||||
}//getContact()//
|
||||
/**
|
||||
* Sets the contact being edited.
|
||||
* @param contact The edited contact.
|
||||
*/
|
||||
private void setContact(Contact contact) {
|
||||
setAttributeValue(CONTACT, contact);
|
||||
}//getContact()//
|
||||
}//ContactEditorViewController//
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import test.local.view.EmailAddressEditorView;
|
||||
import test.model.EmailAddress;
|
||||
|
||||
import com.foundation.metadata.Attribute;
|
||||
import com.foundation.view.IViewContext;
|
||||
|
||||
public class EmailAddressEditorViewController extends AbstractViewController {
|
||||
public static final Attribute EMAIL_ADDRESS = registerAttribute(EmailAddressEditorViewController.class, "emailAddress");
|
||||
private Runnable changeListener;
|
||||
/**
|
||||
* EmailAddressEditorViewController constructor.
|
||||
* @param context The context underwhich the view is being created. This context manages the threading, resources, and request handling for the view as well as ties together related views.
|
||||
* @param changeListener The optional listener called when changes are applied to the email address.
|
||||
* @param emailAddress The edited email address.
|
||||
*/
|
||||
public EmailAddressEditorViewController(IViewContext context, Runnable changeListener, EmailAddress emailAddress) {
|
||||
super(context);
|
||||
this.changeListener = changeListener;
|
||||
setEmailAddress((EmailAddress) getReflectionManager().createReflection(emailAddress));
|
||||
}//EmailAddressEditorViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return EmailAddressEditorView.class;
|
||||
}//getViewClass()//
|
||||
/**
|
||||
* Applies changes to the email address.
|
||||
*/
|
||||
public void doApply() {
|
||||
synchronize();
|
||||
getReflectionManager().synchronizeAll();
|
||||
|
||||
if(changeListener != null) {
|
||||
changeListener.run();
|
||||
}//if//
|
||||
}//doApply()//
|
||||
/**
|
||||
* Rejects changes to the email address.
|
||||
*/
|
||||
public void doCancel() {
|
||||
synchronize();
|
||||
getEmailAddress().reverseObjectChanges();
|
||||
}//doCancel()//
|
||||
/**
|
||||
* Gets the emailAddress being edited.
|
||||
* @return The edited emailAddress.
|
||||
*/
|
||||
public EmailAddress getEmailAddress() {
|
||||
return (EmailAddress) getAttributeValue(EMAIL_ADDRESS);
|
||||
}//getEmailAddress()//
|
||||
/**
|
||||
* Sets the emailAddress being edited.
|
||||
* @param emailAddress The edited emailAddress.
|
||||
*/
|
||||
private void setEmailAddress(EmailAddress emailAddress) {
|
||||
setAttributeValue(EMAIL_ADDRESS, emailAddress);
|
||||
}//getEmailAddress()//
|
||||
}//EmailAddressEditorViewController//
|
||||
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* Copyright (c) 2005,2009 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import test.local.view.EnhancedListPageView;
|
||||
import test.model.Project;
|
||||
|
||||
import com.common.debug.Debug;
|
||||
import com.foundation.controller.ViewController;
|
||||
import com.foundation.metadata.Attribute;
|
||||
import com.foundation.util.IManagedList;
|
||||
import com.foundation.view.IViewContext;
|
||||
import com.foundation.view.ImageDecoration;
|
||||
import com.foundation.view.JefColor;
|
||||
import com.foundation.view.resource.ResourceReference;
|
||||
|
||||
public class EnhancedListPageViewController extends AbstractViewController {
|
||||
public static final ResourceReference[] IMAGES = new ResourceReference[] {new ResourceReference("res://package/group/accept"), new ResourceReference("res://package/group/reject")};
|
||||
|
||||
public static final Attribute PROJECTS = registerCollection(EnhancedListPageViewController.class, "projects", AO_REFERENCED);
|
||||
public static final Attribute EDITOR = registerAttribute(EnhancedListPageViewController.class, "editor", AO_REFERENCED);
|
||||
public static final Attribute SELECTION = registerAttribute(EnhancedListPageViewController.class, "selection", AO_REFERENCED);
|
||||
/**
|
||||
* ListPageViewController constructor.
|
||||
* @param context The context underwhich the view is being created. This context manages the threading, resources, and request handling for the view as well as ties together related views.
|
||||
* @param projects The collection of displayed projects.
|
||||
*/
|
||||
public EnhancedListPageViewController(IViewContext context, IManagedList projects) {
|
||||
super(context);
|
||||
|
||||
setProjects((IManagedList) getReflectionManager().createReflection(projects));
|
||||
}//ListPageViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.common.Entity#lazyLoadAttribute(com.foundation.metadata.Attribute)
|
||||
*/
|
||||
protected Object lazyLoadAttribute(Attribute attribute) {
|
||||
Object result = null;
|
||||
|
||||
result = super.lazyLoadAttribute(attribute);
|
||||
|
||||
return result;
|
||||
}//lazyLoadAttribute()//
|
||||
/* (non-Javadoc)
|
||||
* @see test.local.view.controller.AbstractViewController#validate()
|
||||
*/
|
||||
public boolean validate() {
|
||||
getDecorationManager().clearDecorations(null, null);
|
||||
Project project = (Project) getProjects().getFirst();
|
||||
|
||||
if(project != null) {
|
||||
getDecorationManager().addDecoration(project, null, new ImageDecoration(new ResourceReference("res://View/ProjectEditor/ErrorOverlay")));
|
||||
}//if//
|
||||
|
||||
getDecorationManager().applyDecorationChanges();
|
||||
|
||||
return super.validate();
|
||||
}//validate()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return EnhancedListPageView.class;
|
||||
}//getViewClass()//
|
||||
public void doSomething() {
|
||||
Debug.log("EnhancedList Menu Selected");
|
||||
}//doSomething()//
|
||||
/**
|
||||
* Gets the collection of projects displayed in the collection.
|
||||
* @return The projects.
|
||||
*/
|
||||
public IManagedList getProjects() {
|
||||
return (IManagedList) getAttributeValue(PROJECTS);
|
||||
}//getProjects()//
|
||||
/**
|
||||
* Sets the collection of projects displayed in the collection.
|
||||
* @param projects The projects.
|
||||
*/
|
||||
private void setProjects(IManagedList projects) {
|
||||
setAttributeValue(PROJECTS, projects);
|
||||
}//setProjects()//
|
||||
/**
|
||||
* Gets an image to display for the given project.
|
||||
* @param project The project whose image is to be found.
|
||||
* @return The project's image or resource to the image.
|
||||
*/
|
||||
public Object getImage(Project project) {
|
||||
return IMAGES[project.hashCode() % IMAGES.length];
|
||||
}//getImage()//
|
||||
/**
|
||||
* Gets the editor displayed under the collection.
|
||||
* @return The editor or null if no editor is visible.
|
||||
*/
|
||||
public ViewController getEditor() {
|
||||
return (ViewController) getAttributeValue(EDITOR);
|
||||
}//getEditor()//
|
||||
/**
|
||||
* Sets the editor displayed under the collection.
|
||||
* @param editor The editor or null if no editor is visible.
|
||||
*/
|
||||
private void setEditor(ViewController editor) {
|
||||
setAttributeValue(EDITOR, editor);
|
||||
}//setEditor()//
|
||||
/**
|
||||
* Gets the collection selection.
|
||||
* @return The selected object in the collection.
|
||||
*/
|
||||
public Object getSelection() {
|
||||
return (Object) getAttributeValue(SELECTION);
|
||||
}//getSelection()//
|
||||
/**
|
||||
* Sets the collection selection.
|
||||
* @param selection The selected object in the collection.
|
||||
*/
|
||||
public void setSelection(Object selection) {
|
||||
if(getSelection() != selection) {
|
||||
setAttributeValue(SELECTION, selection);
|
||||
setupEditor(selection);
|
||||
}//if//
|
||||
}//setSelection()//
|
||||
/**
|
||||
* Sets up the editor for the given selection.
|
||||
* @param selection The selection whose editor must be setup.
|
||||
*/
|
||||
private void setupEditor(Object selection) {
|
||||
ViewController editor = null;
|
||||
|
||||
if(selection != null) {
|
||||
editor = new ProjectEditorViewController(getContext(), new Runnable() {
|
||||
public void run() {
|
||||
getReflectionManager().synchronizeAll();
|
||||
}//run()//
|
||||
}, (Project) selection);
|
||||
}//if//
|
||||
|
||||
setEditor(editor);
|
||||
}//setupEditor()//
|
||||
/**
|
||||
* Gets the color associated with the given object.
|
||||
* @param object The object for which a color will be generated.
|
||||
* @return The object's color.
|
||||
*/
|
||||
public JefColor getObjectColor(Object object) {
|
||||
return new JefColor((object.hashCode() & 0xFF), (object.hashCode() & 0xFF00) >> 8, 255 - (object.hashCode() & 0xFF));
|
||||
}//getObjectColor()//
|
||||
}//ListPageViewController//
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2009 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import test.local.view.EnhancedListPerformanceTestView;
|
||||
|
||||
import com.foundation.metadata.Attribute;
|
||||
import com.foundation.util.IManagedList;
|
||||
import com.foundation.view.IViewContext;
|
||||
import com.foundation.view.ImageDecoration;
|
||||
|
||||
public class EnhancedListPerformanceTestViewController extends AbstractViewController {
|
||||
public static final Attribute COLLECTION = registerCollection(EnhancedListPerformanceTestViewController.class, "collection", AO_REFERENCED);
|
||||
/**
|
||||
* EnhancedListPerformanceTestViewController constructor.
|
||||
* @param context The context under which the view is being created. This context manages the threading, resources, and request handling for the view as well as ties together related views.
|
||||
*/
|
||||
public EnhancedListPerformanceTestViewController(IViewContext context, IManagedList collection, boolean reflect) {
|
||||
super(context, true);
|
||||
|
||||
if(reflect) {
|
||||
setCollection((IManagedList) getReflectionManager().createReflection(collection));
|
||||
}//if//
|
||||
else {
|
||||
setCollection(collection);
|
||||
}//else//
|
||||
}//EnhancedListPerformanceTestViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return EnhancedListPerformanceTestView.class;
|
||||
}//getViewClass()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.declarativeengineering.jetson.view.controller.AbstractViewController#validate()
|
||||
*/
|
||||
public boolean validate() {
|
||||
getDecorationManager().clearDecorations();
|
||||
|
||||
if(getCollection().getSize() > 0) {
|
||||
getDecorationManager().addDecoration(getCollection().getFirst(), null, new ImageDecoration("res://View/ProjectEditor/ErrorOverlay"));
|
||||
}//if//
|
||||
|
||||
getDecorationManager().applyDecorationChanges();
|
||||
|
||||
return false;
|
||||
}//validate()//
|
||||
/**
|
||||
* Gets the collection value.
|
||||
* @return The collection value.
|
||||
*/
|
||||
public IManagedList getCollection() {
|
||||
return (IManagedList) getAttributeValue(COLLECTION);
|
||||
}//getCollection()//
|
||||
/**
|
||||
* Sets the collection value.
|
||||
* @param collection The collection value.
|
||||
*/
|
||||
private void setCollection(IManagedList collection) {
|
||||
setAttributeValue(COLLECTION, collection);
|
||||
}//setCollection()//
|
||||
}//EnhancedListPerformanceTestViewController//
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2005,2007 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import test.local.view.ExpandBarPageView;
|
||||
import com.foundation.view.IViewContext;
|
||||
|
||||
public class ExpandBarPageViewController extends AbstractViewController {
|
||||
/**
|
||||
* ExpandBarPageViewController constructor.
|
||||
* @param context
|
||||
*/
|
||||
public ExpandBarPageViewController(IViewContext context) {
|
||||
super(context);
|
||||
}//ExpandBarPageViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return ExpandBarPageView.class;
|
||||
}//getViewClass()//
|
||||
}//ExpandBarPageViewController//
|
||||
@@ -0,0 +1,172 @@
|
||||
/*
|
||||
* Copyright (c) 2005,2006 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
|
||||
import test.local.view.ImagePageView;
|
||||
|
||||
import com.common.debug.Debug;
|
||||
import com.foundation.metadata.Attribute;
|
||||
import com.foundation.view.IViewContext;
|
||||
import com.foundation.view.JefImage;
|
||||
import com.foundation.view.swt.FileDialog;
|
||||
import com.foundation.view.swt.SwtViewContext;
|
||||
import com.foundation.view.swt.util.SwtUtilities;
|
||||
|
||||
public class ImagePageViewController extends AbstractViewController {
|
||||
public static final Attribute TEST_IMAGE = registerAttribute(ImagePageViewController.class, "testImage");
|
||||
/**
|
||||
* TestViewController constructor.
|
||||
* @param context
|
||||
*/
|
||||
public ImagePageViewController(IViewContext context) {
|
||||
super(context);
|
||||
}//TestViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.common.Entity#lazyLoadAttribute(com.foundation.metadata.Attribute)
|
||||
*/
|
||||
protected Object lazyLoadAttribute(Attribute attribute) {
|
||||
Object result = null;
|
||||
|
||||
result = super.lazyLoadAttribute(attribute);
|
||||
|
||||
return result;
|
||||
}//lazyLoadAttribute()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return ImagePageView.class;
|
||||
}//getViewClass()//
|
||||
/**
|
||||
* Uploads an image.
|
||||
*/
|
||||
public void doUploadImage() {
|
||||
FileDialog dialog = new FileDialog(getView(), FileDialog.STYLE_OPEN);
|
||||
String fileName = null;
|
||||
|
||||
dialog.setFilterExtensions(new String[] {"*.jpg", "*.jpeg", "*.gif", "*.bmp", "*.tiff", "*.png", "*.ico"});
|
||||
fileName = dialog.open();
|
||||
|
||||
if(fileName != null) {
|
||||
File file = new File(fileName);
|
||||
|
||||
if(file.exists() && file.canRead()) {
|
||||
try {
|
||||
FileInputStream fin = new FileInputStream(file);
|
||||
byte[] bytes = new byte[fin.available()];
|
||||
int readCount = 0;
|
||||
|
||||
while(readCount < bytes.length) {
|
||||
readCount += fin.read(bytes, readCount, bytes.length - readCount);
|
||||
}//while//
|
||||
|
||||
setTestImage(new JefImage(bytes));
|
||||
}//try//
|
||||
catch(Throwable e) {
|
||||
Debug.log(e);
|
||||
}//catch//
|
||||
}//if//
|
||||
else {
|
||||
//TODO: Report the error.
|
||||
}//else//
|
||||
}//if//
|
||||
}//doUploadImage()//
|
||||
/**
|
||||
* Downloads an image.
|
||||
*/
|
||||
public void doDownloadImage() {
|
||||
if(getTestImage() != null) {
|
||||
String extension = null;
|
||||
Image image = SwtUtilities.getImage(SwtViewContext.getSingleton().getDisplay(), getTestImage());
|
||||
FileDialog dialog = new FileDialog(getView(), FileDialog.STYLE_SAVE);
|
||||
String fileName = null;
|
||||
|
||||
//Determine the correct extension for the image.//
|
||||
switch(image.getImageData().type) {
|
||||
case SWT.IMAGE_BMP:
|
||||
case SWT.IMAGE_OS2_BMP:
|
||||
case SWT.IMAGE_BMP_RLE:
|
||||
extension = ".bmp";
|
||||
break;
|
||||
case SWT.IMAGE_GIF:
|
||||
extension = ".gif";
|
||||
break;
|
||||
case SWT.IMAGE_ICO:
|
||||
extension = ".ico";
|
||||
break;
|
||||
case SWT.IMAGE_JPEG:
|
||||
extension = ".jpg";
|
||||
break;
|
||||
case SWT.IMAGE_PNG:
|
||||
extension = ".png";
|
||||
break;
|
||||
case SWT.IMAGE_TIFF:
|
||||
extension = ".tiff";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}//switch//
|
||||
|
||||
//Dispose of the image so we regain the resources.//
|
||||
image.dispose();
|
||||
dialog.setFileName("image" + extension);
|
||||
fileName = dialog.open();
|
||||
|
||||
if(fileName != null) {
|
||||
File file = new File(fileName);
|
||||
|
||||
if(file.exists()) {
|
||||
//TODO: Request confirmation.
|
||||
|
||||
if(!file.delete()) {
|
||||
//TODO: Report error.
|
||||
}//if//
|
||||
}//if//
|
||||
|
||||
if(!file.mkdirs()) {
|
||||
//TODO: Report error.
|
||||
}//if//
|
||||
|
||||
if(!file.exists() && file.canWrite()) {
|
||||
try {
|
||||
FileOutputStream fout = new FileOutputStream(file);
|
||||
|
||||
fout.write(getTestImage().getImageData());
|
||||
}//try//
|
||||
catch(Throwable e) {
|
||||
Debug.log(e);
|
||||
}//catch//
|
||||
}//if//
|
||||
else {
|
||||
//TODO: Report the error.
|
||||
}//else//
|
||||
}//if//
|
||||
}//if//
|
||||
}//doDownloadImage()//
|
||||
/**
|
||||
* Gets a test image.
|
||||
* @return The image.
|
||||
*/
|
||||
public JefImage getTestImage() {
|
||||
return (JefImage) getAttributeValue(TEST_IMAGE);
|
||||
}//getTestImage()//
|
||||
/**
|
||||
* Sets a test image.
|
||||
* @param testImage The image.
|
||||
*/
|
||||
public void setTestImage(JefImage testImage) {
|
||||
setAttributeValue(TEST_IMAGE, testImage);
|
||||
}//setTestImage()//
|
||||
}//TestViewController//
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2005,2006 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import test.local.view.InnerViewPageView;
|
||||
|
||||
import com.foundation.controller.ViewController;
|
||||
import com.foundation.metadata.Attribute;
|
||||
import com.foundation.view.IViewContext;
|
||||
|
||||
public class InnerViewPageViewController extends AbstractViewController {
|
||||
public static final Attribute INNER_VIEW = registerAttribute(InnerViewPageViewController.class, "innerView", AO_LAZY);
|
||||
/**
|
||||
* InnerViewPageViewController constructor.
|
||||
* @param context
|
||||
*/
|
||||
public InnerViewPageViewController(IViewContext context) {
|
||||
super(context);
|
||||
}//InnerViewPageViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.common.Entity#lazyLoadAttribute(com.foundation.metadata.Attribute)
|
||||
*/
|
||||
protected Object lazyLoadAttribute(Attribute attribute) {
|
||||
Object result = null;
|
||||
|
||||
if(attribute == INNER_VIEW) {
|
||||
result = new SampleInnerViewController(getContext());
|
||||
}//if//
|
||||
else {
|
||||
result = super.lazyLoadAttribute(attribute);
|
||||
}//else//
|
||||
|
||||
return result;
|
||||
}//lazyLoadAttribute()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return InnerViewPageView.class;
|
||||
}//getViewClass()//
|
||||
/**
|
||||
* Gets the inner view's controller.
|
||||
* @return The controller for the inner view.
|
||||
*/
|
||||
public ViewController getInnerView() {
|
||||
return (ViewController) getAttributeValue(INNER_VIEW);
|
||||
}//getInnerView()//
|
||||
}//InnerViewPageViewController//
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (c) 2005,2006 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import test.local.view.ListPageView;
|
||||
import test.model.Project;
|
||||
|
||||
import com.foundation.controller.ViewController;
|
||||
import com.foundation.metadata.Attribute;
|
||||
import com.foundation.util.IManagedList;
|
||||
import com.foundation.view.IViewContext;
|
||||
import com.foundation.view.JefColor;
|
||||
|
||||
public class ListPageViewController extends AbstractViewController {
|
||||
public static final Attribute PROJECTS = registerCollection(ListPageViewController.class, "projects", AO_REFERENCED);
|
||||
public static final Attribute EDITOR = registerAttribute(ListPageViewController.class, "editor", AO_REFERENCED);
|
||||
public static final Attribute SELECTION = registerAttribute(ListPageViewController.class, "selection", AO_REFERENCED);
|
||||
/**
|
||||
* ListPageViewController constructor.
|
||||
* @param context The context underwhich the view is being created. This context manages the threading, resources, and request handling for the view as well as ties together related views.
|
||||
* @param projects The collection of displayed projects.
|
||||
*/
|
||||
public ListPageViewController(IViewContext context, IManagedList projects) {
|
||||
super(context);
|
||||
|
||||
setProjects((IManagedList) getReflectionManager().createReflection(projects));
|
||||
}//ListPageViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.common.Entity#lazyLoadAttribute(com.foundation.metadata.Attribute)
|
||||
*/
|
||||
protected Object lazyLoadAttribute(Attribute attribute) {
|
||||
Object result = null;
|
||||
|
||||
result = super.lazyLoadAttribute(attribute);
|
||||
|
||||
return result;
|
||||
}//lazyLoadAttribute()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return ListPageView.class;
|
||||
}//getViewClass()//
|
||||
/**
|
||||
* Gets the collection of projects displayed in the collection.
|
||||
* @return The projects.
|
||||
*/
|
||||
public IManagedList getProjects() {
|
||||
return (IManagedList) getAttributeValue(PROJECTS);
|
||||
}//getProjects()//
|
||||
/**
|
||||
* Sets the collection of projects displayed in the collection.
|
||||
* @param projects The projects.
|
||||
*/
|
||||
private void setProjects(IManagedList projects) {
|
||||
setAttributeValue(PROJECTS, projects);
|
||||
}//setProjects()//
|
||||
/**
|
||||
* Gets the editor displayed under the collection.
|
||||
* @return The editor or null if no editor is visible.
|
||||
*/
|
||||
public ViewController getEditor() {
|
||||
return (ViewController) getAttributeValue(EDITOR);
|
||||
}//getEditor()//
|
||||
/**
|
||||
* Sets the editor displayed under the collection.
|
||||
* @param editor The editor or null if no editor is visible.
|
||||
*/
|
||||
private void setEditor(ViewController editor) {
|
||||
setAttributeValue(EDITOR, editor);
|
||||
}//setEditor()//
|
||||
/**
|
||||
* Gets the collection selection.
|
||||
* @return The selected object in the collection.
|
||||
*/
|
||||
public Object getSelection() {
|
||||
return (Object) getAttributeValue(SELECTION);
|
||||
}//getSelection()//
|
||||
/**
|
||||
* Sets the collection selection.
|
||||
* @param selection The selected object in the collection.
|
||||
*/
|
||||
public void setSelection(Object selection) {
|
||||
if(getSelection() != selection) {
|
||||
setAttributeValue(SELECTION, selection);
|
||||
setupEditor(selection);
|
||||
}//if//
|
||||
}//setSelection()//
|
||||
/**
|
||||
* Sets up the editor for the given selection.
|
||||
* @param selection The selection whose editor must be setup.
|
||||
*/
|
||||
private void setupEditor(Object selection) {
|
||||
ViewController editor = null;
|
||||
|
||||
if(selection != null) {
|
||||
editor = new ProjectEditorViewController(getContext(), new Runnable() {
|
||||
public void run() {
|
||||
getReflectionManager().synchronizeAll();
|
||||
}//run()//
|
||||
}, (Project) selection);
|
||||
}//if//
|
||||
|
||||
setEditor(editor);
|
||||
}//setupEditor()//
|
||||
/**
|
||||
* Gets the color associated with the given object.
|
||||
* @param object The object for which a color will be generated.
|
||||
* @return The object's color.
|
||||
*/
|
||||
public JefColor getObjectColor(Object object) {
|
||||
return new JefColor((object.hashCode() & 0xFF), (object.hashCode() & 0xFF00) >> 8, 255 - (object.hashCode() & 0xFF));
|
||||
}//getObjectColor()//
|
||||
}//ListPageViewController//
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2009 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import test.local.view.ListPerformanceTestView;
|
||||
|
||||
import com.foundation.util.IManagedList;
|
||||
import com.foundation.view.IViewContext;
|
||||
import com.foundation.metadata.Attribute;
|
||||
|
||||
public class ListPerformanceTestViewController extends AbstractViewController {
|
||||
public static final Attribute COLLECTION = registerCollection(ListPerformanceTestViewController.class, "collection", AO_REFERENCED);
|
||||
/**
|
||||
* ListPerformanceTestViewController constructor.
|
||||
* @param context The context under which the view is being created. This context manages the threading, resources, and request handling for the view as well as ties together related views.
|
||||
*/
|
||||
public ListPerformanceTestViewController(IViewContext context, IManagedList collection, boolean reflect) {
|
||||
super(context, false);
|
||||
|
||||
if(reflect) {
|
||||
setCollection((IManagedList) getReflectionManager().createReflection(collection));
|
||||
}//if//
|
||||
else {
|
||||
setCollection(collection);
|
||||
}//else//
|
||||
}//ListPerformanceTestViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return ListPerformanceTestView.class;
|
||||
}//getViewClass()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.declarativeengineering.jetson.view.controller.AbstractViewController#validate()
|
||||
*/
|
||||
public boolean validate() {
|
||||
return true;
|
||||
}//validate()//
|
||||
/**
|
||||
* Gets the collection value.
|
||||
* @return The collection value.
|
||||
*/
|
||||
public IManagedList getCollection() {
|
||||
return (IManagedList) getAttributeValue(COLLECTION);
|
||||
}//getCollection()//
|
||||
/**
|
||||
* Sets the collection value.
|
||||
* @param collection The collection value.
|
||||
*/
|
||||
private void setCollection(IManagedList collection) {
|
||||
setAttributeValue(COLLECTION, collection);
|
||||
}//setCollection()//
|
||||
}//ListPerformanceTestViewController//
|
||||
@@ -0,0 +1,416 @@
|
||||
/*
|
||||
* Copyright (c) 2005,2009 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import test.application.TestViewApplication;
|
||||
import test.local.view.MainView;
|
||||
import test.model.Contact;
|
||||
import test.model.EmailAddress;
|
||||
import test.model.Priority;
|
||||
import test.model.Project;
|
||||
import test.model.StreetAddress;
|
||||
import test.model.Team;
|
||||
|
||||
import com.common.debug.Debug;
|
||||
import com.foundation.metadata.Attribute;
|
||||
import com.foundation.util.IManagedList;
|
||||
import com.foundation.util.ManagedList;
|
||||
import com.foundation.view.IView;
|
||||
import com.foundation.view.IViewContext;
|
||||
|
||||
public class MainViewController extends AbstractViewController {
|
||||
private static final String[] COLLECTION_TESTS = {"List", "EnhancedList", "Table"};
|
||||
|
||||
public static final Attribute TAB_VIEW_CONTROLLERS = registerCollection(MainViewController.class, "tabViewControllers", AO_LAZY);
|
||||
public static final Attribute CONTACTS = registerCollection(MainViewController.class, "contacts", AO_LAZY);
|
||||
public static final Attribute PROJECTS = registerCollection(MainViewController.class, "projects", AO_LAZY);
|
||||
public static final Attribute PRIORITIES = registerCollection(MainViewController.class, "priorities", AO_LAZY);
|
||||
public static final Attribute TEAMS = registerCollection(MainViewController.class, "teams", AO_LAZY);
|
||||
public static final Attribute TRAY = registerAttribute(MainViewController.class, "tray");
|
||||
public static final Attribute NULL_ATTRIBUTE = registerAttribute(MainViewController.class, "nullAttribute");
|
||||
public static final Attribute NON_NULL_ATTRIBUTE = registerAttribute(MainViewController.class, "nonNullAttribute");
|
||||
public static final Attribute TESTS = registerAttribute(MainViewController.class, "tests", COLLECTION_TESTS);
|
||||
public static final Attribute SELECTED_TEST = registerAttribute(MainViewController.class, "selectedTest");
|
||||
public static final Attribute TEST_ROW_COUNT = registerAttribute(MainViewController.class, "testRowCount", new Integer(100));
|
||||
public static final Attribute TEST_CONTROLLER = registerAttribute(MainViewController.class, "testController");
|
||||
|
||||
public static final Priority HIGH_PRIORITY = new Priority("High");
|
||||
public static final Priority MEDIUM_PRIORITY = new Priority("Medium");
|
||||
public static final Priority LOW_PRIORITY = new Priority("Low");
|
||||
/**
|
||||
* MainViewController constructor.
|
||||
* @param context
|
||||
*/
|
||||
public MainViewController(IViewContext context) {
|
||||
super(context);
|
||||
setNullAttribute(null);
|
||||
setNonNullAttribute("Bla");
|
||||
}//MainViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#postOpenInitialization(com.foundation.view.IView)
|
||||
*/
|
||||
protected void postOpenInitialization(IView view) {
|
||||
super.postOpenInitialization(view);
|
||||
setTray(new TrayController(getContext()));
|
||||
getTray().open();
|
||||
}//postOpenInitialization()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#preClose()
|
||||
*/
|
||||
protected void preClose() {
|
||||
getTray().close();
|
||||
setTray(null);
|
||||
super.preClose();
|
||||
}//preClose()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.common.Entity#lazyLoadAttribute(com.foundation.metadata.Attribute)
|
||||
*/
|
||||
protected Object lazyLoadAttribute(Attribute attribute) {
|
||||
Object result = null;
|
||||
|
||||
if(attribute == TAB_VIEW_CONTROLLERS) {
|
||||
result = new ManagedList(new Object[] {
|
||||
new TextPageViewController(getContext()),
|
||||
new ImagePageViewController(getContext()),
|
||||
new InnerViewPageViewController(getContext()),
|
||||
new StyledTextPageViewController(getContext()),
|
||||
new ToolBarPageViewController(getContext()),
|
||||
// new TablePageViewController(getContext(), getProjects(), getPriorities()),
|
||||
new TableEditorPageViewController(getContext()),
|
||||
// new TreePageViewController(getContext(), getProjects(), getPriorities()),
|
||||
// new TeamViewController(getContext(), getTeams()),
|
||||
// new ComboPageViewController(getContext(), getProjects()),
|
||||
// new ListPageViewController(getContext(), getProjects()),
|
||||
// new EnhancedListPageViewController(getContext(), getProjects()),
|
||||
new ExpandBarPageViewController(getContext())
|
||||
});
|
||||
}//if//
|
||||
else if(attribute == PRIORITIES) {
|
||||
result = new ManagedList(new Object[] {HIGH_PRIORITY, MEDIUM_PRIORITY, LOW_PRIORITY});
|
||||
}//else if//
|
||||
else if(attribute == TEAMS) {
|
||||
ManagedList list = new ManagedList(10, 20);
|
||||
Team t1 = new Team();
|
||||
Team t2 = new Team();
|
||||
IManagedList projects = getProjects();
|
||||
|
||||
t1.setName("Blue Team");
|
||||
t2.setName("Red Team");
|
||||
|
||||
//Put the first half the projects in team 1 and the other half in team 2.//
|
||||
for(int index = 0; index < projects.getSize(); index++) {
|
||||
if(index < projects.getSize() / 2) {
|
||||
t1.getProjects().add(projects.get(index));
|
||||
}//if//
|
||||
else {
|
||||
t2.getProjects().add(projects.get(index));
|
||||
}//else//
|
||||
}//for//
|
||||
|
||||
list.add(t1);
|
||||
list.add(t2);
|
||||
result = list;
|
||||
}//else if//
|
||||
else if(attribute == CONTACTS) {
|
||||
ManagedList list = new ManagedList(10);
|
||||
Contact c1 = new Contact();
|
||||
Contact c2 = new Contact();
|
||||
Contact c3 = new Contact();
|
||||
EmailAddress e1 = new EmailAddress();
|
||||
EmailAddress e2 = new EmailAddress();
|
||||
EmailAddress e3 = new EmailAddress();
|
||||
StreetAddress s1 = new StreetAddress();
|
||||
StreetAddress s2 = new StreetAddress();
|
||||
|
||||
c1.setName("Fred");
|
||||
c2.setName("Linda");
|
||||
c3.setName("George");
|
||||
|
||||
e1.setName("Home");
|
||||
e1.setEmail("fred@aol.com");
|
||||
e2.setName("Work");
|
||||
e2.setEmail("fred@cheesecakefactory.com");
|
||||
s1.setName("Home");
|
||||
s1.setLine("123 Filbert Way");
|
||||
|
||||
e3.setName("Home");
|
||||
e3.setEmail("Linda@lindas.us");
|
||||
s2.setName("Work");
|
||||
s2.setLine("14 S. Street");
|
||||
|
||||
c1.getAddresses().add(e1);
|
||||
c1.getAddresses().add(s1);
|
||||
c1.getAddresses().add(e2);
|
||||
c2.getAddresses().add(s2);
|
||||
c2.getAddresses().add(e3);
|
||||
|
||||
list.add(c1);
|
||||
list.add(c2);
|
||||
list.add(c3);
|
||||
result = list;
|
||||
}//else if//
|
||||
else if(attribute == PROJECTS) {
|
||||
ManagedList list = new ManagedList(10);
|
||||
Project p1 = new Project();
|
||||
Project p2 = new Project();
|
||||
Project p3 = new Project();
|
||||
Project p4 = new Project();
|
||||
Project p5 = new Project();
|
||||
Project p6 = new Project();
|
||||
|
||||
p1.setName("Project 1");
|
||||
p2.setName("Project 2");
|
||||
p3.setName("Project 3");
|
||||
p4.setName("Project 4");
|
||||
p5.setName("Project 5");
|
||||
p6.setName("Project 6");
|
||||
|
||||
p1.setPriority(HIGH_PRIORITY);
|
||||
p2.setPriority(MEDIUM_PRIORITY);
|
||||
p3.setPriority(HIGH_PRIORITY);
|
||||
p4.setPriority(HIGH_PRIORITY);
|
||||
p5.setPriority(LOW_PRIORITY);
|
||||
p6.setPriority(LOW_PRIORITY);
|
||||
|
||||
p1.getContacts().add(getContacts().get(0));
|
||||
p1.getContacts().add(getContacts().get(2));
|
||||
p2.getContacts().add(getContacts().get(0));
|
||||
p2.getContacts().add(getContacts().get(1));
|
||||
p3.getContacts().add(getContacts().get(1));
|
||||
p3.getContacts().add(getContacts().get(2));
|
||||
|
||||
p1.getRecentNotes().add("Note 1");
|
||||
p1.getRecentNotes().add("Note 2");
|
||||
p1.getRecentNotes().add("Note 3");
|
||||
p1.setNote("Note 1");
|
||||
p1.setProgress(new BigDecimal("0"));
|
||||
p2.getRecentNotes().add("This project stinks..");
|
||||
p2.getRecentNotes().add("This project is acceptable..");
|
||||
p2.getRecentNotes().add("This project rocks..");
|
||||
p2.setNote("A custom note.");
|
||||
p2.setProgress(new BigDecimal(".10"));
|
||||
p3.getRecentNotes().add("In Progress");
|
||||
p3.getRecentNotes().add("Idle");
|
||||
p3.getRecentNotes().add("Completed");
|
||||
p3.setNote("Completed");
|
||||
p3.setProgress(new BigDecimal("1.00"));
|
||||
p4.getRecentNotes().add("In Progress");
|
||||
p4.getRecentNotes().add("Idle");
|
||||
p4.getRecentNotes().add("In Progress");
|
||||
p4.setNote("In Progress");
|
||||
p4.setProgress(new BigDecimal(".55"));
|
||||
p5.getRecentNotes().add("In Progress");
|
||||
p5.getRecentNotes().add("Idle");
|
||||
p5.getRecentNotes().add("Completed");
|
||||
p5.setNote("Completed");
|
||||
p5.setProgress(new BigDecimal("1.00"));
|
||||
p6.getRecentNotes().add("In Progress");
|
||||
p6.setNote("In Progress");
|
||||
p6.setProgress(new BigDecimal(".20"));
|
||||
|
||||
list.add(p1);
|
||||
list.add(p2);
|
||||
list.add(p3);
|
||||
list.add(p4);
|
||||
list.add(p5);
|
||||
list.add(p6);
|
||||
result = list;
|
||||
}//else if//
|
||||
else {
|
||||
result = super.lazyLoadAttribute(attribute);
|
||||
}//else//
|
||||
|
||||
return result;
|
||||
}//lazyLoadAttribute()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return MainView.class;
|
||||
}//getViewClass()//
|
||||
/**
|
||||
* Gets the projects.
|
||||
* @return The collection of project instances.
|
||||
*/
|
||||
public IManagedList getProjects() {
|
||||
return (IManagedList) getAttributeValue(PROJECTS);
|
||||
}//getProjects()//
|
||||
/**
|
||||
* Gets the priorities possible for the projects.
|
||||
* @return The collection of priority instances.
|
||||
*/
|
||||
public IManagedList getPriorities() {
|
||||
return (IManagedList) getAttributeValue(PRIORITIES);
|
||||
}//getPriorities()//
|
||||
/**
|
||||
* Gets the contacts.
|
||||
* @return The collection of contact instances.
|
||||
*/
|
||||
public IManagedList getContacts() {
|
||||
return (IManagedList) getAttributeValue(CONTACTS);
|
||||
}//getContacts()//
|
||||
/**
|
||||
* Closes the view.
|
||||
*/
|
||||
public void doClose() {
|
||||
close();
|
||||
((TestViewApplication) getApplication()).shutdown();
|
||||
}//doClose()//
|
||||
/**
|
||||
* Opens a test dialog.
|
||||
*/
|
||||
public void doOpenDialog1() {
|
||||
TestDialog1ViewController controller = new TestDialog1ViewController(getContext());
|
||||
|
||||
controller.open(this);
|
||||
}//doOpenDialog1()//
|
||||
/**
|
||||
* Opens a test dialog.
|
||||
*/
|
||||
public void doOpenDialog2() {
|
||||
TestDialog2ViewController controller = new TestDialog2ViewController(getContext());
|
||||
|
||||
controller.open(this);
|
||||
}//doOpenDialog2()//
|
||||
/**
|
||||
* Displays the selected test type with the given number of rows.
|
||||
*/
|
||||
public void doDisplayTest() {
|
||||
if(getSelectedTest() != null) {
|
||||
String testType = getSelectedTest();
|
||||
int rowCount = getTestRowCount().intValue();
|
||||
ManagedList collection = new ManagedList(rowCount, 20);
|
||||
AbstractViewController controller = null;
|
||||
|
||||
for(int index = 0; index < rowCount; index++) {
|
||||
collection.add(new Project("Test " + index));
|
||||
}//for//
|
||||
|
||||
if(testType == COLLECTION_TESTS[0]) {
|
||||
controller = new ListPerformanceTestViewController(getContext(), collection, false);
|
||||
}//if//
|
||||
else if(testType == COLLECTION_TESTS[1]) {
|
||||
controller = new EnhancedListPerformanceTestViewController(getContext(), collection, false);
|
||||
}//else if//
|
||||
else if(testType == COLLECTION_TESTS[2]) {
|
||||
controller = new TablePerformanceTestViewController(getContext(), collection, false);
|
||||
}//else if//
|
||||
|
||||
long t = System.currentTimeMillis();
|
||||
setTestController(controller);
|
||||
Debug.log("Time to set the test controller: " + (System.currentTimeMillis() - t) + "ms.");
|
||||
}//if//
|
||||
}//doDisplayTest()//
|
||||
/**
|
||||
* Gets the view controllers displayed in the tab panel.
|
||||
* @return The view controllers displayed in the tab panel.
|
||||
*/
|
||||
public IManagedList getTabViewControllers() {
|
||||
return (IManagedList) getAttributeValue(TAB_VIEW_CONTROLLERS);
|
||||
}//getTabViewControllers()//
|
||||
/**
|
||||
* Gets the tray value.
|
||||
* @return The tray value.
|
||||
*/
|
||||
public TrayController getTray() {
|
||||
return (TrayController) getAttributeValue(TRAY);
|
||||
}//getTray()//
|
||||
/**
|
||||
* Sets the tray value.
|
||||
* @param tray The tray value.
|
||||
*/
|
||||
public void setTray(TrayController tray) {
|
||||
setAttributeValue(TRAY, tray);
|
||||
}//setTray()//
|
||||
/**
|
||||
* Gets the nullAttribute value.
|
||||
* @return The nullAttribute value.
|
||||
*/
|
||||
public String getNullAttribute() {
|
||||
return (String) getAttributeValue(NULL_ATTRIBUTE);
|
||||
}//getNullAttribute()//
|
||||
/**
|
||||
* Sets the nullAttribute value.
|
||||
* @param nullAttribute The nullAttribute value.
|
||||
*/
|
||||
public void setNullAttribute(String nullAttribute) {
|
||||
setAttributeValue(NULL_ATTRIBUTE, nullAttribute);
|
||||
}//setNullAttribute()//
|
||||
/**
|
||||
* Gets the nonNullAttribute value.
|
||||
* @return The nonNullAttribute value.
|
||||
*/
|
||||
public String getNonNullAttribute() {
|
||||
return (String) getAttributeValue(NON_NULL_ATTRIBUTE);
|
||||
}//getNonNullAttribute()//
|
||||
/**
|
||||
* Sets the nonNullAttribute value.
|
||||
* @param nonNullAttribute The nonNullAttribute value.
|
||||
*/
|
||||
public void setNonNullAttribute(String nonNullAttribute) {
|
||||
setAttributeValue(NON_NULL_ATTRIBUTE, nonNullAttribute);
|
||||
}//setNonNullAttribute()//
|
||||
/**
|
||||
* Gets the teams value.
|
||||
* @return The teams value.
|
||||
*/
|
||||
public IManagedList getTeams() {
|
||||
return (IManagedList) getAttributeValue(TEAMS);
|
||||
}//getTeams()//
|
||||
/**
|
||||
* Gets the tests.
|
||||
* @return The tests.
|
||||
*/
|
||||
public String[] getTests() {
|
||||
return (String[]) getAttributeValue(TESTS);
|
||||
}//getTests()//
|
||||
/**
|
||||
* Gets the selected test.
|
||||
* @return The selected test.
|
||||
*/
|
||||
public String getSelectedTest() {
|
||||
return (String) getAttributeValue(SELECTED_TEST);
|
||||
}//getSelectedTest()//
|
||||
/**
|
||||
* Sets the selected test.
|
||||
* @param selectedTest The selected test.
|
||||
*/
|
||||
public void setSelectedTest(String selectedTest) {
|
||||
setAttributeValue(SELECTED_TEST, selectedTest);
|
||||
}//setSelectedTest()//
|
||||
/**
|
||||
* Gets the number of test rows.
|
||||
* @return The collection test's row count.
|
||||
*/
|
||||
public Integer getTestRowCount() {
|
||||
return (Integer) getAttributeValue(TEST_ROW_COUNT);
|
||||
}//getTestRowCount()//
|
||||
/**
|
||||
* Sets the number of test rows.
|
||||
* @param testRowCount The collection test's row count.
|
||||
*/
|
||||
public void setTestRowCount(Integer testRowCount) {
|
||||
setAttributeValue(TEST_ROW_COUNT, testRowCount);
|
||||
}//setTestRowCount()//
|
||||
/**
|
||||
* Gets the testController value.
|
||||
* @return The testController value.
|
||||
*/
|
||||
public AbstractViewController getTestController() {
|
||||
return (AbstractViewController) getAttributeValue(TEST_CONTROLLER);
|
||||
}//getTestController()//
|
||||
/**
|
||||
* Sets the testController value.
|
||||
* @param testController The testController value.
|
||||
*/
|
||||
public void setTestController(AbstractViewController testController) {
|
||||
setAttributeValue(TEST_CONTROLLER, testController);
|
||||
}//setTestController()//
|
||||
}//MainViewController//
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (c) 2006,2007 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import test.local.view.ProjectEditorView;
|
||||
import test.model.Project;
|
||||
|
||||
import com.foundation.metadata.Attribute;
|
||||
import com.foundation.view.ControlDecoration;
|
||||
import com.foundation.view.IViewContext;
|
||||
import com.foundation.view.resource.ResourceReference;
|
||||
|
||||
public class ProjectEditorViewController extends AbstractViewController {
|
||||
public static final Attribute PROJECT = registerAttribute(ProjectEditorViewController.class, "project");
|
||||
private Runnable changeListener;
|
||||
/**
|
||||
* ProjectEditorViewController constructor.
|
||||
* @param context The context underwhich the view is being created. This context manages the threading, resources, and request handling for the view as well as ties together related views.
|
||||
* @param changeListener The optional listener called when changes are applied to the project.
|
||||
* @param project The edited project.
|
||||
*/
|
||||
public ProjectEditorViewController(IViewContext context, Runnable changeListener, Project project) {
|
||||
super(context);
|
||||
this.changeListener = changeListener;
|
||||
setProject((Project) getReflectionManager().createReflection(project));
|
||||
}//ProjectEditorViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return ProjectEditorView.class;
|
||||
}//getViewClass()//
|
||||
/**
|
||||
* Applies changes to the project.
|
||||
*/
|
||||
public void doApply() {
|
||||
synchronize();
|
||||
getReflectionManager().synchronizeAll();
|
||||
|
||||
if(changeListener != null) {
|
||||
changeListener.run();
|
||||
}//if//
|
||||
}//doApply()//
|
||||
/* (non-Javadoc)
|
||||
* @see test.local.view.controller.AbstractViewController#validate()
|
||||
*/
|
||||
public boolean validate() {
|
||||
boolean result = true;
|
||||
|
||||
getDecorationManager().clearDecorations(null, null);
|
||||
|
||||
if((getProject().getName() == null) || (getProject().getName().trim().length() == 0)) {
|
||||
getDecorationManager().addDecoration(getProject(), Project.NAME, new ControlDecoration(new ResourceReference("res://View/ProjectEditor/ErrorOverlay"), "Must provide a name."));
|
||||
result = false;
|
||||
}//if//
|
||||
|
||||
if((getProject().getProgress() == null) || (getProject().getProgress().intValue() < 0) || (getProject().getProgress().intValue() > 100)) {
|
||||
getDecorationManager().addDecoration(getProject(), Project.PROGRESS, new ControlDecoration(new ResourceReference("res://View/ProjectEditor/ErrorOverlay"), "Must be a number between (0..100)."));
|
||||
result = false;
|
||||
}//if//
|
||||
|
||||
getDecorationManager().applyDecorationChanges();
|
||||
|
||||
return result;
|
||||
}//validate()//
|
||||
/**
|
||||
* Rejects changes to the project.
|
||||
*/
|
||||
public void doCancel() {
|
||||
synchronize();
|
||||
getProject().reverseObjectChanges();
|
||||
}//doCancel()//
|
||||
/**
|
||||
* Gets the project being edited.
|
||||
* @return The edited project.
|
||||
*/
|
||||
public Project getProject() {
|
||||
return (Project) getAttributeValue(PROJECT);
|
||||
}//getProject()//
|
||||
/**
|
||||
* Sets the project being edited.
|
||||
* @param project The edited project.
|
||||
*/
|
||||
private void setProject(Project project) {
|
||||
setAttributeValue(PROJECT, project);
|
||||
}//getProject()//
|
||||
}//ProjectEditorViewController//
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2005,2006 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import test.local.view.SampleInnerView;
|
||||
|
||||
import com.foundation.view.IViewContext;
|
||||
|
||||
public class SampleInnerViewController extends AbstractViewController {
|
||||
/**
|
||||
* SampleInnerViewController constructor.
|
||||
* @param viewContext The view context.
|
||||
*/
|
||||
public SampleInnerViewController(IViewContext viewContext) {
|
||||
super(viewContext);
|
||||
}//SampleInnerViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return SampleInnerView.class;
|
||||
}//getViewClass()//
|
||||
}//SampleInnerViewController//
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import test.local.view.StreetAddressEditorView;
|
||||
import test.model.StreetAddress;
|
||||
|
||||
import com.foundation.metadata.Attribute;
|
||||
import com.foundation.view.IViewContext;
|
||||
|
||||
public class StreetAddressEditorViewController extends AbstractViewController {
|
||||
public static final Attribute STREET_ADDRESS = registerAttribute(StreetAddressEditorViewController.class, "streetAddress");
|
||||
private Runnable changeListener;
|
||||
/**
|
||||
* StreetAddressEditorViewController constructor.
|
||||
* @param context The context underwhich the view is being created. This context manages the threading, resources, and request handling for the view as well as ties together related views.
|
||||
* @param changeListener The optional listener called when changes are applied to the street address.
|
||||
* @param streetAddress The edited street address.
|
||||
*/
|
||||
public StreetAddressEditorViewController(IViewContext context, Runnable changeListener, StreetAddress streetAddress) {
|
||||
super(context);
|
||||
this.changeListener = changeListener;
|
||||
setStreetAddress((StreetAddress) getReflectionManager().createReflection(streetAddress));
|
||||
}//StreetAddressEditorViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return StreetAddressEditorView.class;
|
||||
}//getViewClass()//
|
||||
/**
|
||||
* Applies changes to the street address.
|
||||
*/
|
||||
public void doApply() {
|
||||
synchronize();
|
||||
getReflectionManager().synchronizeAll();
|
||||
|
||||
if(changeListener != null) {
|
||||
changeListener.run();
|
||||
}//if//
|
||||
}//doApply()//
|
||||
/**
|
||||
* Rejects changes to the street address.
|
||||
*/
|
||||
public void doCancel() {
|
||||
synchronize();
|
||||
getStreetAddress().reverseObjectChanges();
|
||||
}//doCancel()//
|
||||
/**
|
||||
* Gets the streetAddress being edited.
|
||||
* @return The edited streetAddress.
|
||||
*/
|
||||
public StreetAddress getStreetAddress() {
|
||||
return (StreetAddress) getAttributeValue(STREET_ADDRESS);
|
||||
}//getStreetAddress()//
|
||||
/**
|
||||
* Sets the streetAddress being edited.
|
||||
* @param streetAddress The edited streetAddress.
|
||||
*/
|
||||
private void setStreetAddress(StreetAddress streetAddress) {
|
||||
setAttributeValue(STREET_ADDRESS, streetAddress);
|
||||
}//getStreetAddress()//
|
||||
}//StreetAddressEditorViewController//
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2005,2006 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import com.foundation.metadata.Attribute;
|
||||
import com.foundation.view.IViewContext;
|
||||
import test.local.view.StyledTextPageView;
|
||||
|
||||
public class StyledTextPageViewController extends AbstractViewController {
|
||||
/**
|
||||
* StyledTextPageViewController constructor.
|
||||
* @param context
|
||||
*/
|
||||
public StyledTextPageViewController(IViewContext context) {
|
||||
super(context);
|
||||
}//StyledTextPageViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.common.Entity#lazyLoadAttribute(com.foundation.metadata.Attribute)
|
||||
*/
|
||||
protected Object lazyLoadAttribute(Attribute attribute) {
|
||||
Object result = null;
|
||||
|
||||
result = super.lazyLoadAttribute(attribute);
|
||||
|
||||
return result;
|
||||
}//lazyLoadAttribute()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return StyledTextPageView.class;
|
||||
}//getViewClass()//
|
||||
}//StyledTextPageViewController//
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2005,2007 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import test.local.view.TableEditorPageView;
|
||||
import test.model.Data;
|
||||
|
||||
import com.foundation.metadata.Attribute;
|
||||
import com.foundation.util.IManagedList;
|
||||
import com.foundation.util.ManagedList;
|
||||
import com.foundation.view.IViewContext;
|
||||
|
||||
public class TableEditorPageViewController extends AbstractViewController {
|
||||
public static final Attribute DATA = registerCollection(TableEditorPageViewController.class, "data", AO_LAZY | AO_REFERENCED);
|
||||
/**
|
||||
* TableEditorPageViewController constructor.
|
||||
* @param context The context underwhich the view is being created. This context manages the threading, resources, and request handling for the view as well as ties together related views.
|
||||
*/
|
||||
public TableEditorPageViewController(IViewContext context) {
|
||||
super(context);
|
||||
}//TableEditorPageViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.common.Entity#lazyLoadAttribute(com.foundation.metadata.Attribute)
|
||||
*/
|
||||
protected Object lazyLoadAttribute(Attribute attribute) {
|
||||
Object result = null;
|
||||
|
||||
if(attribute == DATA) {
|
||||
ManagedList list = new ManagedList(10, 20);
|
||||
|
||||
list.add(new Data());
|
||||
list.add(new Data());
|
||||
list.add(new Data());
|
||||
list.add(new Data());
|
||||
result = list;
|
||||
}//if//
|
||||
else {
|
||||
result = super.lazyLoadAttribute(attribute);
|
||||
}//else//
|
||||
|
||||
return result;
|
||||
}//lazyLoadAttribute()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return TableEditorPageView.class;
|
||||
}//getViewClass()//
|
||||
/**
|
||||
* Gets the collection of data displayed in the table.
|
||||
* @return The data.
|
||||
*/
|
||||
public IManagedList getData() {
|
||||
return (IManagedList) getAttributeValue(DATA);
|
||||
}//getData()//
|
||||
}//TableEditorPageViewController//
|
||||
@@ -0,0 +1,235 @@
|
||||
/*
|
||||
* Copyright (c) 2005,2009 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Random;
|
||||
|
||||
import test.local.view.TablePageView;
|
||||
import test.model.Priority;
|
||||
import test.model.Project;
|
||||
|
||||
import com.common.debug.Debug;
|
||||
import com.foundation.controller.ViewController;
|
||||
import com.foundation.metadata.Attribute;
|
||||
import com.foundation.util.IManagedList;
|
||||
import com.foundation.view.HighlightDecoration;
|
||||
import com.foundation.view.IViewContext;
|
||||
import com.foundation.view.ImageDecoration;
|
||||
import com.foundation.view.JefColor;
|
||||
import com.foundation.view.resource.ResourceReference;
|
||||
|
||||
public class TablePageViewController extends AbstractViewController {
|
||||
public static final Attribute PROJECTS = registerCollection(TablePageViewController.class, "projects", AO_REFERENCED);
|
||||
public static final Attribute EDITOR = registerAttribute(TablePageViewController.class, "editor", AO_REFERENCED);
|
||||
public static final Attribute SELECTION = registerAttribute(TablePageViewController.class, "selection", AO_REFERENCED);
|
||||
public static final Attribute PRIORITIES = registerCollection(TablePageViewController.class, "priorities", AO_REFERENCED);
|
||||
public static final Attribute COOL_IMAGE = registerAttribute(TablePageViewController.class, "coolImage", AO_REFERENCED);
|
||||
|
||||
private int counter = 100;
|
||||
/**
|
||||
* TablePageViewController constructor.
|
||||
* @param context The context underwhich the view is being created. This context manages the threading, resources, and request handling for the view as well as ties together related views.
|
||||
* @param projects The collection of displayed projects.
|
||||
* @param priorities The collection of possible priorities for the projects.
|
||||
*/
|
||||
public TablePageViewController(IViewContext context, IManagedList projects, IManagedList priorities) {
|
||||
super(context, true);
|
||||
|
||||
setProjects((IManagedList) getReflectionManager().createReflection(projects));
|
||||
setPriorities((IManagedList) getReflectionManager().createReflection(priorities));
|
||||
setCoolImage(new ResourceReference("res://View/ProjectEditor/CoolImage"));
|
||||
}//TablePageViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.common.Entity#lazyLoadAttribute(com.foundation.metadata.Attribute)
|
||||
*/
|
||||
protected Object lazyLoadAttribute(Attribute attribute) {
|
||||
Object result = null;
|
||||
|
||||
result = super.lazyLoadAttribute(attribute);
|
||||
|
||||
return result;
|
||||
}//lazyLoadAttribute()//
|
||||
public boolean validate() {
|
||||
getDecorationManager().clearDecorations();
|
||||
|
||||
if(getProjects().getSize() > 5) {
|
||||
getDecorationManager().addDecoration(getProjects().get(5), null, new ImageDecoration("res://View/ProjectEditor/ErrorOverlay"));
|
||||
}//if//
|
||||
|
||||
if(getProjects().getSize() > 4) {
|
||||
getDecorationManager().addDecoration(getProjects().get(4), null, new HighlightDecoration(new ResourceReference("res://View/ProjectEditor/ErrorBackgroundColor"), new ResourceReference("res://View/ProjectEditor/ErrorForegroundColor"), new ResourceReference("res://View/ProjectEditor/ErrorFont"), new ResourceReference("res://View/ProjectEditor/ErrorSelectionGradient"), "Broken"));
|
||||
}//if//
|
||||
|
||||
getDecorationManager().applyDecorationChanges();
|
||||
|
||||
return super.validate();
|
||||
}//validate()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return TablePageView.class;
|
||||
}//getViewClass()//
|
||||
/**
|
||||
* Removes all projects.
|
||||
*/
|
||||
public void doRemoveAllProjects() {
|
||||
getProjects().removeAll();
|
||||
}//doRemoveAllProjects()//
|
||||
/**
|
||||
* Removes the selected project.
|
||||
*/
|
||||
public void doRemoveProject() {
|
||||
if(getSelection() != null) {
|
||||
getProjects().remove(getSelection());
|
||||
setSelection(null);
|
||||
}//if//
|
||||
}//doRemoveProject()//
|
||||
/**
|
||||
* Adds a new project.
|
||||
*/
|
||||
public void doAddProject() {
|
||||
Project project = new Project();
|
||||
|
||||
project.setName("Project " + counter++);
|
||||
project.setNote("some note");
|
||||
project.setPriority((Priority) getPriorities().getFirst());
|
||||
project.setProgress(new BigDecimal(new Random().nextInt(101)).divide(new BigDecimal("100")));
|
||||
getProjects().add(project);
|
||||
}//doAddProject()//
|
||||
/**
|
||||
* Handles the project's button being pressed in the table.
|
||||
* @param project The project whose button was pressed.
|
||||
*/
|
||||
public void doProjectButtonPressed(Project project) {
|
||||
Debug.log("Button pressed for project: " + project.getName());
|
||||
}//doProjectButtonPressed()//
|
||||
/**
|
||||
* Gets the collection of projects displayed in the table.
|
||||
* @return The projects.
|
||||
*/
|
||||
public IManagedList getProjects() {
|
||||
return (IManagedList) getAttributeValue(PROJECTS);
|
||||
}//getProjects()//
|
||||
/**
|
||||
* Sets the collection of projects displayed in the table.
|
||||
* @param projects The projects.
|
||||
*/
|
||||
private void setProjects(IManagedList projects) {
|
||||
setAttributeValue(PROJECTS, projects);
|
||||
}//setProjects()//
|
||||
/**
|
||||
* Gets the priorities possible for the projects.
|
||||
* @return The collection of priority instances.
|
||||
*/
|
||||
public IManagedList getPriorities() {
|
||||
return (IManagedList) getAttributeValue(PRIORITIES);
|
||||
}//getPriorities()//
|
||||
/**
|
||||
* Sets the collection of priorities possible for the projects.
|
||||
* @param priorities The priorities allowed.
|
||||
*/
|
||||
private void setPriorities(IManagedList priorities) {
|
||||
setAttributeValue(PRIORITIES, priorities);
|
||||
}//setPriorities()//
|
||||
/**
|
||||
* Gets the editor displayed under the table.
|
||||
* @return The editor or null if no editor is visible.
|
||||
*/
|
||||
public ViewController getEditor() {
|
||||
return (ViewController) getAttributeValue(EDITOR);
|
||||
}//getEditor()//
|
||||
/**
|
||||
* Sets the editor displayed under the table.
|
||||
* @param editor The editor or null if no editor is visible.
|
||||
*/
|
||||
private void setEditor(ViewController editor) {
|
||||
setAttributeValue(EDITOR, editor);
|
||||
}//setEditor()//
|
||||
/**
|
||||
* Gets the coolImage displayed under the table.
|
||||
* @return The coolImage or null if no coolImage is visible.
|
||||
*/
|
||||
public ResourceReference getCoolImage() {
|
||||
return (ResourceReference) getAttributeValue(COOL_IMAGE);
|
||||
}//getCoolImage()//
|
||||
/**
|
||||
* Sets the coolImage displayed under the table.
|
||||
* @param coolImage The coolImage or null if no coolImage is visible.
|
||||
*/
|
||||
private void setCoolImage(ResourceReference coolImage) {
|
||||
setAttributeValue(COOL_IMAGE, coolImage);
|
||||
}//setCoolImage()//
|
||||
/**
|
||||
* Gets the table selection.
|
||||
* @return The selected object in the table.
|
||||
*/
|
||||
public Object getSelection() {
|
||||
return (Object) getAttributeValue(SELECTION);
|
||||
}//getSelection()//
|
||||
/**
|
||||
* Sets the table selection.
|
||||
* @param selection The selected object in the table.
|
||||
*/
|
||||
public void setSelection(Object selection) {
|
||||
if(getSelection() != selection) {
|
||||
setAttributeValue(SELECTION, selection);
|
||||
setupEditor(selection);
|
||||
}//if//
|
||||
}//setSelection()//
|
||||
/**
|
||||
* Clears the selection.
|
||||
*/
|
||||
public void clearSelection() {
|
||||
setSelection(null);
|
||||
}//clearSelection()//
|
||||
/**
|
||||
* Sets up the editor for the given selection.
|
||||
* @param selection The selection whose editor must be setup.
|
||||
*/
|
||||
private void setupEditor(Object selection) {
|
||||
ViewController editor = null;
|
||||
|
||||
if(selection != null) {
|
||||
editor = new ProjectEditorViewController(getContext(), new Runnable() {
|
||||
public void run() {
|
||||
getReflectionManager().synchronizeAll();
|
||||
}//run()//
|
||||
}, (Project) selection);
|
||||
}//if//
|
||||
|
||||
setEditor(editor);
|
||||
}//setupEditor()//
|
||||
/**
|
||||
* Gets a boolean flag for the given project.
|
||||
* @param project The project for which a boolean will be retrieved.
|
||||
* @return The project's boolean.
|
||||
*/
|
||||
public Boolean getFlag(Project project) {
|
||||
return project.getFlag();
|
||||
}//getFlag()//
|
||||
/**
|
||||
* Toggles the flag on the selected object.
|
||||
*/
|
||||
public void toggleFlag() {
|
||||
Object selection = (Object) getSelection();
|
||||
|
||||
if(selection != null && selection instanceof Project) {
|
||||
((Project) selection).setFlag(((Project) selection).getFlag().booleanValue() ? Boolean.FALSE : Boolean.TRUE);
|
||||
}//if//
|
||||
}//toggleFlag()//
|
||||
/**
|
||||
* Gets the color associated with the given object.
|
||||
* @param object The object for which a color will be generated.
|
||||
* @return The object's color.
|
||||
*/
|
||||
public JefColor getObjectColor(Object object) {
|
||||
return new JefColor((object.hashCode() & 0xFF), (object.hashCode() & 0xFF00) >> 8, 255 - ((object.hashCode() & 0xFF00) >> 8));
|
||||
}//getObjectColor()//
|
||||
}//TablePageViewController//
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2009 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import test.local.view.TablePerformanceTestView;
|
||||
|
||||
import com.foundation.metadata.Attribute;
|
||||
import com.foundation.util.IManagedList;
|
||||
import com.foundation.view.IViewContext;
|
||||
import com.foundation.view.ImageDecoration;
|
||||
|
||||
public class TablePerformanceTestViewController extends AbstractViewController {
|
||||
public static final Attribute COLLECTION = registerCollection(TablePerformanceTestViewController.class, "collection", AO_REFERENCED);
|
||||
/**
|
||||
* TablePerformanceTestViewController constructor.
|
||||
* @param context The context under which the view is being created. This context manages the threading, resources, and request handling for the view as well as ties together related views.
|
||||
*/
|
||||
public TablePerformanceTestViewController(IViewContext context, IManagedList collection, boolean reflect) {
|
||||
super(context, true);
|
||||
|
||||
if(reflect) {
|
||||
setCollection((IManagedList) getReflectionManager().createReflection(collection));
|
||||
}//if//
|
||||
else {
|
||||
setCollection(collection);
|
||||
}//else//
|
||||
}//TablePerformanceTestViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return TablePerformanceTestView.class;
|
||||
}//getViewClass()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.declarativeengineering.jetson.view.controller.AbstractViewController#validate()
|
||||
*/
|
||||
public boolean validate() {
|
||||
getDecorationManager().clearDecorations();
|
||||
|
||||
if(getCollection().getSize() > 0) {
|
||||
getDecorationManager().addDecoration(getCollection().getFirst(), null, new ImageDecoration("res://View/ProjectEditor/ErrorOverlay"));
|
||||
}//if//
|
||||
|
||||
getDecorationManager().applyDecorationChanges();
|
||||
|
||||
return false;
|
||||
}//validate()//
|
||||
/**
|
||||
* Gets the collection value.
|
||||
* @return The collection value.
|
||||
*/
|
||||
public IManagedList getCollection() {
|
||||
return (IManagedList) getAttributeValue(COLLECTION);
|
||||
}//getCollection()//
|
||||
/**
|
||||
* Sets the collection value.
|
||||
* @param collection The collection value.
|
||||
*/
|
||||
private void setCollection(IManagedList collection) {
|
||||
setAttributeValue(COLLECTION, collection);
|
||||
}//setCollection()//
|
||||
}//TablePerformanceTestViewController//
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt */
|
||||
package test.local.view.controller;
|
||||
|
||||
import test.local.view.TeamView;
|
||||
|
||||
import com.foundation.util.IManagedList;
|
||||
import com.foundation.view.IViewContext;
|
||||
import com.foundation.metadata.Attribute;
|
||||
|
||||
/**
|
||||
* TeamViewController constructor.
|
||||
* @param context The context under which the view is being created. This context manages the threading, resources, and request handling for the view as well as ties together related views.
|
||||
*/
|
||||
public class TeamViewController extends AbstractViewController {
|
||||
public static final Attribute TEAMS = registerCollection(TeamViewController.class, "teams", AO_REFERENCED);
|
||||
/**
|
||||
* TeamViewController constructor.
|
||||
* @param context The context under which the view is being created. This context manages the threading, resources, and request handling for the view as well as ties together related views.
|
||||
*/
|
||||
public TeamViewController(IViewContext context, IManagedList teams) {
|
||||
super(context);
|
||||
setAttributeValue(TEAMS, getReflectionManager().createReflection(teams));
|
||||
}//TeamViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return TeamView.class;
|
||||
}//getViewClass()//
|
||||
/* (non-Javadoc)
|
||||
* @see com_declarativeengineering_jetson_view_controller.AbstractViewController#validate()
|
||||
*/
|
||||
public boolean validate() {
|
||||
return true;
|
||||
}//validate()//
|
||||
/**
|
||||
* Gets the teams value.
|
||||
* @return The teams value.
|
||||
*/
|
||||
public IManagedList getTeams() {
|
||||
return (IManagedList) getAttributeValue(TEAMS);
|
||||
}//getTeams()//
|
||||
}//TeamViewController//
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import test.local.view.TestDialog1View;
|
||||
|
||||
import com.foundation.util.IManagedList;
|
||||
import com.foundation.util.ManagedList;
|
||||
import com.foundation.view.IViewContext;
|
||||
import com.foundation.metadata.Attribute;
|
||||
|
||||
public class TestDialog1ViewController extends AbstractViewController {
|
||||
public static final Attribute ITEMS = registerCollection(TestDialog1ViewController.class, "items", AO_REFERENCED | AO_LAZY);
|
||||
public static final Attribute SELECTED = registerAttribute(TestDialog1ViewController.class, "selected");
|
||||
/**
|
||||
* TestDialog1ViewController constructor.
|
||||
* @param context
|
||||
*/
|
||||
public TestDialog1ViewController(IViewContext context) {
|
||||
super(context);
|
||||
}//TestDialog1ViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return TestDialog1View.class;
|
||||
}//getViewClass()//
|
||||
/**
|
||||
* Closes the view.
|
||||
*/
|
||||
public void doClose() {
|
||||
close();
|
||||
}//doClose()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.common.Entity#lazyLoadAttribute(com.foundation.metadata.Attribute)
|
||||
*/
|
||||
protected Object lazyLoadAttribute(Attribute attribute) {
|
||||
Object result = null;
|
||||
|
||||
if(attribute == ITEMS) {
|
||||
result = new ManagedList(new String[] {"One", "Two", "Three"});
|
||||
}//if//
|
||||
else {
|
||||
result = super.lazyLoadAttribute(attribute);
|
||||
}//else//
|
||||
|
||||
return result;
|
||||
}//lazyLoadAttribute()//
|
||||
/**
|
||||
* Gets the items value.
|
||||
* @return The items value.
|
||||
*/
|
||||
public IManagedList getItems() {
|
||||
return (IManagedList) getAttributeValue(ITEMS);
|
||||
}//getItems()//
|
||||
/**
|
||||
* Gets the selected value.
|
||||
* @return The selected value.
|
||||
*/
|
||||
public Object getSelected() {
|
||||
return (Object) getAttributeValue(SELECTED);
|
||||
}//getSelected()//
|
||||
/**
|
||||
* Sets the selected value.
|
||||
* @param selected The selected value.
|
||||
*/
|
||||
public void setSelected(Object selected) {
|
||||
setAttributeValue(SELECTED, selected);
|
||||
}//setSelected()//
|
||||
}//TestDialog1ViewController//
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (c) 2008,2009 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import test.local.view.TestDialog2View;
|
||||
|
||||
import com.foundation.metadata.Attribute;
|
||||
import com.foundation.util.IManagedList;
|
||||
import com.foundation.util.ManagedList;
|
||||
import com.foundation.view.ControlDecoration;
|
||||
import com.foundation.view.IViewContext;
|
||||
|
||||
public class TestDialog2ViewController extends AbstractViewController {
|
||||
public static final Attribute ITEMS = registerCollection(TestDialog2ViewController.class, "items", AO_REFERENCED | AO_LAZY);
|
||||
public static final Attribute TEXT = registerAttribute(TestDialog2ViewController.class, "text");
|
||||
/**
|
||||
* TestDialog2ViewController constructor.
|
||||
* @param context
|
||||
*/
|
||||
public TestDialog2ViewController(IViewContext context) {
|
||||
super(context);
|
||||
}//TestDialog2ViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return TestDialog2View.class;
|
||||
}//getViewClass()//
|
||||
/**
|
||||
* Closes the view.
|
||||
*/
|
||||
public void doClose() {
|
||||
close();
|
||||
}//doClose()//
|
||||
/* (non-Javadoc)
|
||||
* @see test.local.view.controller.AbstractViewController#validate()
|
||||
*/
|
||||
public boolean validate() {
|
||||
boolean result = true;
|
||||
|
||||
getDecorationManager().clearDecorations();
|
||||
|
||||
if(getText() == null || getText().trim().length() == 0) {
|
||||
getDecorationManager().addDecoration(this, TEXT, new ControlDecoration("res://View/ProjectEditor/ErrorOverlay", "Must provide a valid product code in the form: XXXX-XXXX-XXXX-XXXX-XXXX"));
|
||||
result = false;
|
||||
}//if//
|
||||
|
||||
getDecorationManager().applyDecorationChanges();
|
||||
|
||||
return result;
|
||||
}//validate()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.common.Entity#lazyLoadAttribute(com.foundation.metadata.Attribute)
|
||||
*/
|
||||
protected Object lazyLoadAttribute(Attribute attribute) {
|
||||
Object result = null;
|
||||
|
||||
if(attribute == ITEMS) {
|
||||
result = new ManagedList(new String[] {"One", "Two", "Three"});
|
||||
}//if//
|
||||
else {
|
||||
result = super.lazyLoadAttribute(attribute);
|
||||
}//else//
|
||||
|
||||
return result;
|
||||
}//lazyLoadAttribute()//
|
||||
/**
|
||||
* Gets the items value.
|
||||
* @return The items value.
|
||||
*/
|
||||
public IManagedList getItems() {
|
||||
return (IManagedList) getAttributeValue(ITEMS);
|
||||
}//getItems()//
|
||||
/**
|
||||
* Gets the text value.
|
||||
* @return The text value.
|
||||
*/
|
||||
public String getText() {
|
||||
return (String) getAttributeValue(TEXT);
|
||||
}//getText()//
|
||||
/**
|
||||
* Sets the text value.
|
||||
* @param text The text value.
|
||||
*/
|
||||
public void setText(String text) {
|
||||
setAttributeValue(TEXT, text);
|
||||
}//setText()//
|
||||
}//TestDialog2ViewController//
|
||||
@@ -0,0 +1,271 @@
|
||||
/*
|
||||
* Copyright (c) 2007,2008 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import test.local.view.TextPageView;
|
||||
|
||||
import com.foundation.metadata.Attribute;
|
||||
import com.foundation.view.ControlDecoration;
|
||||
import com.foundation.view.IViewContext;
|
||||
|
||||
public class TextPageViewController extends AbstractViewController {
|
||||
public static final Attribute TEXT = registerAttribute(TextPageViewController.class, "text", "This is a test.");
|
||||
public static final Attribute BYTE = registerAttribute(TextPageViewController.class, "byte", new Byte((byte) 12));
|
||||
public static final Attribute SHORT = registerAttribute(TextPageViewController.class, "short", new Short((short) -11002));
|
||||
public static final Attribute INTEGER = registerAttribute(TextPageViewController.class, "integer", new Integer(892342012));
|
||||
public static final Attribute LONG = registerAttribute(TextPageViewController.class, "long", new Long(0));
|
||||
public static final Attribute FLOAT = registerAttribute(TextPageViewController.class, "float", new Float(0.123f));
|
||||
public static final Attribute DOUBLE = registerAttribute(TextPageViewController.class, "double", new Double(-12.0000005d));
|
||||
public static final Attribute BIG_DECIMAL = registerAttribute(TextPageViewController.class, "bigDecimal", new BigDecimal("-12.0000005"));
|
||||
public static final Attribute PERCENT = registerAttribute(TextPageViewController.class, "percent", new BigDecimal("10.8"));
|
||||
public static final Attribute CURRENCY = registerAttribute(TextPageViewController.class, "currency", new BigDecimal("112.68"));
|
||||
public static final Attribute TIME = registerAttribute(TextPageViewController.class, "time", null);
|
||||
public static final Attribute DATE = registerAttribute(TextPageViewController.class, "date", null);
|
||||
public static final Attribute CALENDAR = registerAttribute(TextPageViewController.class, "calendar", null);
|
||||
public static final Attribute CUSTOM = registerAttribute(TextPageViewController.class, "custom");
|
||||
/**
|
||||
* TextPageViewController constructor.
|
||||
* @param context The context underwhich the view is being created. This context manages the threading, resources, and request handling for the view as well as ties together related views.
|
||||
* @param projects The collection of displayed projects.
|
||||
*/
|
||||
public TextPageViewController(IViewContext context) {
|
||||
super(context);
|
||||
}//TextPageViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.common.Entity#lazyLoadAttribute(com.foundation.metadata.Attribute)
|
||||
*/
|
||||
protected Object lazyLoadAttribute(Attribute attribute) {
|
||||
Object result = null;
|
||||
|
||||
result = super.lazyLoadAttribute(attribute);
|
||||
|
||||
return result;
|
||||
}//lazyLoadAttribute()//
|
||||
/* (non-Javadoc)
|
||||
* @see test.local.view.controller.AbstractViewController#validate()
|
||||
*/
|
||||
public boolean validate() {
|
||||
boolean result = true;
|
||||
|
||||
getDecorationManager().clearDecorations(null, null);
|
||||
|
||||
if(getText() == null || getText().trim().length() == 0) {
|
||||
getDecorationManager().addDecoration(this, TEXT, new ControlDecoration("res://View/ProjectEditor/ErrorOverlay", "Cannot be empty."));
|
||||
result = false;
|
||||
}//if//
|
||||
|
||||
getDecorationManager().applyDecorationChanges();
|
||||
|
||||
return result;
|
||||
}//validate()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return TextPageView.class;
|
||||
}//getViewClass()//
|
||||
/**
|
||||
* Gets the text value.
|
||||
* @return The text value.
|
||||
*/
|
||||
public String getText() {
|
||||
return (String) getAttributeValue(TEXT);
|
||||
}//getText()//
|
||||
/**
|
||||
* Sets the text value.
|
||||
* @param text The text value.
|
||||
*/
|
||||
public void setText(String text) {
|
||||
setAttributeValue(TEXT, text);
|
||||
}//setText()//
|
||||
/**
|
||||
* Gets the byte value.
|
||||
* @return The byte value.
|
||||
*/
|
||||
public Byte getByte() {
|
||||
return (Byte) getAttributeValue(BYTE);
|
||||
}//getByte()//
|
||||
/**
|
||||
* Sets the byte value.
|
||||
* @param byte The byte value.
|
||||
*/
|
||||
public void setByte(Byte byteValue) {
|
||||
setAttributeValue(BYTE, byteValue);
|
||||
}//setByte()//
|
||||
/**
|
||||
* Gets the short value.
|
||||
* @return The short value.
|
||||
*/
|
||||
public Short getShort() {
|
||||
return (Short) getAttributeValue(SHORT);
|
||||
}//getShort()//
|
||||
/**
|
||||
* Sets the short value.
|
||||
* @param short The short value.
|
||||
*/
|
||||
public void setShort(Short shortValue) {
|
||||
setAttributeValue(SHORT, shortValue);
|
||||
}//setShort()//
|
||||
/**
|
||||
* Gets the integer value.
|
||||
* @return The integer value.
|
||||
*/
|
||||
public Integer getInteger() {
|
||||
return (Integer) getAttributeValue(INTEGER);
|
||||
}//getInteger()//
|
||||
/**
|
||||
* Sets the integer value.
|
||||
* @param integer The integer value.
|
||||
*/
|
||||
public void setInteger(Integer integer) {
|
||||
setAttributeValue(INTEGER, integer);
|
||||
}//setInteger()//
|
||||
/**
|
||||
* Gets the long value.
|
||||
* @return The long value.
|
||||
*/
|
||||
public Long getLong() {
|
||||
return (Long) getAttributeValue(LONG);
|
||||
}//getLong()//
|
||||
/**
|
||||
* Sets the long value.
|
||||
* @param long The long value.
|
||||
*/
|
||||
public void setLong(Long longValue) {
|
||||
setAttributeValue(LONG, longValue);
|
||||
}//setLong()//
|
||||
/**
|
||||
* Gets the float value.
|
||||
* @return The float value.
|
||||
*/
|
||||
public Float getFloat() {
|
||||
return (Float) getAttributeValue(FLOAT);
|
||||
}//getFloat()//
|
||||
/**
|
||||
* Sets the float value.
|
||||
* @param float The float value.
|
||||
*/
|
||||
public void setFloat(Float floatValue) {
|
||||
setAttributeValue(FLOAT, floatValue);
|
||||
}//setFloat()//
|
||||
/**
|
||||
* Gets the double value.
|
||||
* @return The double value.
|
||||
*/
|
||||
public Double getDouble() {
|
||||
return (Double) getAttributeValue(DOUBLE);
|
||||
}//getDouble()//
|
||||
/**
|
||||
* Sets the double value.
|
||||
* @param double The double value.
|
||||
*/
|
||||
public void setDouble(Double doubleValue) {
|
||||
setAttributeValue(DOUBLE, doubleValue);
|
||||
}//setDouble()//
|
||||
/**
|
||||
* Gets the bigDecimal value.
|
||||
* @return The bigDecimal value.
|
||||
*/
|
||||
public BigDecimal getBigDecimal() {
|
||||
return (BigDecimal) getAttributeValue(BIG_DECIMAL);
|
||||
}//getBigDecimal()//
|
||||
/**
|
||||
* Sets the bigDecimal value.
|
||||
* @param bigDecimal The bigDecimal value.
|
||||
*/
|
||||
public void setBigDecimal(BigDecimal bigDecimal) {
|
||||
setAttributeValue(BIG_DECIMAL, bigDecimal);
|
||||
}//setBigDecimal()//
|
||||
/**
|
||||
* Gets the percent value.
|
||||
* @return The percent value.
|
||||
*/
|
||||
public BigDecimal getPercent() {
|
||||
return (BigDecimal) getAttributeValue(PERCENT);
|
||||
}//getPercent()//
|
||||
/**
|
||||
* Sets the percent value.
|
||||
* @param percent The percent value.
|
||||
*/
|
||||
public void setPercent(BigDecimal percent) {
|
||||
setAttributeValue(PERCENT, percent);
|
||||
}//setPercent()//
|
||||
/**
|
||||
* Gets the currency value.
|
||||
* @return The currency value.
|
||||
*/
|
||||
public BigDecimal getCurrency() {
|
||||
return (BigDecimal) getAttributeValue(CURRENCY);
|
||||
}//getCurrency()//
|
||||
/**
|
||||
* Sets the currency value.
|
||||
* @param currency The currency value.
|
||||
*/
|
||||
public void setCurrency(BigDecimal currency) {
|
||||
setAttributeValue(CURRENCY, currency);
|
||||
}//setCurrency()//
|
||||
/**
|
||||
* Gets the time value.
|
||||
* @return The time value.
|
||||
*/
|
||||
public Date getTime() {
|
||||
return (Date) getAttributeValue(TIME);
|
||||
}//getTime()//
|
||||
/**
|
||||
* Sets the time value.
|
||||
* @param time The time value.
|
||||
*/
|
||||
public void setTime(Date time) {
|
||||
setAttributeValue(TIME, time);
|
||||
}//setTime()//
|
||||
/**
|
||||
* Gets the date value.
|
||||
* @return The date value.
|
||||
*/
|
||||
public Date getDate() {
|
||||
return (Date) getAttributeValue(DATE);
|
||||
}//getDate()//
|
||||
/**
|
||||
* Sets the date value.
|
||||
* @param date The date value.
|
||||
*/
|
||||
public void setDate(Date date) {
|
||||
setAttributeValue(DATE, date);
|
||||
}//setDate()//
|
||||
/**
|
||||
* Gets the calendar value.
|
||||
* @return The calendar value.
|
||||
*/
|
||||
public Date getCalendar() {
|
||||
return (Date) getAttributeValue(CALENDAR);
|
||||
}//getCalendar()//
|
||||
/**
|
||||
* Sets the calendar value.
|
||||
* @param calendar The calendar value.
|
||||
*/
|
||||
public void setCalendar(Date calendar) {
|
||||
setAttributeValue(CALENDAR, calendar);
|
||||
}//setCalendar()//
|
||||
/**
|
||||
* Gets the custom value.
|
||||
* @return The custom value.
|
||||
*/
|
||||
public BigDecimal getCustom() {
|
||||
return (BigDecimal) getAttributeValue(CUSTOM);
|
||||
}//getCustom()//
|
||||
/**
|
||||
* Sets the custom value.
|
||||
* @param custom The custom value.
|
||||
*/
|
||||
public void setCustom(BigDecimal custom) {
|
||||
setAttributeValue(CUSTOM, custom);
|
||||
}//setCustom()//
|
||||
}//TextPageViewController//
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2006,2009 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import test.local.view.ToolBarPageView;
|
||||
|
||||
import com.common.debug.Debug;
|
||||
import com.foundation.view.IViewContext;
|
||||
|
||||
public class ToolBarPageViewController extends AbstractViewController {
|
||||
/**
|
||||
* ToolBarPageViewController constructor.
|
||||
* @param viewContext The view context.
|
||||
*/
|
||||
public ToolBarPageViewController(IViewContext context) {
|
||||
super(context);
|
||||
}//ToolBarPageViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return ToolBarPageView.class;
|
||||
}//getViewClass()//
|
||||
public void doPush2Pressed() {
|
||||
Debug.log("Push 2 pressed.");
|
||||
}//doPush2Pressed()//
|
||||
}//ToolBarPageViewController//
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (c) 2007,2009 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import test.local.view.Tray;
|
||||
import test.model.*;
|
||||
|
||||
import com.common.debug.Debug;
|
||||
import com.foundation.util.IManagedCollection;
|
||||
import com.foundation.util.ManagedList;
|
||||
import com.foundation.view.IViewContext;
|
||||
import com.foundation.metadata.Attribute;
|
||||
|
||||
public class TrayController extends AbstractViewController {
|
||||
public static final Attribute COLLECTION = registerCollection(TrayController.class, "collection", AO_REFERENCED | AO_LAZY);
|
||||
/**
|
||||
* TrayController constructor.
|
||||
* @param context
|
||||
*/
|
||||
public TrayController(IViewContext context) {
|
||||
super(context);
|
||||
}//TrayController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.common.Entity#lazyLoadAttribute(com.foundation.metadata.Attribute)
|
||||
*/
|
||||
protected Object lazyLoadAttribute(Attribute attribute) {
|
||||
Object result = null;
|
||||
|
||||
if(attribute == COLLECTION) {
|
||||
IManagedCollection menus = new ManagedList(10, 20);
|
||||
MenuContainer container = new MenuContainer("Cascade 1");
|
||||
|
||||
menus.add(new PushMenu("Push 1"));
|
||||
menus.add(new PushMenu("Push 2"));
|
||||
menus.add(new RadioMenu("Radio 1"));
|
||||
menus.add(new RadioMenu("Radio 2"));
|
||||
menus.add(new CheckMenu("Check 1"));
|
||||
menus.add(new CheckMenu("Check 2"));
|
||||
menus.add(new RadioMenu("Radio 3"));
|
||||
menus.add(new RadioMenu("Radio 4"));
|
||||
menus.add(container);
|
||||
container.getChildren().add(new PushMenu("Push 1"));
|
||||
container.getChildren().add(new PushMenu("Push 2"));
|
||||
container.getChildren().add(new PushMenu("Push 3"));
|
||||
|
||||
result = menus;
|
||||
}//if//
|
||||
else {
|
||||
result = super.lazyLoadAttribute(attribute);
|
||||
}//else//
|
||||
|
||||
return result;
|
||||
}//lazyLoadAttribute()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return Tray.class;
|
||||
}//getViewClass()//
|
||||
public void doSomething() {
|
||||
Debug.log("Tray Menu Selected");
|
||||
}//doSomething()//
|
||||
public void doMenuPressed(PushMenu menu) {
|
||||
Debug.log("Dynamic menu pressed: " + menu.getName());
|
||||
}//doMenuPressed()//
|
||||
/**
|
||||
* Gets the collection value.
|
||||
* @return The collection value.
|
||||
*/
|
||||
public IManagedCollection getCollection() {
|
||||
return (IManagedCollection) getAttributeValue(COLLECTION);
|
||||
}//getCollection()//
|
||||
}//TrayController//
|
||||
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
* Copyright (c) 2005,2007 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package test.local.view.controller;
|
||||
|
||||
import test.local.view.TreePageView;
|
||||
import test.model.Contact;
|
||||
import test.model.EmailAddress;
|
||||
import test.model.Project;
|
||||
import test.model.StreetAddress;
|
||||
|
||||
import com.common.debug.Debug;
|
||||
import com.foundation.controller.ViewController;
|
||||
import com.foundation.metadata.Attribute;
|
||||
import com.foundation.util.IManagedList;
|
||||
import com.foundation.view.IViewContext;
|
||||
import com.foundation.view.JefColor;
|
||||
import com.foundation.view.resource.ResourceReference;
|
||||
|
||||
public class TreePageViewController extends AbstractViewController {
|
||||
public static final Attribute PROJECTS = registerCollection(TreePageViewController.class, "projects", AO_REFERENCED);
|
||||
public static final Attribute EDITOR = registerAttribute(TreePageViewController.class, "editor", AO_REFERENCED);
|
||||
public static final Attribute SELECTION = registerAttribute(TreePageViewController.class, "selection", AO_REFERENCED);
|
||||
public static final Attribute PRIORITIES = registerCollection(TreePageViewController.class, "priorities", AO_REFERENCED);
|
||||
public static final Attribute COOL_IMAGE = registerAttribute(TreePageViewController.class, "coolImage", AO_REFERENCED);
|
||||
/**
|
||||
* TreePageViewController constructor.
|
||||
* @param context The context underwhich the view is being created. This context manages the threading, resources, and request handling for the view as well as ties together related views.
|
||||
* @param projects The collection of displayed projects.
|
||||
* @param priorities The collection of possible priorities for the projects.
|
||||
*/
|
||||
public TreePageViewController(IViewContext context, IManagedList projects, IManagedList priorities) {
|
||||
super(context);
|
||||
|
||||
setProjects((IManagedList) getReflectionManager().createReflection(projects));
|
||||
setPriorities((IManagedList) getReflectionManager().createReflection(priorities));
|
||||
setCoolImage(new ResourceReference("res://View/ProjectEditor/CoolImage"));
|
||||
}//TreePageViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.common.Entity#lazyLoadAttribute(com.foundation.metadata.Attribute)
|
||||
*/
|
||||
protected Object lazyLoadAttribute(Attribute attribute) {
|
||||
Object result = null;
|
||||
|
||||
result = super.lazyLoadAttribute(attribute);
|
||||
|
||||
return result;
|
||||
}//lazyLoadAttribute()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.AbstractViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return TreePageView.class;
|
||||
}//getViewClass()//
|
||||
/**
|
||||
* Gets the coolImage displayed under the table.
|
||||
* @return The coolImage or null if no coolImage is visible.
|
||||
*/
|
||||
public ResourceReference getCoolImage() {
|
||||
return (ResourceReference) getAttributeValue(COOL_IMAGE);
|
||||
}//getCoolImage()//
|
||||
/**
|
||||
* Sets the coolImage displayed under the table.
|
||||
* @param coolImage The coolImage or null if no coolImage is visible.
|
||||
*/
|
||||
private void setCoolImage(ResourceReference coolImage) {
|
||||
setAttributeValue(COOL_IMAGE, coolImage);
|
||||
}//setCoolImage()//
|
||||
/**
|
||||
* Handles the project's button being pressed in the table.
|
||||
* @param project The project whose button was pressed.
|
||||
*/
|
||||
public void doProjectButtonPressed(Project project) {
|
||||
Debug.log("Button pressed for project: " + project.getName());
|
||||
}//doProjectButtonPressed()//
|
||||
/**
|
||||
* Gets the collection of projects displayed in the tree.
|
||||
* @return The projects.
|
||||
*/
|
||||
public IManagedList getProjects() {
|
||||
return (IManagedList) getAttributeValue(PROJECTS);
|
||||
}//getProjects()//
|
||||
/**
|
||||
* Sets the collection of projects displayed in the tree.
|
||||
* @param projects The projects.
|
||||
*/
|
||||
private void setProjects(IManagedList projects) {
|
||||
setAttributeValue(PROJECTS, projects);
|
||||
}//setProjects()//
|
||||
/**
|
||||
* Gets the priorities possible for the projects.
|
||||
* @return The collection of priority instances.
|
||||
*/
|
||||
public IManagedList getPriorities() {
|
||||
return (IManagedList) getAttributeValue(PRIORITIES);
|
||||
}//getPriorities()//
|
||||
/**
|
||||
* Sets the collection of priorities possible for the projects.
|
||||
* @param priorities The priorities allowed.
|
||||
*/
|
||||
private void setPriorities(IManagedList priorities) {
|
||||
setAttributeValue(PRIORITIES, priorities);
|
||||
}//setPriorities()//
|
||||
/**
|
||||
* Gets the editor displayed under the table.
|
||||
* @return The editor or null if no editor is visible.
|
||||
*/
|
||||
public ViewController getEditor() {
|
||||
return (ViewController) getAttributeValue(EDITOR);
|
||||
}//getEditor()//
|
||||
/**
|
||||
* Sets the editor displayed under the table.
|
||||
* @param editor The editor or null if no editor is visible.
|
||||
*/
|
||||
private void setEditor(ViewController editor) {
|
||||
setAttributeValue(EDITOR, editor);
|
||||
}//setEditor()//
|
||||
/**
|
||||
* Gets the table selection.
|
||||
* @return The selected object in the table.
|
||||
*/
|
||||
public Object getSelection() {
|
||||
return (Object) getAttributeValue(SELECTION);
|
||||
}//getSelection()//
|
||||
/**
|
||||
* Sets the table selection.
|
||||
* @param selection The selected object in the table.
|
||||
*/
|
||||
public void setSelection(Object selection) {
|
||||
if(getSelection() != selection) {
|
||||
setAttributeValue(SELECTION, selection);
|
||||
setupEditor(selection);
|
||||
}//if//
|
||||
}//setSelection()//
|
||||
/**
|
||||
* Sets up the editor for the given selection.
|
||||
* @param selection The selection whose editor must be setup.
|
||||
*/
|
||||
private void setupEditor(Object selection) {
|
||||
ViewController editor = null;
|
||||
|
||||
if(selection != null) {
|
||||
if(selection instanceof Project) {
|
||||
editor = new ProjectEditorViewController(getContext(), new Runnable() {
|
||||
public void run() {
|
||||
getReflectionManager().synchronizeAll();
|
||||
}//run()//
|
||||
}, (Project) selection);
|
||||
}//if//
|
||||
else if(selection instanceof Contact) {
|
||||
editor = new ContactEditorViewController(getContext(), new Runnable() {
|
||||
public void run() {
|
||||
getReflectionManager().synchronizeAll();
|
||||
}//run()//
|
||||
}, (Contact) selection);
|
||||
}//else if//
|
||||
else if(selection instanceof EmailAddress) {
|
||||
editor = new EmailAddressEditorViewController(getContext(), new Runnable() {
|
||||
public void run() {
|
||||
getReflectionManager().synchronizeAll();
|
||||
}//run()//
|
||||
}, (EmailAddress) selection);
|
||||
}//else if//
|
||||
else if(selection instanceof StreetAddress) {
|
||||
editor = new StreetAddressEditorViewController(getContext(), new Runnable() {
|
||||
public void run() {
|
||||
getReflectionManager().synchronizeAll();
|
||||
}//run()//
|
||||
}, (StreetAddress) selection);
|
||||
}//else if//
|
||||
}//if//
|
||||
|
||||
setEditor(editor);
|
||||
}//setupEditor()//
|
||||
/**
|
||||
* Gets the color associated with the given object.
|
||||
* @param object The object for which a color will be generated.
|
||||
* @return The object's color.
|
||||
*/
|
||||
public JefColor getObjectColor(Object object) {
|
||||
JefColor result = null;
|
||||
|
||||
if(object instanceof Project) {
|
||||
result = new JefColor(0, 255, 0);
|
||||
}//if//
|
||||
else if(object instanceof Contact) {
|
||||
result = new JefColor(0, 0, 255);
|
||||
}//else if//
|
||||
else if(object instanceof EmailAddress) {
|
||||
result = new JefColor(255, 0, 255);
|
||||
}//else if//
|
||||
else if(object instanceof StreetAddress) {
|
||||
result = new JefColor(255, 255, 0);
|
||||
}//else if//
|
||||
|
||||
return result;
|
||||
}//getObjectColor()//
|
||||
}//TreePageViewController//
|
||||
Reference in New Issue
Block a user