Initial commit from SVN.
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* 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.*;
|
||||
import com.foundation.view.swt.*;
|
||||
import com.foundation.view.builder.*;
|
||||
import com.foundation.view.definition.*;
|
||||
|
||||
public class CoolBarBuilder extends ComponentBuilder {
|
||||
protected static final String STYLE_FLAT = "flat";
|
||||
|
||||
protected static final String COMPONENT_COOL_ITEM = "cool-item";
|
||||
|
||||
protected static final IHashMap styleMap = new LiteHashMap(ContainerBuilder.styleMap);
|
||||
protected static final IHashMap linkMap = new LiteHashMap(ContainerBuilder.linkMap);
|
||||
|
||||
static {
|
||||
styleMap.put(STYLE_FLAT, "STYLE_FLAT");
|
||||
}//static//
|
||||
/**
|
||||
* CoolBarBuilder constructor.
|
||||
*/
|
||||
public CoolBarBuilder() {
|
||||
super();
|
||||
}//CoolBarBuilder()//
|
||||
/* (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);
|
||||
|
||||
//Write out the constructor here only if this is not the primary component for the view.//
|
||||
if(!viewBuilder.getPrimaryComponent().equals(data)) {
|
||||
buffer.append("\t" + variableName + " = new " + getComponentClassName() + "(");
|
||||
appendComponentConstructorParameters(viewBuilder, buffer, data, "parent");
|
||||
buffer.append(");\r\n");
|
||||
buffer.append("\t\r\n");
|
||||
}//if//
|
||||
|
||||
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) {
|
||||
IList components = new LiteList(10, 20);
|
||||
IIterator itemIterator = null;
|
||||
|
||||
//Search for all sub-parts that extend the cool-item type.//
|
||||
data.getComponents(components, COMPONENT_COOL_ITEM, true);
|
||||
itemIterator = components.iterator();
|
||||
|
||||
//Call the initialize method on the contained cool items.//
|
||||
while(itemIterator.hasNext()) {
|
||||
IComponentData next = (IComponentData) itemIterator.next();
|
||||
String initializeMethodName = viewBuilder.addInitializeComponentMethod(next);
|
||||
|
||||
buffer.append('\t');
|
||||
buffer.append(initializeMethodName);
|
||||
buffer.append('(');
|
||||
buffer.append(variableName);
|
||||
buffer.append(");\r\n");
|
||||
}//while//
|
||||
|
||||
super.appendInitializationBody(viewBuilder, buffer, data, variableName);
|
||||
}//appendInitializationBody()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.foundation.view.builder.IBuilder#getComponentClassName()
|
||||
*/
|
||||
public String getComponentClassName() {
|
||||
return "com.foundation.view.swt.CoolBar";
|
||||
}//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()//
|
||||
}//TabPanelBuilder//
|
||||
Reference in New Issue
Block a user