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,92 @@
/*
* Copyright (c) 2004,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 com.foundation.view.swt.builder;
import com.foundation.view.builder.*;
import com.foundation.view.definition.*;
public class RowLayoutDataBuilder extends AbstractLayoutBuilder {
protected static final String ALIGNMENT_BEGINNING = "beginning";
protected static final String ALIGNMENT_CENTER = "center";
protected static final String ALIGNMENT_END = "end";
protected static final String ALIGNMENT_FILL = "fill";
protected static final String PROPERTY_WIDTH = "width";
protected static final String PROPERTY_HEIGHT = "height";
protected static final String PROPERTY_EXCLUDE = "exclude";
protected static final String PROPERTY_ALIGNMENT = "horizontal-alignment";
/**
* RowLayoutDataBuilder constructor.
*/
public RowLayoutDataBuilder() {
super();
}//RowLayoutDataBuilder()//
/* (non-Javadoc)
* @see com.foundation.view.builder.IBuilder#appendInitializationHead(com.foundation.view.builder.IViewSourceBuilder, java.lang.StringBuffer, com.foundation.view.definition.ComponentData)
*/
public void appendInitializationHead(IViewSourceBuilder viewBuilder, StringBuffer buffer, IComponentData data) {
Integer width = (Integer) data.getPropertyValue(PROPERTY_WIDTH);
Integer height = (Integer) data.getPropertyValue(PROPERTY_HEIGHT);
Boolean exclude = (Boolean) data.getPropertyValue(PROPERTY_EXCLUDE);
String alignment = (String) data.getPropertyValue(PROPERTY_ALIGNMENT);
buffer.append("\t\t" + getComponentClassName() + " layoutData = new " + getComponentClassName() + "();\r\n");
buffer.append("\t\t\r\n");
if(height != null) {
buffer.append("\t\tlayoutData.height = " + height + ";\r\n");
}//if//
if(width != null) {
buffer.append("\t\tlayoutData.width = " + width + ";\r\n");
}//if//
if(exclude != null) {
buffer.append("\tlayout.exclude = " + exclude + ";\r\n");
}//if//
if(alignment != null) {
alignment = getAlignmentSource(alignment);
if(alignment != null) {
buffer.append("\t\tlayoutData.alignment = " + getComponentClassName() + "." + alignment + ";\r\n");
}//if//
}//if//
buffer.append("\t\t" + viewBuilder.getComponentAttributeName(data.getParent()) + ".setLayoutData(layoutData);\r\n");
}//appendInitializationHead()//
/**
* Converts the alignment identifier string into the necessary source code.
* @param alignment The string identifying which alignment to use.
* @return The source code specifying which alignment.
*/
protected String getAlignmentSource(String alignment) {
String source = null;
if(ALIGNMENT_BEGINNING.equals(alignment)) {
source = "BEGINNING";
}//if//
else if(ALIGNMENT_CENTER.equals(alignment)) {
source = "CENTER";
}//else if//
else if(ALIGNMENT_END.equals(alignment)) {
source = "END";
}//else if//
else if(ALIGNMENT_FILL.equals(alignment)) {
source = "FILL";
}//else if//
return source;
}//getAlignmentSource()//
/* (non-Javadoc)
* @see com.foundation.view.builder.IBuilder#getComponentClassName()
*/
public String getComponentClassName() {
return "com.foundation.view.swt.layout.RowData";
}//getComponentClassName()//
}//RowLayoutDataBuilder//