org.openxma.dsl.generator.LayoutStrategy Maven / Gradle / Ivy
package org.openxma.dsl.generator;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.openxma.dsl.core.model.Editor;
import org.openxma.dsl.core.model.Style;
import org.openxma.dsl.pom.model.Composite;
import org.openxma.dsl.pom.model.FieldPart;
import org.openxma.dsl.pom.model.GuiElement;
import org.openxma.dsl.pom.model.TabulatorPosition;
import at.spardat.xma.guidesign.XMAFormAttachment;
import at.spardat.xma.guidesign.XMAWidget;
/**
* Strategy interface for determining various layout properties, like width of
* widgets This interface is used by the default workflow and templates during
* a generator run.
*
* Implementations use this to implement project-scoped layout standards.
*/
public interface LayoutStrategy {
/**
* Get the default style for a model element
* @param widget
* @return
*/
String getDefaultStyle(EObject obj, String name);
/**
* Return the default width of a GuiElement
* @param guiElement
* @param style
* @return
*/
int getDefaultGuiElementWidth(GuiElement guiElement, Style style);
/**
* Returns the classpath-uri for the image of an Editor
which
* is displayed on the Button which invokes the editor.
* @param editor for which the image is determined
* @return classpath-uri for the image
*/
String getEditorImageUri(Editor editor);
/**
* Returns true if checkboxes are aligned Left
* @return
*/
boolean isCheckBoxLeftAligned();
/**
* Set the default properties of a XMAWidget
for a given style.
* @param widget for which the default properties are set.
* @param guiElement to which the widget belongs to
* @param style The name of the style which is defined (Null means no style is defined).
*/
void setXMAWidgetProperties(XMAWidget widget, GuiElement guiElement, String style);
/**
* Create the default tabulator positions for a given style.
* @param composite
* @param style
* @return
*/
List getTabulatorPositions(Composite composite, List definedTabulatorPositions, String style);
Boolean useLeftTabInDefaultAttachment(XMAWidget widget, FieldPart fieldPart, String style);
Boolean useRightTabInDefaultAttachment(XMAWidget widget, FieldPart fieldPart, String style);
/**
* Hook for any custom property settings of Xmadsl-model elements.
* @param obj
* @param name
*/
void setCustomXmadslModelElementProperties(EObject obj, String name);
/**
* Returns true if a widget is vertical centered to the previous widget on
* default.
* @return
*/
public boolean isVerticalCenteredToPrevious();
XMAFormAttachment getDefaultLeftAttachmentInSet(XMAWidget widget, TabulatorPosition tab, XMAWidget prevWidget, XMAWidget nextWidget, boolean isLabel, boolean isMainWidget);
XMAFormAttachment getDefaultRightAttachmentInSet(XMAWidget widget, TabulatorPosition tab, XMAWidget prevWidget, XMAWidget nextWidget, boolean isLabel, boolean isMainWidget);
XMAFormAttachment getDefaultTopAttachmentInSet(XMAWidget xmaWidget, XMAWidget prevWidget, XMAWidget centeredWidget, XMAWidget widgetForControlFieldPart, Collection