Files
Brainstorm/Foundation View Builder/src/com/foundation/view/builder/IViewSourceBuilder.java
2014-05-30 10:31:51 -07:00

302 lines
17 KiB
Java

/*
* 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.builder;
import com.common.util.IList;
import com.foundation.util.xml.IElement;
import com.foundation.view.definition.*;
/**
* Defines the view source code builder methods.
*/
public interface IViewSourceBuilder {
public static final String COMMON_PROPERTY_NAME = "name";
public static final String VALUE_HOLDER_PROPERTY_TYPE = "type";
public static final String COMMON_TYPE_NAME_VALUE_HOLDER = "value-holder";
public static final String COMMON_TYPE_NAME_LAYOUT = "layout";
public static final String COMMON_TYPE_NAME_LAYOUT_DATA = "layout-data";
public static final byte ACCESS_TYPE_BOTH = 0;
public static final byte ACCESS_TYPE_SET_ONLY = 1;
public static final byte ACCESS_TYPE_GET_ONLY = 2;
public static final String MODIFIER_ALT = "alt";
public static final String MODIFIER_SHIFT = "shift";
public static final String MODIFIER_CTRL = "ctrl";
public static final String MODIFIER_CONTROL = "control";
public static final String MODIFIER_COMMAND = "command";
public static final String MODIFIER_MODIFIER_1 = "mod1";
public static final String MODIFIER_MODIFIER_2 = "mod2";
public static final String MODIFIER_MODIFIER_3 = "mod3";
public static final String MODIFIER_MODIFIER_4 = "mod4";
public static final String ACCELERATOR_KEY_BACK_SPACE = "backspace";
public static final String ACCELERATOR_KEY_CARRIAGE_RETURN = "return";
public static final String ACCELERATOR_KEY_DELETE = "delete";
public static final String ACCELERATOR_KEY_ESCAPE = "escape";
public static final String ACCELERATOR_KEY_LINE_FEED = "linefeed";
public static final String ACCELERATOR_KEY_TAB = "tab";
public static final String ACCELERATOR_KEY_ARROW_UP = "up";
public static final String ACCELERATOR_KEY_ARROW_DOWN = "down";
public static final String ACCELERATOR_KEY_ARROW_LEFT = "left";
public static final String ACCELERATOR_KEY_ARROW_RIGHT = "right";
public static final String ACCELERATOR_KEY_PAGE_UP = "pageup";
public static final String ACCELERATOR_KEY_PAGE_DOWN = "pagedown";
public static final String ACCELERATOR_KEY_HOME = "home";
public static final String ACCELERATOR_KEY_END = "end";
public static final String ACCELERATOR_KEY_INSERT = "insert";
public static final String ACCELERATOR_KEY_F1 = "f1";
public static final String ACCELERATOR_KEY_F2 = "f2";
public static final String ACCELERATOR_KEY_F3 = "f3";
public static final String ACCELERATOR_KEY_F4 = "f4";
public static final String ACCELERATOR_KEY_F5 = "f5";
public static final String ACCELERATOR_KEY_F6 = "f6";
public static final String ACCELERATOR_KEY_F7 = "f7";
public static final String ACCELERATOR_KEY_F8 = "f8";
public static final String ACCELERATOR_KEY_F9 = "f9";
public static final String ACCELERATOR_KEY_F10 = "f10";
public static final String ACCELERATOR_KEY_F11 = "f11";
public static final String ACCELERATOR_KEY_F12 = "f12";
public static final int TYPE_NUMBER_STRING = 0;
public static final int TYPE_NUMBER_BOOLEAN = 1;
public static final int TYPE_NUMBER_BYTE = 2;
public static final int TYPE_NUMBER_SHORT = 3;
public static final int TYPE_NUMBER_INTEGER = 4;
public static final int TYPE_NUMBER_LONG = 5;
public static final int TYPE_NUMBER_FLOAT = 6;
public static final int TYPE_NUMBER_DOUBLE = 7;
public static final int TYPE_NUMBER_DATE = 8;
public static final int TYPE_NUMBER_BIG_DECIMAL = 9;
public static final Integer TYPE_STRING = new Integer(TYPE_NUMBER_STRING);
public static final Integer TYPE_BOOLEAN = new Integer(TYPE_NUMBER_BOOLEAN);
public static final Integer TYPE_BYTE = new Integer(TYPE_NUMBER_BYTE);
public static final Integer TYPE_SHORT = new Integer(TYPE_NUMBER_SHORT);
public static final Integer TYPE_INTEGER = new Integer(TYPE_NUMBER_INTEGER);
public static final Integer TYPE_LONG = new Integer(TYPE_NUMBER_LONG);
public static final Integer TYPE_FLOAT = new Integer(TYPE_NUMBER_FLOAT);
public static final Integer TYPE_DOUBLE = new Integer(TYPE_NUMBER_DOUBLE);
public static final Integer TYPE_DATE = new Integer(TYPE_NUMBER_DATE);
public static final Integer TYPE_BIG_DECIMAL = new Integer(TYPE_NUMBER_BIG_DECIMAL);
/**
* Creates and adds an attribute association identifier to the class.
* @param element The element in the view definition that corresponds to the identifier being created. This allows for better debugging.
* @param componentName The name of the component defining the attribute association.
* @param useageName The unique (within the component) name of the attribute's usage.
* @return The identifier name which can be placed in the code to reference the attribute association.
*/
public String addAttributeAssociationIdentifier(IElement element, String componentName, String useageName);
/**
* Adds a view attribute for a view component using the component name as the attribute name.
* @param componentData The component data used to get the component name.
* @param builder The builder for the component necessary to get the component's class name.
*/
public void addComponentAttribute(IComponentData componentData, IBuilder builder);
/**
* Adds an attribute to the generated source code.
* @param typeName The qualified class name for the attribute.
* @param attributeName The attribute's name.
*/
public void addAttribute(String typeName, String attributeName);
/**
* Creates and adds a component name identifier to the class.
* @param element The element in the view definition that corresponds to the identifier being created. This allows for better debugging.
* @param componentName The name of the component defining the component name.
* @return The identifier name which can be placed in the code to reference the component name.
*/
public String addComponentNameIdentifier(IElement element, String componentName);
/**
* Creates and adds a public identifier to the class.
* @param element The element in the view definition that corresponds to the identifier being created. This allows for better debugging.
* @param name The identifier name. This can be in mixed case and can mix underscores with variable style naming convensions. The name will be 'fixed' so that it is all in upper case with underscores.
* @param value The identifier value. This can currently only be an Integer or a String.
* @param isPrimitive Whether the identifier value is supposed to be primitive.
* @return The identifier name which can be placed in the code to reference the identifier.
*/
public String addPublicIdentifier(IElement element, String name, Object value, boolean isPrimitive);
/**
* Adds a key binding identifier to the source output.
* @param part The key part requesting the identifier.
* @param componentName The component's name.
* @param useageName The usage name which includes junk to make it unique within the usage context. This may be null.
* @return The identifier that can be used.
*/
public String addKeyBindingIdentifier(IKeyPart part, String componentName, String useageName);
/**
* Adds the direct attribute handler case statements to the collection of such handlers.
* @param component The component adding the attribute association.
* @param attributeIdentifier The attribute reference's identifier.
* @param attributeReference The attribute related information.
* @param defaultAttributeType The qualified class name the control will assume for the attribute if no other is specified.
* @param accessType An identifier indicating whether the attribute is set only, get only, or both.
*/
public void addDirectAttributeHandler(IComponentData component, String attributeIdentifier, IAttributePart attributeReference, String defaultAttributeType, byte accessType);
/**
* Adds the direct method handler case statements to the collection of such handlers.
* @param component The component adding the method reference.
* @param methodIdentifier The method reference's identifier.
* @param methodReference The method reference.
*/
public void addDirectMethodHandler(IComponentData component, String methodIdentifier, IMethodPart methodReference);
/**
* Adds the direct key handler case statements to the collection of such handlers.
* @param component The component adding the key.
* @param identifier The key's identifier.
* @param part The part requiring the handler.
*/
public void addDirectKeyHandler(IComponentData component, String identifier, IKeyPart part);
/**
* Adds a method to the view to initialize a view component.
* @param component The component to be initialized by the method.
* @return The method name so that the containing component's initialization code can call it.
*/
public String addInitializeComponentMethod(IComponentData component);
/**
* Adds a method to the view to initialize a view component.
* @param component The component to be initialized by the method.
* @param parameterTypeName The type name for the initialize method's parameter.
* @return The method name so that the containing component's initialization code can call it.
*/
public String addInitializeComponentMethod(IComponentData component, String parameterTypeName);
/**
* Adds a method to the view to initialize a menu.
* @param component The component that contains the menu.
* @param menu The menu to be initialized by the method.
* @param menuPartName The text that best describes the menu's function. Most often this should be "MenuBar" or "PopupMenu".
* @return The method name so that the containing component's initialization code can call it.
*/
public String addInitializeMenuMethod(IComponentData component, IComponentData menu, String menuPartName);
/**
* Creates and adds an method association identifier to the class.
* @param element The element in the view definition that corresponds to the identifier being created. This allows for better debugging.
* @param componentName The name of the component defining the method association.
* @param useageName The unique (within the component) name of the method's usage.
* @return The identifier name which can be placed in the code to reference the method association.
*/
public String addMethodAssociationIdentifier(IElement element, String componentName, String useageName);
/**
* Appends the link source for a specific link.
* @param component The component creating the link.
* @param buffer The buffer for the source.
* @param part The link metadata.
*/
public void appendLink(IComponentData component, StringBuffer buffer, ILinkPart part);
/**
* Appends the source code for the collecting association (the source does not end with a semi-colon).
* @param component The component adding the association.
* @param buffer The code buffer to append to.
* @param componentName The variable name of the component using the association.
* @param parts The collection of IAssociationPart instances containing the data.
* @param identifierUseageName The unique (within the component) name of the attribute's usage.
* @param accessType An identifier indicating whether the association is set only, get only, or both. If the association has children (is chained) then only the leaf child will have this access type, the rest will be Get Only.
*/
public void appendCollectingAssociation(IComponentData component, StringBuffer buffer, String componentName, IList parts, String identifierUsageName, byte accessType);
/**
* Appends the source code for the association (the source does not end with a semi-colon).
* @param component The component adding the association.
* @param buffer The code buffer to append to.
* @param componentName The variable name of the component using the association.
* @param part The association part containing the association data.
* @param identifierUseageName The unique (within the component) name of the attribute's usage.
* @param accessType An identifier indicating whether the association is set only, get only, or both. If the association has children (is chained) then only the leaf child will have this access type, the rest will be Get Only.
*/
public void appendAssociation(IComponentData component, StringBuffer buffer, String componentName, IAssociationGroupPart part, String identifierUsageName, byte accessType);
/**
* Appends code to create an attribute association.
* @param buffer The code buffer to append to.
* @param componentName The variable name of the component using the association.
* @param part The attribute part containing the association data.
* @param associationIdentifier The identifier for the attribute.
*/
public void appendAttributeAssociation(StringBuffer buffer, String componentName, IAttributePart part, String associationIdentifier);
/**
* Appends code to create a key binding.
* @param buffer The code buffer to append to.
* @param componentName The variable name of the component using the key binding.
* @param part The key part containing the data.
* @param bindingIdentifier The identifier for the key binding.
*/
public void appendKeyBinding(StringBuffer buffer, String componentName, IKeyPart part, String bindingIdentifier);
/**
* Appends code to create an event association.
* @param buffer The code buffer to append to.
* @param componentName The variable name of the component using the association.
* @param part The event part containing the association data.
*/
public void appendEventAssociation(StringBuffer buffer, String componentName, IEventPart part);
/**
* Appends code to create an event association.
* @param buffer The code buffer to append to.
* @param componentName The variable name of the component using the association.
* @param part The attribute part containing the association data.
*/
public void appendEventAssociation(StringBuffer buffer, String componentName, IAttributePart part);
/**
* Appends layout code to the container's initialization method.
* @param buffer The code buffer for the container's initialization method.
* @param container The container whose layout will be written to the source.
*/
public void appendLayout(StringBuffer buffer, IComponentData container);
/**
* Appends code to create an method association.
* @param buffer The code buffer to append to.
* @param componentName The variable name of the component using the association.
* @param methodReference The method reference containing the association data.
* @param associationIdentifier The identifier for the method.
*/
public void appendMethodAssociation(StringBuffer buffer, String componentName, IMethodPart methodReference, String associationIdentifier);
/**
* Gets the stack of com.foundation.view.definition.Message instances.
* @return The stack upon which error and information reporting can be placed.
*/
public IList getFeedbackStack();
/**
* Gets a new builder for the associated component data.
* @param componentData The component data whose source builder is required.
* @return A new builder of the type specified by the component data's type given the target platform specified when creating this view builder.
*/
public IBuilder getBuilder(IComponentData componentData);
/**
* Gets the view defined name for the given component.
* @param component The component whose name is to be retreived.
* @return The name of the given component.
*/
public String getComponentName(IComponentData component);
/**
* Gets the view's attribute name for the given component.
* @param componentData The component whose attribute is to be retrieved.
* @return The view's attribute name for the given component.
*/
public String getComponentAttributeName(IComponentData component);
/**
* Gets the primary component for the view. The view name is the primary component's name.
* @return The view's primary component.
*/
public IComponentData getPrimaryComponent();
/**
* A utility method which parses the type name and returns an integer representing the type.
* @param typeName The name of the type.
* @return The number representing the type, or null if unknown. The number identifiers are defined by IViewSourceBuilder and begin with TYPE_* and TYPE_NUMBER_*.
* @see IViewSourceBuilder
*/
public Integer parseType(String typeName);
/**
* Gets the attribute name formatted as an identifier defined by the class declaring the attribute.
* @param name The attribute name or identifier to be formatted. If an identifier then nothing should be changed.
* @return The attribute identifier name following either the identifier, or attribute formatting standards (and some illegal variations).
*/
public String formatIdentifier(String name);
/**
* Gets the attribute identifier or name formatted as a Java attribute name.
* @param name The name or identifier for an attribute.
* @return The attribute name formatted either as a Java attribute, or as an identifier (or some illegal variations that can still be understood).
*/
public String formatName(String name);
}//IViewSourceBuilder//