Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
import guidesign;
import guidesign::types;
import pom;
extension extensions::Validation;
extension extensions::Field;
extension extensions::FieldFlags;
extension extensions::XMAPage;
extension org::openxma::xmadsl::Extensions;
extension extensions::FormData;
extension extensions::Widgets;
extension extensions::Attachment;
extension extensions::Properties;
// Java extension to assign label text
guidesign::XMALabel setLabelText(guidesign::XMALabel label, String labelText):
JAVA org.openxma.dsl.generator.helper.Util.setLabelText(at.spardat.xma.guidesign.XMALabel, java.lang.String);
// Java extension to set tooltip text
guidesign::XMAWidget setTooltipText(guidesign::XMAWidget widget, String tooltipText):
JAVA org.openxma.dsl.generator.helper.Util.setTooltipText(at.spardat.xma.guidesign.XMAWidget, java.lang.String);
// Java extension to set tooltip text
guidesign::XMAWidget attachWidgetAndLabel(guidesign::XMAWidget widget, guidesign::XMALabel label):
JAVA org.openxma.dsl.generator.helper.Util.attachWidgetAndLabel(at.spardat.xma.guidesign.XMAWidget,at.spardat.xma.guidesign.XMALabel);
// Java extension to attach BDAttribute to a widget
guidesign::XMAWidget setBDAttribute(guidesign::XMAWidget widget, guidesign::BDAttribute bdAttribute):
JAVA org.openxma.dsl.generator.helper.Util.setBDAttribute(at.spardat.xma.guidesign.XMAWidget,at.spardat.xma.guidesign.BDAttribute);
// Java extension to assign label text
guidesign::XMACombo setDataSource(guidesign::XMACombo combo, String dataSource):
JAVA org.openxma.dsl.generator.helper.Util.setDataSource(at.spardat.xma.guidesign.XMACombo, java.lang.String);
//
List[Composite] getDslComposites(Page page):
page.eAllContents.typeSelect(Composite);
//
Composite getDslCompositeForName(Page page, String name):
getDslComposites(page).select(e|e.id()==name).first();
boolean contentReferencesPageComposite(Page page):
JAVA org.openxma.dsl.generator.helper.Util.contentReferencesPageComposite(org.openxma.dsl.pom.model.Page);
Composite getPageComposite(Page page):
JAVA org.openxma.dsl.generator.helper.Util.getPageComposite(org.openxma.dsl.pom.model.Page);
// Extend XMAComposite
cached XMAPage extendCompositeIfPossible(XMAComposite composite, Page page, List businessDataList, Component xmadslComponent):
let c = (contentReferencesPageComposite(page))
? getPageComposite(page)
: getDslCompositeForName(page,composite.id()):
if (c != null)
then extendComposite(composite,c,businessDataList)->
composite;
List getCustomizeableFields(SetOfGuiElements setOfSimpleElements):
(setOfSimpleElements != null)
? setOfSimpleElements.elements.typeSelect(CustomizeableField)
: null;
// Create expressins for the content of a XMAComposite
cached XMAComposite createExpressionsForComposite(XMAComposite xmaComposite, Page page, List businessDataList, Component xmadslComponent):
let allWidgets = xmaComposite.eContents.typeSelect(XMAWidget):
(allWidgets != null && allWidgets.size>0)
? ( let generatedFieldWidgets = allWidgets.select(e|e.isGeneratedFromField()):
let generatedOtherWidgets = allWidgets.select(e|e.isGeneratedFromOtherGuiElement()):
generatedFieldWidgets.createExpressionsForGeneratedFieldWidget(xmaComposite,businessDataList)->
generatedOtherWidgets.createExpressionsForGeneratedOtherWidget(xmaComposite,businessDataList))
: null ->
xmaComposite;
boolean isGeneratedFromField(XMAWidget widget):
let guiElement = widget.getGuiElementProperty():
(guiElement != null && CustomizeableField.isInstance(guiElement) == true)
? true
: false;
boolean isGeneratedFromOtherGuiElement(XMAWidget widget):
let guiElement = widget.getGuiElementProperty():
(guiElement != null && CustomizeableField.isInstance(guiElement) == false)
? true
: false;
/*
* Extend a composite with standard layout
*
*/
XMAComposite extendComposite(XMAComposite xmaComp, Composite compos, List businessDataList):
// Seperator to align labels and data widgets
let composeData = compos.getComposeData():
let containedWidgetSets = compos.getContent().widgetSetItems:
// Set margin for this container (=xmaComp)
createMargin(xmaComp,composeData)->
// Create widgetSetItems
(containedWidgetSets != null && containedWidgetSets.size>0)
? ( let collapseChain = createCollapseChain(compos):
let isReverse = (collapseChain.codDircection == 2 || collapseChain.codDircection == 4):
let cellCount = containedWidgetSets.size:
let mainWidgetList = createMainWidgetList(cellCount):
(isCollapsingSupported(compos))
? xmaComp.collapseChains.add(collapseChain)
: null->
(isReverse)
? containedWidgetSets.reverse().createCompositeCell(compos,xmaComp,collapseChain,businessDataList,composeData,true,cellCount,mainWidgetList)
: containedWidgetSets.createCompositeCell(compos,xmaComp,collapseChain,businessDataList,composeData,false,cellCount,mainWidgetList)
)
: ( let containedContainer = compos.getContent().containerItems:
(containedContainer != null && containedContainer.size>0)
? (containedContainer.createContainedGuiElement(xmaComp,businessDataList,composeData)->
xmaComp.eContents.typeSelect(XMAWidget).select(e|HiddenWidget.isInstance(e)==false).createFormDataForCompositeContentContainer(xmaComp,businessDataList,composeData))
: ( let containedElements = compos.getContent().elements:
containedElements.createContainedGuiElement(xmaComp,businessDataList,composeData)->
xmaComp.eContents.typeSelect(XMAWidget).select(e|HiddenWidget.isInstance(e)==false).createFormDataForCompositeContentContainer(xmaComp,businessDataList,composeData))
)->
xmaComp;
flex::CollapseChain createCollapseChain(Composite compos):
JAVA org.openxma.dsl.generator.helper.ComplexTypeExtension.createCollapseChain(org.openxma.dsl.pom.model.Composite);
/*
* Extend a composite with standard layout
*
*/
XMATabFolder extendTabFolder(XMATabFolder xmaTabFolder, TabFolder tabFolder, List businessDataList):
// Seperator to align labels and data widgets
let containedTabPages = tabFolder.tabItems:
// Create content
if (containedTabPages.size>0) then (
containedTabPages.createTabPages(xmaTabFolder,businessDataList)
)->
xmaTabFolder;
Void createTabPages(TabPage tabPage, XMATabFolder parentXMATabFolder, List businessDataList):
let newTabPage = tabPage.createNotebookPage():
let pageComposite = createAndAddPageComposite(newTabPage,tabPage):
parentXMATabFolder.nbPage.add(newTabPage)->
pageComposite.extendComposite(tabPage,businessDataList)->
null;
/**
* The main widget in a content-group is in general the first one.
*
* There is one exception:
* If the first widget is a label and there are more widgets in the
* content-group. In this case the second widget is the main widget because
* then usually the first widget is just the label for the second widget.
*/
int getMainWidgetIndex(List[XMAWidget] widgetList):
(widgetList != null && widgetList.size>1 && XMALabel.isInstance(widgetList.get(0)))
? 1
: 0;
Void addControl(XMAComposite composite, XMAWidget widget, boolean reverse):
JAVA org.openxma.dsl.generator.helper.Util.addControl(at.spardat.xma.guidesign.XMAComposite, at.spardat.xma.guidesign.XMAWidget, java.lang.Boolean);
Void createCompositeCell(SetOfGuiElements setOfSimpleElements, Composite compos, XMAComposite parentXMAComposite, flex::CollapseChain collapseChain, List businessDataList, ComposeData composeData, boolean reverse, int cellCount, List[XMAComposite] mainWidgetList):
let groupWidgetList = (List[XMAWidget]){}:
if (setOfSimpleElements != null && setOfSimpleElements.elements != null && setOfSimpleElements.elements.size>0) then (
let collapseGroup = new flex::CollapseGroup:
let padding = (composeData != null && composeData.spacing != null) ? composeData.spacing.width : 3:
let margin = parentXMAComposite.qntMarginHeight:
let compositeForCollapseGroup = createCompositeForCollapseGroup(setOfSimpleElements,collapseChain,compos,parentXMAComposite,mainWidgetList,padding,margin,cellCount):
let centeredWidget = createCenteredWidget(collapseChain,parentXMAComposite):
parentXMAComposite.addControl(compositeForCollapseGroup,reverse)->
compositeForCollapseGroup.controls.add(centeredWidget)->
setOfSimpleElements.elements.createGroupWidgetForGuiElement(compositeForCollapseGroup,collapseGroup,groupWidgetList,businessDataList)->
(
let mainWidgetIndex = groupWidgetList.getMainWidgetIndex():
groupWidgetList.createAndSetFormData(setOfSimpleElements,centeredWidget,groupWidgetList,mainWidgetIndex,composeData)->
collapseGroup.setCollapseGroupWidgets(compositeForCollapseGroup,null)->
collapseChain.collapseGroups.add(collapseGroup)
)
)->
null;
XMAWidget createCenteredWidget(flex::CollapseChain collapseChain, XMAComposite parentXMAComposite):
let centeredWidget = new XMALabel:
let formDataOfCenteredWidget = new XMAFormData:
centeredWidget.setYnGenerated(true)->
centeredWidget.setYnVisible(false)->
centeredWidget.setNamInstance(parentXMAComposite.namInstance+"_set"+collapseChain.collapseGroups.size+"_centered")->
formDataOfCenteredWidget.setLeftAttach(new XMAFormAttachment)->
formDataOfCenteredWidget.setTopAttach(new XMAFormAttachment)->
formDataOfCenteredWidget.setBottomAttach(new XMAFormAttachment.setQntNominator(100))->
formDataOfCenteredWidget.setQntWidth(1)->
centeredWidget.setFormData(formDataOfCenteredWidget)->
centeredWidget;
boolean isCollapsingSupported(Composite compos):
JAVA org.openxma.dsl.generator.helper.ComplexTypeExtension.isCollapsingSupported(org.openxma.dsl.pom.model.Composite);
/**
* Creates a list of main widgets for a CollapseGroup
*/
List[XMAComposite] createMainWidgetList(int cellCount):
JAVA org.openxma.dsl.generator.helper.ComplexTypeExtension.createMainWidgetList(java.lang.Integer);
/**
*
*/
XMAComposite createCompositeForCollapseGroup(SetOfGuiElements setOfSimpleElements,flex::CollapseChain collapseChain, Composite compos, XMAComposite parentXMAComposite, List[XMAComposite] mainWidgetList, int padding, int margin, int cellCount):
JAVA org.openxma.dsl.generator.helper.ComplexTypeExtension.createCompositeForCollapseGroup(org.openxma.dsl.pom.model.SetOfGuiElements, at.spardat.xma.guidesign.flex.CollapseChain, org.openxma.dsl.pom.model.Composite, at.spardat.xma.guidesign.XMAComposite, java.util.List,java.lang.Integer,java.lang.Integer,java.lang.Integer);
/**
* Set the main and secundary widgets of a CollapseCroup.
*/
Void setCollapseGroupWidgets(flex::CollapseGroup collapseGroup, XMAWidget mainWidget, List[XMAWidget] groupWidgets):
if (groupWidgets != null) then (
let secundaryWidgets = groupWidgets.select(e|e != mainWidget):
collapseGroup.secondaryWidgets.addAll(secundaryWidgets)
)->
collapseGroup.setMainWidget(mainWidget);
List[emf::EObject] createGroupWidgetForGuiElement(GuiElement guiElement, XMAComposite parentXMAComposite, flex::CollapseGroup collapseGroup, List[XMAWidget] groupWidgetList, List businessDataList):
let newObjList = guiElement.createWidgetsForGuiElement(parentXMAComposite,businessDataList):
if (newObjList != null) then groupWidgetList.addAll(newObjList)->
newObjList;
Void createContainedGuiElement(GuiElement guiElement, XMAComposite parentXMAComposite, List businessDataList, ComposeData composeData):
let prevWidget = parentXMAComposite.controls.last():
(guiElement != null)
? guiElement.createWidgetsForGuiElement(parentXMAComposite,businessDataList).first()
: null;
Void createFormDataForCompositeContentContainer(XMAWidget xmaWidget, XMAComposite parentXMAComposite, List businessDataList, ComposeData composeData):
let widgetIndex = parentXMAComposite.eContents.indexOf(xmaWidget):
let widgetCount = parentXMAComposite.eContents.typeSelect(XMAWidget).size:
let prevWidgetBase = (widgetIndex>0) ? parentXMAComposite.eContents.typeSelect(XMAWidget).get(widgetIndex-1):null:
let prevWidget = (HiddenWidget.isInstance(prevWidgetBase)) ? null : prevWidgetBase:
let nextWidget = (widgetIndex0)
? composeData.tabulators.get(0)
: null;
/*
* Create expressions for generated XMAWidgets which are generated from CustomizeableField
*/
XMAWidget createExpressionsForGeneratedFieldWidget(XMAWidget xmaWidget, XMAComposite xmaComposite, List businessDataList):
let guiElement = xmaWidget.getGuiElementProperty():
let field = (CustomizeableField.isInstance(guiElement)) ? ((CustomizeableField)guiElement) : null :
let widgetName = (field != null) ? field.composeDefaultWidgetNameForField(): null:
// Additional consistency-checks
let dataWidget = xmaComposite.eContents.typeSelect(XMAWidget).selectFirst(e|e.namInstance==widgetName):
if (field==null) then error("no field found for widget: "+xmaWidget)->
// Now it is allowed that there is no dataWidget generated for a field (e.g. only a label can be generated)
// if (dataWidget==null) then error("datawidget is null for widget with name: "+widgetName+" in "+field)->
// Todo: refacture to use same method than in createExpressionsForGeneratedOtherWidget (=createExpressions)
field.createExpressionsForWidget(xmaWidget,businessDataList);
/*
* Create expressions for generated XMAWidgets which are not generated from CustomizeableField.
* This are currently just Text controls.
*/
XMAWidget createExpressionsForGeneratedOtherWidget(XMAWidget xmaWidget, XMAComposite xmaComposite, List businessDataList):
let guiElement = xmaWidget.getGuiElementProperty():
let simpleElement = (SimpleElement)guiElement:
let fieldFlags = simpleElement.fieldFlags:
let sourceModelElement = xmaWidget.getSourceModelElementProperty():
(fieldFlags != null && fieldFlags.size > 0)
? xmaWidget.createExpressions(fieldFlags,null)
: null->
(SetOfGuiElements.isInstance(sourceModelElement))
? xmaWidget.createExpressions(((SetOfGuiElements)sourceModelElement).fieldFlags,null)
: null ->
// Create formatter and constraints for text widgets
if (XMAText.isInstance(xmaWidget))
then createFormatterForText((XMAText)xmaWidget)->
xmaWidget;
/*
* Create expressions for Tables
*/
XMAWidget createExpressionsForGeneratedOtherWidget(XMATable xmaTable, XMAComposite xmaComposite, List businessDataList):
let guiElement = xmaTable.getGuiElementProperty():
(xmaTable.ynCombo)
? (
let tc = (TableCombo) guiElement:
let fieldFlags = tc.fieldFlags:
(fieldFlags != null && fieldFlags.size > 0)
? xmaTable.createExpressions(fieldFlags,null)
: null
)
: null ->
// Todo: implement
xmaTable;
/*
* Create expressions for Tabfolders
*/
XMAWidget createExpressionsForGeneratedOtherWidget(XMATabFolder xmaTabFolder, XMAComposite xmaComposite, List businessDataList):
let guiElement = xmaTabFolder.getGuiElementProperty():
// Todo: implement
null;
/*
* Extend the fields according the standard layout
*/
XMAWidget createExpressionsForWidget(IField field, XMAWidget dataWidget, List businessDataList):
dataWidget.setFieldFlags(field,true)->
if (dataWidget.isFormatterAttachable())
then dataWidget.createAndAttachCompoundValidator(field)->
dataWidget;
/**
* Get ComposeData for all types of Composite
*/
ComposeData getComposeData(Void void):
error("Can not get ComposeData");
ComposeData getComposeData(ComplexElement complexElement):
null;
ComposeData getComposeData(IComposite iComposite):
iComposite.content.composeLayout;
ComposeData getComposeData(ITabPage iTabPage):
iTabPage.composeLayout;
/*
* Access to content
*/
Content getContent(Page page):
error("Content of abstract Page not defined");
Content getContent(Composite page):
error("Content of abstract Composite not defined");
Content getContent(ReferencedXMAPage page):
page.content;
Content getContent(XmadslPage page):
page.content;
Content getContent(ITabPage page):
page.content;
Content getContent(IComposite composite):
composite.content;
ComposeData getComposeData(Composite composite):
JAVA org.openxma.dsl.generator.helper.FormDataExtension.getComposeData(org.openxma.dsl.pom.model.Composite);