All Downloads are FREE. Search and download functionalities are using the official Maven repository.

extensions.FormData.ext Maven / Gradle / Ivy

There is a newer version: 6.0.2
Show newest version
import guidesign;
import guidesign::types;
import pom;

extension extensions::Attachment;
extension extensions::Widgets;
extension extensions::Properties;
extension org::openxma::dsl::common::extensions::LogUtil;



int getWidth(GuiElement guiElement):
JAVA org.openxma.dsl.generator.helper.LayoutDataExtension.getWidth(org.openxma.dsl.pom.model.GuiElement);

int getHeight(GuiElement guiElement):
JAVA org.openxma.dsl.generator.helper.LayoutDataExtension.getHeight(org.openxma.dsl.pom.model.GuiElement);

Void setWidgetDimension(XMAFormData formData, GuiElement guiElement, XMAWidget widget, FieldPartSpecification fieldPartSpecification):
JAVA org.openxma.dsl.generator.helper.FormDataExtension.setWidgetDimension(at.spardat.xma.guidesign.XMAFormData, org.openxma.dsl.pom.model.GuiElement, at.spardat.xma.guidesign.XMAWidget, org.openxma.dsl.pom.model.FieldPartSpecification);

boolean isButton(XMAWidget xmaWidget):
JAVA org.openxma.dsl.generator.helper.FormDataExtension.isButton(at.spardat.xma.guidesign.XMAWidget);

boolean isCheckBox(XMAWidget xmaWidget):
	CheckButton.isInstance(xmaWidget);

/**
 * Determine whether a default attachment for left side should be used
 * depending on other layout information:
 *
 * No default left attachment is required in case a right attachment and the
 * width is defined, because the layout is defined without a left attachment.
 * Furthermore a left attachment could even be inconsistent with this given
 * information.
 */ 
boolean allowDefaultLeftAttachment(AttachmentSpecification rightAttachment, XMAFormData formData, XMAWidget widget, GuiElement guiElement, XMAWidget nextWidgetInSet, Boolean attachNextWidgetsLeft, Boolean isLabel, Boolean isMainWidget, Boolean tabulatorAvailable):
JAVA org.openxma.dsl.generator.helper.FormDataExtension.allowDefaultLeftAttachment(org.openxma.dsl.pom.model.AttachmentSpecification,  at.spardat.xma.guidesign.XMAFormData, at.spardat.xma.guidesign.XMAWidget, org.openxma.dsl.pom.model.GuiElement, at.spardat.xma.guidesign.XMAWidget, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean);

boolean allowDefaultRightAttachment(AttachmentSpecification leftAttachment, XMAFormData formData, XMAWidget widget, GuiElement guiElement, XMAWidget nextWidgetInSet, Boolean attachNextWidgetsLeft, Boolean isLabel, Boolean isMainWidget, Boolean tabulatorAvailable):
JAVA org.openxma.dsl.generator.helper.FormDataExtension.allowDefaultRightAttachment(org.openxma.dsl.pom.model.AttachmentSpecification, at.spardat.xma.guidesign.XMAFormData, at.spardat.xma.guidesign.XMAWidget, org.openxma.dsl.pom.model.GuiElement, at.spardat.xma.guidesign.XMAWidget, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean);

boolean useLeftTabInDefaultAttachment(XMAWidget widget, GuiElement guiElement, Boolean isLabel, Boolean isMainWidget):
JAVA org.openxma.dsl.generator.helper.FormDataExtension.useLeftTabInDefaultAttachment(at.spardat.xma.guidesign.XMAWidget, org.openxma.dsl.pom.model.GuiElement, java.lang.Boolean, java.lang.Boolean);

boolean useRightTabInDefaultAttachment(XMAWidget widget, GuiElement guiElement, Boolean isLabel, Boolean isMainWidget):
JAVA org.openxma.dsl.generator.helper.FormDataExtension.useRightTabInDefaultAttachment(at.spardat.xma.guidesign.XMAWidget, org.openxma.dsl.pom.model.GuiElement, java.lang.Boolean, java.lang.Boolean);

TabulatorPosition getLastTabulatorPosition(SetOfGuiElements setOfSimpleElements):
JAVA org.openxma.dsl.generator.helper.FormDataExtension.getLastTabulatorPosition(org.openxma.dsl.pom.model.SetOfGuiElements);

TabulatorPosition setLastTabulatorPosition(SetOfGuiElements setOfSimpleElements, TabulatorPosition tab):
JAVA org.openxma.dsl.generator.helper.FormDataExtension.setLastTabulatorPosition(org.openxma.dsl.pom.model.SetOfGuiElements, org.openxma.dsl.pom.model.TabulatorPosition);

int getPositionOffset(IAttachmentPosition tab):
JAVA org.openxma.dsl.generator.helper.FormDataExtension.getPositionOffset(org.openxma.dsl.pom.model.IAttachmentPosition);

int getPositionNominator(IAttachmentPosition tab):
JAVA org.openxma.dsl.generator.helper.FormDataExtension.getPositionNominator(org.openxma.dsl.pom.model.IAttachmentPosition);

XMAFormAttachment createDefaultLeftAttachment(XMAWidget widget,ComposeData composeData, TabulatorPosition tab, boolean isLabel, boolean isMainWidget, XMAWidget prevWidgetInSet, XMAWidget nextWidgetInSet, boolean attachNextWidgetsLeft2):
JAVA org.openxma.dsl.generator.helper.FormDataExtension.createDefaultLeftAttachment(at.spardat.xma.guidesign.XMAWidget, org.openxma.dsl.pom.model.ComposeData, org.openxma.dsl.pom.model.TabulatorPosition, java.lang.Boolean, java.lang.Boolean, at.spardat.xma.guidesign.XMAWidget, at.spardat.xma.guidesign.XMAWidget, java.lang.Boolean);

XMAFormAttachment createDefaultRightAttachment(XMAWidget widget, ComposeData composeData,  TabulatorPosition tab, boolean isLabel, boolean isMainWidget, XMAWidget prevWidgetInSet, XMAWidget nextWidgetInSet, boolean attachNextWidgetsLeft2):
JAVA org.openxma.dsl.generator.helper.FormDataExtension.createDefaultRightAttachment(at.spardat.xma.guidesign.XMAWidget, org.openxma.dsl.pom.model.ComposeData, org.openxma.dsl.pom.model.TabulatorPosition, java.lang.Boolean, java.lang.Boolean, at.spardat.xma.guidesign.XMAWidget, at.spardat.xma.guidesign.XMAWidget, java.lang.Boolean);

XMAFormAttachment createDefaultBottomAttachment(XMAWidget widget, ComposeData composeData):
JAVA org.openxma.dsl.generator.helper.FormDataExtension.createDefaultBottomAttachment(at.spardat.xma.guidesign.XMAWidget, org.openxma.dsl.pom.model.ComposeData);

TabulatorPosition getLeftTabulatorPosition(XMAWidget xmaWidget, GuiElement guiElement, SetOfGuiElements parentSetOfSimpleElements, ComposeData composeData, String columnIndex, Boolean isLabel, Boolean isMainWidget):
JAVA org.openxma.dsl.generator.helper.FormDataExtension.getLeftTabulatorPosition(at.spardat.xma.guidesign.XMAWidget, org.openxma.dsl.pom.model.GuiElement, org.openxma.dsl.pom.model.SetOfGuiElements, org.openxma.dsl.pom.model.ComposeData, java.lang.String, java.lang.Boolean, java.lang.Boolean);

TabulatorPosition getRightTabulatorPosition(XMAWidget xmaWidget, GuiElement guiElement, SetOfGuiElements parentSetOfSimpleElements, ComposeData composeData, String columnIndex, boolean isLabel, boolean isMainWidget):
JAVA org.openxma.dsl.generator.helper.FormDataExtension.getRightTabulatorPosition(at.spardat.xma.guidesign.XMAWidget, org.openxma.dsl.pom.model.GuiElement, org.openxma.dsl.pom.model.SetOfGuiElements, org.openxma.dsl.pom.model.ComposeData, java.lang.String, java.lang.Boolean, java.lang.Boolean);

/**
 * Create XMAFormData for a XMAWidget
 *
 * This methodes dispatches the creation of the XMAFormData according the 'role'
 * of the widget.
 */
Void createAndSetFormData(XMAWidget xmaWidget, SetOfGuiElements parentSetOfSimpleElements, XMAWidget centeredWidget, List[XMAWidget] groupWidgetList, int mainWidgetIndex, ComposeData composeData):

	let guiElement = xmaWidget.getGuiElementProperty():
	let indexOfXMAWidget = groupWidgetList.indexOf(xmaWidget):
	let isMainWidget = (mainWidgetIndex == indexOfXMAWidget):
	let isLabel = (indexOfXMAWidget0) ? groupWidgetList.get(indexOfXMAWidget-1):null:
	let attachNextWidgetsLeft2 = (boolean)parentSetOfSimpleElements.getProperty('attachNextWidgetsLeft'):

	let fieldPart = xmaWidget.getFieldPartProperty():
	let controlFieldPart = getControlFieldPartForGuiElement(groupWidgetList,guiElement):

	xmaWidget.setFormData(
		(isMainWidget)
			? xmaWidget.createDefaultFormDataForMainWidget(parentComposite,composeData,controlFieldPart,centeredWidget,prevWidgetInSet,nextWidgetInSet,parentSetOfSimpleElements,columnIndex,padding,attachNextWidgetsLeft2)
			: ( (isLabel)
					? xmaWidget.createDefaultFormDataForLabel(mainWidget,parentComposite,composeData,controlFieldPart, centeredWidget,prevWidgetInSet,nextWidgetInSet,parentSetOfSimpleElements,columnIndex,padding,attachNextWidgetsLeft2)
			  		: xmaWidget.createDefaultFormDataForNextGroupWidget(mainWidget,parentComposite,composeData,controlFieldPart,centeredWidget,prevWidgetInSet,nextWidgetInSet,parentSetOfSimpleElements,columnIndex,padding,attachNextWidgetsLeft2)
			  )
		);

	XMAWidget getControlFieldPartForGuiElement(List groupWidgetList, GuiElement guiElement):
	JAVA org.openxma.dsl.generator.helper.FormDataExtension.getControlFieldPartForGuiElement(java.util.List, org.openxma.dsl.pom.model.GuiElement);

/**
 * Create XMAFormData for a XMAComposite
 */
XMAFormData createDefaultFormDataComplexElement(GuiElement guiElement, XMAWidget xmaWidget, XMAComposite parentComposite, XMAWidget prevWidget, XMAWidget nextWidget, XMASeperator sep, int padding):

	let formData = new XMAFormData:

	let topAttachment = guiElement.getTopAttachment(null,null):
	let leftAttachment = guiElement.getLeftAttachment(null,null):
	let rightAttachment = guiElement.getRightAttachment(null,null):
	let bottomAttachment = guiElement.getBottomAttachment(null,null):
	let prevGuiElement = (prevWidget != null) ? prevWidget.getGuiElementProperty():null:
	let nextGuiElement = (nextWidget != null) ? nextWidget.getGuiElementProperty():null:

	// Increase horizontal padding for Composite to allow similar look-and-fell than Group
	let horizontalPadding = padding:	

	// Top
	(topAttachment != null)
		? formData.setTopAttach(topAttachment.createXMAAttachment(parentComposite,prevGuiElement,nextGuiElement,AttachmentOwnPosition::TOP))
		: ((bottomAttachment != null)
			? null
		    : (formData.setTopAttach(prevWidget == null
				? new XMAFormAttachment
				: new XMAFormAttachment
					.setCodAttachSide(AttachSideType::BOTTOM)
					.setQntOffset(padding)
					.setAttachElement(prevWidget)))) ->

	// Left
	(leftAttachment != null)
		? formData.setLeftAttach(leftAttachment.createXMAAttachment(parentComposite,prevGuiElement,nextGuiElement,AttachmentOwnPosition::LEFT))
		: (if (allowDefaultLeftAttachment(rightAttachment,formData,xmaWidget,guiElement,null,true,false,false,false)) then
			formData.setLeftAttach(new XMAFormAttachment.setQntNominator(0))) ->

	// Right
	(rightAttachment != null)
		? formData.setRightAttach(rightAttachment.createXMAAttachment(parentComposite,prevGuiElement,nextGuiElement,AttachmentOwnPosition::RIGHT))
		// No default-right-attachment in case width is defined
		: ((guiElement.getWidth() == 0)
				? formData.setRightAttach(new XMAFormAttachment.setQntNominator(100))
				: null)-> 

	// Bottom
	(bottomAttachment != null)
		? formData.setBottomAttach(bottomAttachment.createXMAAttachment(parentComposite,prevGuiElement,nextGuiElement,AttachmentOwnPosition::BOTTOM))
		: null ->

	// Dimension
	setWidgetDimension(formData,guiElement,xmaWidget,null)->

	formData;

/**
 * Create XMAFormData for a XMAComposite
 */
XMAFormData createDefaultFormDataSimpleElement(GuiElement guiElement, XMAWidget xmaWidget, XMAComposite parentComposite, XMAWidget prevWidget, XMAWidget nextWidget, XMASeperator sep, int padding):

	let formData = new XMAFormData:
	
	let prevGuiElement = (prevWidget != null) ? prevWidget.getGuiElementProperty():null:
	let nextGuiElement = (nextWidget != null) ? nextWidget.getGuiElementProperty():null:	

	let topAttachment = guiElement.getTopAttachment(null,null):
	let leftAttachment = guiElement.getLeftAttachment(null,true):
	let rightAttachment = guiElement.getRightAttachment(null,true):
	let bottomAttachment = guiElement.getBottomAttachment(null,null):

	// Increase horizontal padding for Composite to allow similar look-and-fell than Group
	let horizontalPadding = padding:

	// Top
	(topAttachment != null)
		? formData.setTopAttach(topAttachment.createXMAAttachment(parentComposite,prevGuiElement,nextGuiElement,AttachmentOwnPosition::TOP))
		: ((bottomAttachment != null)
			? null
		    : (formData.setTopAttach(prevWidget == null
				? new XMAFormAttachment
				: new XMAFormAttachment
					.setCodAttachSide(AttachSideType::BOTTOM)
					.setQntOffset(padding)
					.setAttachElement(prevWidget)))) ->

	// Left
	(leftAttachment != null)
		? formData.setLeftAttach(leftAttachment.createXMAAttachment(parentComposite,prevGuiElement,nextGuiElement,AttachmentOwnPosition::LEFT))
		: (if (allowDefaultLeftAttachment(rightAttachment,formData,xmaWidget,guiElement,null,true,false,false,false)) then		
			formData.setLeftAttach(new XMAFormAttachment.setQntNominator(0))) ->

	// Right
	(rightAttachment != null)
		? formData.setRightAttach(rightAttachment.createXMAAttachment(parentComposite,prevGuiElement,nextGuiElement,AttachmentOwnPosition::RIGHT))		
		: null ->

	// Bottom
	(bottomAttachment != null)
		? formData.setBottomAttach(bottomAttachment.createXMAAttachment(parentComposite,prevGuiElement,nextGuiElement,AttachmentOwnPosition::BOTTOM))
		: null ->

	// Dimension
	setWidgetDimension(formData,guiElement,xmaWidget,null)->

	formData;

/**
 * Create XMAFormData for the main-XMAWidget
 */
XMAFormData createDefaultFormDataForMainWidget(XMAWidget xmaWidget, XMAComposite parentComposite, ComposeData composeData, XMAWidget controlFieldPart, XMAWidget centeredWidget, XMAWidget prevWidgetInSet, XMAWidget nextWidgetInSet, SetOfGuiElements parentSetOfSimpleElements, int columnIndex, int padding, boolean attachNextWidgetsLeft2):

	let formData = new XMAFormData:
	let guiElement = xmaWidget.getGuiElementProperty():
	let fieldPart = xmaWidget.getFieldPartProperty():	
	let fieldPartSpecification = xmaWidget.getFieldPartSpecificationProperty():
	let prevGuiElement = (prevWidgetInSet != null) ? prevWidgetInSet.getGuiElementProperty():null:
	let nextGuiElement = (nextWidgetInSet != null) ? nextWidgetInSet.getGuiElementProperty():null:

	let topAttachment = guiElement.getTopAttachment(fieldPart,fieldPartSpecification):
	let leftAttachment = guiElement.getLeftAttachment(fieldPartSpecification,prevGuiElement != guiElement):
	let rightAttachment = guiElement.getRightAttachment(fieldPartSpecification,nextGuiElement != guiElement):
	let bottomAttachment = guiElement.getBottomAttachment(fieldPart,fieldPartSpecification):

	//log(">> createDefaultFormDataForMainWidget: "+xmaWidget.namInstance+", nextWidgetInSet= "+nextWidgetInSet.namInstance+", left= "+leftAttachment)->

	// Dimension
	setWidgetDimension(formData,guiElement,xmaWidget,fieldPartSpecification)->

	// Top
	formData.setTopAttach(createTopAttachment(topAttachment,parentComposite,guiElement,prevGuiElement,nextGuiElement,prevWidgetInSet,centeredWidget,controlFieldPart,xmaWidget))->

	// Left
	(leftAttachment != null)
		? formData.setLeftAttach(leftAttachment.createXMAAttachment(parentComposite,prevGuiElement,nextGuiElement,AttachmentOwnPosition::LEFT))
		: (let tabLeft = xmaWidget.getLeftTabulatorPosition(guiElement,parentSetOfSimpleElements,composeData,(""+columnIndex),false,true):
			((allowDefaultLeftAttachment(rightAttachment,formData,xmaWidget,guiElement,null,attachNextWidgetsLeft2,false,true,tabLeft != null))
			? ( let defaultLeftAttachment = createDefaultLeftAttachment(xmaWidget,composeData,tabLeft,false,true,prevWidgetInSet,nextWidgetInSet,attachNextWidgetsLeft2):
		 	    formData.setLeftAttach(defaultLeftAttachment))
		 	: null)) ->

	// Right
	(rightAttachment != null)
		? formData.setRightAttach(rightAttachment.createXMAAttachment(parentComposite,prevGuiElement,nextGuiElement,AttachmentOwnPosition::RIGHT))
		: (let tabRight = xmaWidget.getRightTabulatorPosition(guiElement,parentSetOfSimpleElements,composeData,(""+columnIndex),false,true):
			((allowDefaultRightAttachment(leftAttachment,formData,xmaWidget,guiElement,null,attachNextWidgetsLeft2,false,true,tabRight != null))
		 	? ( let defaultRightAttachment = createDefaultRightAttachment(xmaWidget,composeData,tabRight,false,true,prevWidgetInSet,nextWidgetInSet,attachNextWidgetsLeft2):
		 	    formData.setRightAttach(defaultRightAttachment))
		 	: null))->

	// Bottom
	(bottomAttachment != null)
		? formData.setBottomAttach(bottomAttachment.createXMAAttachment(parentComposite,prevGuiElement,nextGuiElement,AttachmentOwnPosition::BOTTOM))
		: ((parentSetOfSimpleElements.elements.size==1)
			? formData.setBottomAttach(createDefaultBottomAttachment(xmaWidget,composeData))
			: null)->

	// Set property for default attachment side of next widgets after main widget
	( let attachNextWidgetsLeft = attachNextWidgetsLeft(xmaWidget,nextWidgetInSet,formData):
	  let parentSetOfSimpleElements = guiElement.eContainer:
	  parentSetOfSimpleElements.setProperty('attachNextWidgetsLeft',attachNextWidgetsLeft))->

	formData;


/**
 * Determine default attachment side for next widgets after main widget
 */
boolean attachNextWidgetsLeft(XMAWidget mainWidget,XMAWidget nextWidgetInSet, XMAFormData formData):
JAVA org.openxma.dsl.generator.helper.FormDataExtension.attachNextWidgetsLeft(at.spardat.xma.guidesign.XMAWidget,at.spardat.xma.guidesign.XMAWidget, at.spardat.xma.guidesign.XMAFormData);

/**
 * Create XMAFormData for the label-XMAWidgets which is ordered before the main-XMAWidget
 */
XMAFormData createDefaultFormDataForLabel(XMAWidget xmaWidget, XMAWidget mainWidget, XMAComposite parentComposite, ComposeData composeData, XMAWidget controlFieldPart, XMAWidget centeredWidget, XMAWidget prevWidgetInSet, XMAWidget nextWidgetInSet, SetOfGuiElements parentSetOfSimpleElements, int columnIndex, int padding, boolean attachNextWidgetsLeft2):

	let formData = new XMAFormData:
	let guiElement = xmaWidget.getGuiElementProperty():
	let fieldPart = xmaWidget.getFieldPartProperty():		
	let fieldPartSpecification = xmaWidget.getFieldPartSpecificationProperty():	
	let prevGuiElement = (prevWidgetInSet != null) ? prevWidgetInSet.getGuiElementProperty():null:
	let nextGuiElement = (nextWidgetInSet != null) ? nextWidgetInSet.getGuiElementProperty():null:

	let topAttachment = guiElement.getTopAttachment(fieldPart,fieldPartSpecification):
	let leftAttachment = guiElement.getLeftAttachment(fieldPartSpecification, prevGuiElement != guiElement):
	let rightAttachment = guiElement.getRightAttachment(fieldPartSpecification,nextGuiElement != guiElement):
	let bottomAttachment = guiElement.getBottomAttachment(fieldPart,fieldPartSpecification):

	//log(">> createAndSetFormData for label: "+xmaWidget.namInstance+", rightAttachment = "+rightAttachment)->

	// Dimension
	setWidgetDimension(formData,guiElement,xmaWidget,fieldPartSpecification)->

	// Top
	(topAttachment != null)
		? formData.setTopAttach(topAttachment.createXMAAttachment(parentComposite,prevGuiElement,nextGuiElement,AttachmentOwnPosition::TOP))
		: formData.setTopAttach(createTopAttachment(topAttachment,parentComposite,guiElement,prevGuiElement,nextGuiElement,prevWidgetInSet,centeredWidget,controlFieldPart,xmaWidget))->

	// Left
	(leftAttachment != null)
		? formData.setLeftAttach(leftAttachment.createXMAAttachment(parentComposite,prevGuiElement,nextGuiElement,AttachmentOwnPosition::LEFT))
		: (let tabLeft = xmaWidget.getLeftTabulatorPosition(guiElement,parentSetOfSimpleElements,composeData,(""+columnIndex),true,false):
			((allowDefaultLeftAttachment(rightAttachment,formData,xmaWidget,guiElement,null,attachNextWidgetsLeft2,true,false,tabLeft != null))
			? ( let defaultLeftAttachment = createDefaultLeftAttachment(xmaWidget,composeData,tabLeft,true,false,prevWidgetInSet,nextWidgetInSet,attachNextWidgetsLeft2):
		 	    formData.setLeftAttach(defaultLeftAttachment))
		 	: null))->

	// Right
	(rightAttachment != null)
		? formData.setRightAttach(rightAttachment.createXMAAttachment(parentComposite,prevGuiElement,nextGuiElement,AttachmentOwnPosition::RIGHT))
		: (let tabRight = xmaWidget.getRightTabulatorPosition(guiElement,parentSetOfSimpleElements,composeData,(""+columnIndex),true,false):
			((allowDefaultRightAttachment(leftAttachment,formData,xmaWidget,guiElement,null,attachNextWidgetsLeft2,true,false,tabRight != null))
		 	? ( let defaultRightAttachment = createDefaultRightAttachment(xmaWidget,composeData,tabRight,true,false,prevWidgetInSet,nextWidgetInSet,attachNextWidgetsLeft2):
		 	    formData.setRightAttach(defaultRightAttachment))
		 	: null))->

	// Bottom
	(bottomAttachment != null)
		? formData.setBottomAttach(bottomAttachment.createXMAAttachment(parentComposite,prevGuiElement,nextGuiElement,AttachmentOwnPosition::BOTTOM))
		: ((parentSetOfSimpleElements.elements.size==1)
			? formData.setBottomAttach(createDefaultBottomAttachment(xmaWidget,composeData))
			: null)->

	// Set property for default attachment side of next widgets after widget
	( let attachNextWidgetsLeft = attachNextWidgetsLeft(xmaWidget,nextWidgetInSet,formData):
	  let parentSetOfSimpleElements = guiElement.eContainer:
	  parentSetOfSimpleElements.setProperty('attachNextWidgetsLeft',attachNextWidgetsLeft))->

	formData;

XMAFormAttachment createTopAttachment(AttachmentSpecification topAttachment, XMAComposite parentComposite, GuiElement guiElement, GuiElement prevGuiElement, GuiElement nextGuiElement, XMAWidget prevWidgetInSet, XMAWidget centeredWidget, XMAWidget controlFieldPart, XMAWidget xmaWidget):
JAVA org.openxma.dsl.generator.helper.FormDataExtension.createTopAttachment(org.openxma.dsl.pom.model.AttachmentSpecification, at.spardat.xma.guidesign.XMAComposite, org.openxma.dsl.pom.model.GuiElement, org.openxma.dsl.pom.model.GuiElement,  org.openxma.dsl.pom.model.GuiElement, at.spardat.xma.guidesign.XMAWidget, at.spardat.xma.guidesign.XMAWidget, at.spardat.xma.guidesign.XMAWidget, at.spardat.xma.guidesign.XMAWidget);

/**
 * Create XMAFormData for all XMAWidgets which are ordered behind the main-XMAWidget
 */
XMAFormData createDefaultFormDataForNextGroupWidget(XMAWidget xmaWidget, XMAWidget mainWidget, XMAComposite parentComposite, ComposeData composeData, XMAWidget controlFieldPart, XMAWidget centeredWidget, XMAWidget prevWidgetInSet, XMAWidget nextWidgetInSet, SetOfGuiElements parentSetOfSimpleElements, int columnIndex, int padding, boolean attachNextWidgetsLeft2):

	let formData = new XMAFormData:
	let guiElement = xmaWidget.getGuiElementProperty():
	let fieldPart = xmaWidget.getFieldPartProperty():		
	let fieldPartSpecification = xmaWidget.getFieldPartSpecificationProperty():		
	let prevGuiElement = (prevWidgetInSet != null) ? prevWidgetInSet.getGuiElementProperty():null:
	let nextGuiElement = (nextWidgetInSet != null) ? nextWidgetInSet.getGuiElementProperty():null:

	let topAttachment = guiElement.getTopAttachment(fieldPart,fieldPartSpecification):
	let leftAttachment = guiElement.getLeftAttachment(fieldPartSpecification,prevGuiElement != guiElement):
	let rightAttachment = guiElement.getRightAttachment(fieldPartSpecification,nextGuiElement != guiElement):
	let bottomAttachment = guiElement.getBottomAttachment(fieldPart,fieldPartSpecification):

	//log("<> mainWidget="+mainWidget+", attachNextWidgetsLeft2="+attachNextWidgetsLeft2)->

	// Dimension
	setWidgetDimension(formData,guiElement,xmaWidget,fieldPartSpecification)->
	
	// Top
	(topAttachment != null)
		? formData.setTopAttach(topAttachment.createXMAAttachment(parentComposite,prevGuiElement,nextGuiElement,AttachmentOwnPosition::TOP))
		: formData.setTopAttach(createTopAttachment(topAttachment,parentComposite,guiElement,prevGuiElement,nextGuiElement,prevWidgetInSet,centeredWidget,controlFieldPart,xmaWidget))->

	// Left
	(leftAttachment != null)
		? formData.setLeftAttach(leftAttachment.createXMAAttachment(parentComposite,prevGuiElement,nextGuiElement,AttachmentOwnPosition::LEFT))
		: (let tabLeft = xmaWidget.getLeftTabulatorPosition(guiElement,parentSetOfSimpleElements,composeData,(""+columnIndex),false,false):
			((allowDefaultLeftAttachment(rightAttachment,formData,xmaWidget,guiElement,null,attachNextWidgetsLeft2,false,false,tabLeft != null))
			? ( let defaultLeftAttachment = createDefaultLeftAttachment(xmaWidget,composeData,tabLeft,false,false,prevWidgetInSet,nextWidgetInSet,attachNextWidgetsLeft2):
		 	    formData.setLeftAttach(defaultLeftAttachment))
		 	: null)) ->

	// Right
	(rightAttachment != null)
		? formData.setRightAttach(rightAttachment.createXMAAttachment(parentComposite,prevGuiElement,nextGuiElement,AttachmentOwnPosition::RIGHT))
		: (let tabRight = xmaWidget.getRightTabulatorPosition(guiElement,parentSetOfSimpleElements,composeData,(""+columnIndex),false,false):
			((allowDefaultRightAttachment(leftAttachment,formData,xmaWidget,guiElement,null,attachNextWidgetsLeft2,false,false,tabRight != null))
		 	? ( let defaultRightAttachment = createDefaultRightAttachment(xmaWidget,composeData,tabRight,false,false,prevWidgetInSet,nextWidgetInSet,attachNextWidgetsLeft2):
		 	    formData.setRightAttach(defaultRightAttachment))
		 	:null))->

	// Bottom
	(bottomAttachment != null)
		? formData.setBottomAttach(bottomAttachment.createXMAAttachment(parentComposite,prevGuiElement,nextGuiElement,AttachmentOwnPosition::BOTTOM))
		: ((parentSetOfSimpleElements.elements.size==1)
			? formData.setBottomAttach(createDefaultBottomAttachment(xmaWidget,composeData))
			: null)->

	// Set property for default attachment side of next widgets after widget
	( let attachNextWidgetsLeft = attachNextWidgetsLeft(xmaWidget,nextWidgetInSet,formData):
	  let parentSetOfSimpleElements = guiElement.eContainer:
	  parentSetOfSimpleElements.setProperty('attachNextWidgetsLeft',attachNextWidgetsLeft))->

	formData;

AttachmentSpecification getTopAttachment(GuiElement guiElement, FieldPart fieldPart, FieldPartSpecification fieldPartSpecification):
JAVA org.openxma.dsl.generator.helper.LayoutDataExtension.getTopAttachment(org.openxma.dsl.pom.model.GuiElement, org.openxma.dsl.pom.model.FieldPart, org.openxma.dsl.pom.model.FieldPartSpecification);

AttachmentSpecification getLeftAttachment(GuiElement guiElement, FieldPartSpecification fieldPartSpecification, Boolean useParentAttachment):
JAVA org.openxma.dsl.generator.helper.LayoutDataExtension.getLeftAttachment(org.openxma.dsl.pom.model.GuiElement, org.openxma.dsl.pom.model.FieldPartSpecification, java.lang.Boolean);

AttachmentSpecification getRightAttachment(GuiElement guiElement, FieldPartSpecification fieldPartSpecification, Boolean useParentAttachment):
JAVA org.openxma.dsl.generator.helper.LayoutDataExtension.getRightAttachment(org.openxma.dsl.pom.model.GuiElement, org.openxma.dsl.pom.model.FieldPartSpecification, java.lang.Boolean);


AttachmentSpecification getBottomAttachment(GuiElement guiElement, FieldPart fieldPart, FieldPartSpecification fieldPartSpecification):
JAVA org.openxma.dsl.generator.helper.LayoutDataExtension.getBottomAttachment(org.openxma.dsl.pom.model.GuiElement, org.openxma.dsl.pom.model.FieldPart, org.openxma.dsl.pom.model.FieldPartSpecification);




© 2015 - 2024 Weber Informatics LLC | Privacy Policy