Initial commit from SVN.

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

View File

@@ -0,0 +1,124 @@
/*
* Copyright (c) 2006,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 com.foundation.view.swt.builder;
import com.common.util.IHashMap;
import com.common.util.LiteHashMap;
import com.foundation.view.builder.IViewSourceBuilder;
import com.foundation.view.definition.IComponentData;
public class SpinnerBuilder extends ComponentBuilder {
protected static final String STYLE_WRAP = "wrap";
protected static final String STYLE_READ_ONLY = "read only";
protected static final String PROPERTY_AUTO_SYNCHRONIZE_SELECTION = "auto-synchronize-selection";
protected static final String PROPERTY_AUTO_SYNCHRONIZE_SELECTION_DELAY = "auto-synchronize-selection-delay";
protected static final String PROPERTY_MINIMUM = "minimum";
protected static final String PROPERTY_MAXIMUM = "maximum";
protected static final String PROPERTY_SELECTION = "selection";
protected static final String PROPERTY_INCREMENT = "increment";
protected static final String PROPERTY_PAGE_INCREMENT = "page-increment";
protected static final String ASSOCIATION_MAXIMUM = "maximum";
protected static final String ASSOCIATION_MINIMUM = "minimum";
protected static final String ASSOCIATION_SELECTION = "selection";
protected static final String ASSOCIATION_INCREMENT = "increment";
protected static final String ASSOCIATION_PAGE_INCREMENT = "page-increment";
protected static final IHashMap styleMap = new LiteHashMap(ComponentBuilder.styleMap);
protected static final IHashMap linkMap = new LiteHashMap(ComponentBuilder.linkMap);
static {
styleMap.put(STYLE_WRAP, "STYLE_WRAP");
styleMap.put(STYLE_READ_ONLY, "STYLE_READ_ONLY");
}//static//
/**
* SpinnerBuilder constructor.
*/
public SpinnerBuilder() {
super();
}//SpinnerBuilder()//
/* (non-Javadoc)
* @see com.foundation.view.builder.IBuilder#appendInitializationHead(com.foundation.view.builder.IViewSourceBuilder, StringBuffer, ComponentData)
*/
public void appendInitializationHead(IViewSourceBuilder viewBuilder, StringBuffer buffer, IComponentData data) {
String variableName = viewBuilder.getComponentAttributeName(data);
buffer.append("\t" + variableName + " = new " + getComponentClassName() + "(");
appendComponentConstructorParameters(viewBuilder, buffer, data, "parent");
buffer.append(");\r\n");
buffer.append("\t\r\n");
appendInitializationBody(viewBuilder, buffer, data, variableName);
}//appendInitializationHead()//
/* (non-Javadoc)
* @see com.foundation.view.builder.IBuilder#appendInitializationBody(com.foundation.view.builder.IViewSourceBuilder, java.lang.StringBuffer, com.foundation.view.definition.ComponentData, java.lang.String)
*/
public void appendInitializationBody(IViewSourceBuilder viewBuilder, StringBuffer buffer, IComponentData data, String variableName) {
Integer maximum = (Integer) data.getPropertyValue(PROPERTY_MAXIMUM);
Integer minimum = (Integer) data.getPropertyValue(PROPERTY_MINIMUM);
Integer selection = (Integer) data.getPropertyValue(PROPERTY_SELECTION);
Integer increment = (Integer) data.getPropertyValue(PROPERTY_INCREMENT);
Integer pageIncrement = (Integer) data.getPropertyValue(PROPERTY_PAGE_INCREMENT);
Boolean autoSynchronizeSelection = (Boolean) data.getPropertyValue(PROPERTY_AUTO_SYNCHRONIZE_SELECTION);
Long autoSynchronizeSelectionDelay = (Long) data.getPropertyValue(PROPERTY_AUTO_SYNCHRONIZE_SELECTION_DELAY);
if(maximum != null) {
buffer.append("\t" + variableName + ".setMaximum(new Integer(" + maximum + "));\r\n");
}//if//
if(minimum != null) {
buffer.append("\t" + variableName + ".setMinimum(new Integer(" + minimum + "));\r\n");
}//if//
if(selection != null) {
buffer.append("\t" + variableName + ".setSelection(new Integer(" + selection + "));\r\n");
}//if//
if(increment != null) {
buffer.append("\t" + variableName + ".setIncrement(new Integer(" + increment + "));\r\n");
}//if//
if(pageIncrement != null) {
buffer.append("\t" + variableName + ".setPageIncrement(new Integer(" + pageIncrement + "));\r\n");
}//if//
if(autoSynchronizeSelection != null) {
buffer.append("\t" + variableName + ".setAutoSynchronizeSelection(" + autoSynchronizeSelection + ");\r\n");
}//if//
if(autoSynchronizeSelectionDelay != null) {
buffer.append("\t" + variableName + ".setAutoSynchronizeSelectionDelay(" + autoSynchronizeSelectionDelay + "l);\r\n");
}//if//
appendAssociation(viewBuilder, buffer, data, ASSOCIATION_MAXIMUM, variableName, "setMaximumAssociation", "ASSOCIATION_MAXIMUM", IViewSourceBuilder.ACCESS_TYPE_GET_ONLY);
appendAssociation(viewBuilder, buffer, data, ASSOCIATION_MINIMUM, variableName, "setMinimumAssociation", "ASSOCIATION_MINIMUM", IViewSourceBuilder.ACCESS_TYPE_GET_ONLY);
appendAssociation(viewBuilder, buffer, data, ASSOCIATION_SELECTION, variableName, "setSelectionAssociation", "ASSOCIATION_SELECTION", IViewSourceBuilder.ACCESS_TYPE_BOTH);
appendAssociation(viewBuilder, buffer, data, ASSOCIATION_INCREMENT, variableName, "setIncrementAssociation", "ASSOCIATION_INCREMENT", IViewSourceBuilder.ACCESS_TYPE_GET_ONLY);
appendAssociation(viewBuilder, buffer, data, ASSOCIATION_PAGE_INCREMENT, variableName, "setPageIncrementAssociation", "ASSOCIATION_PAGE_INCREMENT", IViewSourceBuilder.ACCESS_TYPE_GET_ONLY);
super.appendInitializationBody(viewBuilder, buffer, data, variableName);
}//appendInitializationBody()//
/* (non-Javadoc)
* @see com.foundation.view.builder.IBuilder#getComponentClassName()
*/
public String getComponentClassName() {
return "com.foundation.view.swt.Spinner";
}//getComponentClassName()//
/* (non-Javadoc)
* @see com.foundation.view.swt.builder.AbstractBuilder#getStyleMap()
*/
public IHashMap getStyleMap() {
return styleMap;
}//getStyleMap()//
/* (non-Javadoc)
* @see com.foundation.view.swt.builder.AbstractBuilder#getLinkMap()
*/
public IHashMap getLinkMap() {
return linkMap;
}//getLinkMap()//
}//SpinnerBuilder//