Initial commit from SVN.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package com.foundation.tcv.swt.client.controller;
|
||||
|
||||
import com.foundation.attribute.ReflectionContext;
|
||||
import com.foundation.view.IViewContext;
|
||||
|
||||
/**
|
||||
* Copyright Wynne Crisman 2005<p>
|
||||
*/
|
||||
public abstract class AbstractViewController extends com.foundation.controller.ViewController {
|
||||
/**
|
||||
* AbstractViewController constructor.
|
||||
* @param context
|
||||
*/
|
||||
public AbstractViewController(IViewContext context) {
|
||||
super(context);
|
||||
}//AbstractViewController()//
|
||||
/**
|
||||
* AbstractViewController constructor.
|
||||
* @param context
|
||||
* @param reflectionContext
|
||||
*/
|
||||
public AbstractViewController(IViewContext context, ReflectionContext reflectionContext) {
|
||||
super(context, reflectionContext);
|
||||
}//AbstractViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.common.IEntity#getApplication()
|
||||
*/
|
||||
public com.foundation.application.IApplication getApplication() {
|
||||
return com.foundation.tcv.client.application.AbstractClientApplication.getSingleton();
|
||||
}//getApplication()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.ViewController#validate()
|
||||
*/
|
||||
public boolean validate() {
|
||||
return true;
|
||||
}//validate()//
|
||||
}//AbstractViewController//
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.foundation.tcv.swt.client.controller;
|
||||
|
||||
import com.foundation.metadata.Attribute;
|
||||
import com.foundation.view.IViewContext;
|
||||
|
||||
/**
|
||||
* Copyright Wynne Crisman 2003<p>
|
||||
* TODO: Could add a retry button to this view?
|
||||
*/
|
||||
public class ConnectionErrorViewController extends AbstractViewController {
|
||||
public static final Attribute ERROR_TEXT = registerAttribute(ConnectionErrorViewController.class, "errorText", AO_LAZY);
|
||||
/**
|
||||
* ConnectionErrorViewController constructor.
|
||||
* @param context
|
||||
*/
|
||||
public ConnectionErrorViewController(IViewContext context) {
|
||||
super(context);
|
||||
}//ConnectionErrorViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.ViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return com.foundation.tcv.swt.client.view.ConnectionErrorView.class;
|
||||
}//getViewClass()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.common.Entity#lazyLoadAttribute(com.foundation.metadata.Attribute)
|
||||
*/
|
||||
protected Object lazyLoadAttribute(Attribute attribute) {
|
||||
Object result = null;
|
||||
|
||||
if(attribute == ERROR_TEXT) {
|
||||
result = "The client was unable to make a connection to the server. Please check your internet connection and try the application at a later time. My may contact the application provider for furthor error resolution.";
|
||||
}//if//
|
||||
else {
|
||||
result = super.lazyLoadAttribute(attribute);
|
||||
}//else//
|
||||
|
||||
return result;
|
||||
}//lazyLoadAttribute()//
|
||||
/**
|
||||
* Gets the license information to be displayed.
|
||||
* @return The license information displayed when an application is being run without a valid license.
|
||||
*/
|
||||
public String getErrorText() {
|
||||
return (String) getAttributeValue(ERROR_TEXT);
|
||||
}//getErrorText()//
|
||||
/**
|
||||
* Closes the view.
|
||||
*/
|
||||
public void doClose() {
|
||||
//Close the window.//
|
||||
close();
|
||||
}//doClose()//
|
||||
}//ConnectionErrorViewController//
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.foundation.tcv.swt.client.controller;
|
||||
|
||||
import com.foundation.metadata.Attribute;
|
||||
import com.foundation.view.IViewContext;
|
||||
|
||||
/**
|
||||
* Copyright Wynne Crisman 2003<p>
|
||||
* Tracks the download of a new client version and displays the current progress.
|
||||
* <p>TODO: Could allow pausing and cancelling... resume would be automatic upon the next download attempt.
|
||||
*/
|
||||
public class DownloadProgressViewController extends AbstractViewController {
|
||||
public static final Attribute MESSAGE = registerAttribute(DownloadProgressViewController.class, "message", AO_LAZY);
|
||||
public static final Attribute PROGRESS = registerAttribute(DownloadProgressViewController.class, "progress");
|
||||
/**
|
||||
* DownloadProgressViewController constructor.
|
||||
* @param context
|
||||
*/
|
||||
public DownloadProgressViewController(IViewContext context) {
|
||||
super(context);
|
||||
}//DownloadProgressViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.ViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return com.foundation.tcv.swt.client.view.DownloadProgressView.class;
|
||||
}//getViewClass()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.common.Entity#lazyLoadAttribute(com.foundation.metadata.Attribute)
|
||||
*/
|
||||
protected Object lazyLoadAttribute(Attribute attribute) {
|
||||
Object result = null;
|
||||
|
||||
if(attribute == MESSAGE) {
|
||||
result = "The client is currently downloading an update for use with the requested application. The application will automatically start after the download is completed.";
|
||||
}//if//
|
||||
else {
|
||||
result = super.lazyLoadAttribute(attribute);
|
||||
}//else//
|
||||
|
||||
return result;
|
||||
}//lazyLoadAttribute()//
|
||||
/**
|
||||
* Closes the view.
|
||||
*/
|
||||
public void doClose() {
|
||||
//Close the window.//
|
||||
close();
|
||||
}//doClose()//
|
||||
/**
|
||||
* Requests that the download be canceled.
|
||||
*/
|
||||
public void doCancel() {
|
||||
//TODO: Cancel the download..
|
||||
|
||||
}//doCancel()//
|
||||
/**
|
||||
* Gets the message displayed to the user.
|
||||
* @return The displayed message.
|
||||
*/
|
||||
public String getMessage() {
|
||||
return (String) getAttributeValue(MESSAGE);
|
||||
}//getMessage()//
|
||||
/**
|
||||
* Sets the message displayed to the user.
|
||||
* @param message The displayed message.
|
||||
*/
|
||||
public void setMessage(String message) {
|
||||
setAttributeValue(MESSAGE, message);
|
||||
}//setMessage()//
|
||||
/**
|
||||
* Gets the current progress percentage.
|
||||
* @return The percentage (0-100) representing the current task progress.
|
||||
*/
|
||||
public Integer getProgress() {
|
||||
return (Integer) getAttributeValue(PROGRESS);
|
||||
}//getProgress()//
|
||||
/**
|
||||
* Sets the current progress percentage.
|
||||
* @param progress The percentage (0-100) representing the current task progress.
|
||||
*/
|
||||
public void setProgress(Integer progress) {
|
||||
setAttributeValue(PROGRESS, progress);
|
||||
}//setProgress()//
|
||||
}//DownloadProgressViewController//
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.foundation.tcv.swt.client.controller;
|
||||
|
||||
import com.foundation.view.IView;
|
||||
import com.foundation.view.IViewContext;
|
||||
import com.foundation.metadata.Attribute;
|
||||
|
||||
/**
|
||||
* Copyright Wynne Crisman 2003<p>
|
||||
* Displays the license terms similar to how a shareware application will. If the license window is closed, so is the application.
|
||||
* This allows testing and development, but makes deployment difficult without a license.
|
||||
*/
|
||||
public class LicenseSplashViewController extends AbstractViewController {
|
||||
public static final Attribute LICENSE_INFORMATION = registerAttribute(LicenseSplashViewController.class, "licenseInformation", AO_LAZY);
|
||||
private static final String emailAddress = "wcrisman@softwarezealot.com"; //TODO: Extract this.//
|
||||
/**
|
||||
* LicenseSplashViewController constructor.
|
||||
* @param context
|
||||
*/
|
||||
public LicenseSplashViewController(IViewContext context) {
|
||||
super(context);
|
||||
}//LicenseSplashViewController()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.ViewController#getViewClass()
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
return com.foundation.tcv.swt.client.view.LicenseSplashView.class;
|
||||
}//getViewClass()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.common.Entity#lazyLoadAttribute(com.foundation.metadata.Attribute)
|
||||
*/
|
||||
protected Object lazyLoadAttribute(Attribute attribute) {
|
||||
Object result = null;
|
||||
|
||||
if(attribute == LICENSE_INFORMATION) {
|
||||
result = "The application you are currently using is not licensed. A valid license is required for deployment of any application using this product. To obtain a valid license please send email to: " + emailAddress;
|
||||
}//if//
|
||||
else {
|
||||
result = super.lazyLoadAttribute(attribute);
|
||||
}//else//
|
||||
|
||||
return result;
|
||||
}//lazyLoadAttribute()//
|
||||
/**
|
||||
* Gets the license information to be displayed.
|
||||
* @return The license information displayed when an application is being run without a valid license.
|
||||
*/
|
||||
public String getLicenseInformation() {
|
||||
return (String) getAttributeValue(LICENSE_INFORMATION);
|
||||
}//getLicenseInformation()//
|
||||
/**
|
||||
* Closes the license window.
|
||||
*/
|
||||
public void doClose() {
|
||||
//Close the window.//
|
||||
close();
|
||||
//Shutdown the application if the license message is not kept open.//
|
||||
((com.foundation.application.Application) getApplication()).shutdown();
|
||||
}//doClose()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.controller.ViewController#postOpenInitialization(com.foundation.view.IView)
|
||||
*/
|
||||
protected void postOpenInitialization(IView view) {
|
||||
((com.foundation.tcv.swt.client.view.LicenseSplashView) view).center();
|
||||
super.postOpenInitialization(view);
|
||||
}//postOpenInitialization()//
|
||||
}//LicenseSplashViewController//
|
||||
Reference in New Issue
Block a user