/* * Copyright (c) 2003,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.common.util.*; import com.foundation.controller.*; import com.foundation.view.builder.*; import com.foundation.view.definition.*; public class WindowBuilder extends FrameBuilder { protected static final String STYLE_MODELESS = "modeless"; protected static final String STYLE_PRIMARY_MODAL = "primary modal"; protected static final String STYLE_APPLICATION_MODAL = "application modal"; protected static final String STYLE_SYSTEM_MODAL = "system modal"; protected static final IHashMap styleMap = new LiteHashMap(FrameBuilder.styleMap); protected static final IHashMap linkMap = new LiteHashMap(FrameBuilder.linkMap); static { styleMap.put(STYLE_MODELESS, "STYLE_MODELESS"); styleMap.put(STYLE_PRIMARY_MODAL, "STYLE_PRIMARY_MODAL"); styleMap.put(STYLE_APPLICATION_MODAL, "STYLE_APPLICATION_MODAL"); styleMap.put(STYLE_SYSTEM_MODAL, "STYLE_SYSTEM_MODAL"); }//static// /** * Window constructor. */ public WindowBuilder() { super(); }//WindowBuilder()// /* (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) { super.appendInitializationBody(viewBuilder, buffer, data, variableName); }//appendInitializationBody()// /* (non-Javadoc) * @see com.foundation.view.builder.IBuilder#getComponentClassName() */ public String getComponentClassName() { return "com.foundation.view.swt.Window"; }//getComponentClassName()// /* (non-Javadoc) * @see com.foundation.view.builder.IBuilder#buildConstructors(com.foundation.view.builder.IViewSourceBuilder, java.lang.StringBuffer, java.lang.String, com.foundation.view.definition2.ComponentData) */ public void buildConstructors(IViewSourceBuilder viewBuilder, StringBuffer constructor, String className, IComponentData data) { String componentName = viewBuilder.addComponentNameIdentifier(data.getDocumentElement(), viewBuilder.getComponentName(data)); constructor.append("/**\r\n"); constructor.append(" * "); constructor.append(className); constructor.append(" constructor.\r\n"); constructor.append(" * @param controller The view controller which will be assigned to the value holder(s) that don't depend on another value holder for their value.\r\n"); constructor.append(" */\r\n"); constructor.append("public "); constructor.append(className); constructor.append("("); constructor.append(ViewController.class.getName()); constructor.append(" controller) {\r\n"); constructor.append("\tsuper("); appendComponentConstructorParameters(viewBuilder, constructor, data, "(" + ViewController.class.getName() + ") controller.getParent()", componentName); constructor.append(", controller.getContext(), controller"); constructor.append(");\r\n\r\n"); //constructor.append("\tsetController(controller);\r\n"); constructor.append("}//" + className + "()//\r\n"); }//buildConstructors()// /* (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()// }//WindowBuilder//