use of org.entirej.framework.core.properties.interfaces.EJCanvasProperties in project rap by entirej.
the class EJRWTCanvasRetriever method addCanvasesFromContainer.
private static void addCanvasesFromContainer(EJCoreFormProperties formProperties, EJCanvasPropertiesContainer container, ArrayList<EJCanvasProperties> canvasList) {
Iterator<EJCanvasProperties> allCanvases = container.getAllCanvasProperties().iterator();
while (allCanvases.hasNext()) {
EJCanvasProperties canvas = allCanvases.next();
canvasList.add(canvas);
if (canvas.getType() == EJCanvasType.POPUP) {
addCanvasesFromContainer(formProperties, canvas.getPopupCanvasContainer(), canvasList);
} else if (canvas.getType() == EJCanvasType.TAB) {
Iterator<EJTabPageProperties> allTabPages = canvas.getTabPageContainer().getAllTabPageProperties().iterator();
while (allTabPages.hasNext()) {
addCanvasesFromContainer(formProperties, allTabPages.next().getContainedCanvases(), canvasList);
}
} else if (canvas.getType() == EJCanvasType.DRAWER) {
Iterator<EJDrawerPageProperties> allTabPages = canvas.getDrawerPageContainer().getAllDrawerPageProperties().iterator();
while (allTabPages.hasNext()) {
addCanvasesFromContainer(formProperties, allTabPages.next().getContainedCanvases(), canvasList);
}
} else if (canvas.getType() == EJCanvasType.STACKED) {
Iterator<EJStackedPageProperties> allStackedPages = canvas.getStackedPageContainer().getAllStackedPageProperties().iterator();
while (allStackedPages.hasNext()) {
addCanvasesFromContainer(formProperties, allStackedPages.next().getContainedCanvases(), canvasList);
}
} else if (canvas.getType() == EJCanvasType.GROUP) {
addCanvasesFromContainer(formProperties, canvas.getGroupCanvasContainer(), canvasList);
} else if (canvas.getType() == EJCanvasType.SPLIT) {
addCanvasesFromContainer(formProperties, canvas.getSplitCanvasContainer(), canvasList);
}
}
}
use of org.entirej.framework.core.properties.interfaces.EJCanvasProperties in project rap by entirej.
the class EJRWTCanvasRetriever method canvasExists.
/**
* Checks to see if there is already a canvas existing with the given name
*
* @param formProperties
* The form to check
* @param name
* The name of the canvas to check for
* @return <code>true</code> if the canvas exists, otherwise
* <code>false</code>
*/
public static boolean canvasExists(EJCoreFormProperties formProperties, String name) {
ArrayList<EJCanvasProperties> canvasList = new ArrayList<EJCanvasProperties>();
addCanvasesFromContainer(formProperties, formProperties.getCanvasContainer(), canvasList);
for (EJCanvasProperties canvas : canvasList) {
if (canvas.getName().equals(name)) {
return true;
}
}
return false;
}
use of org.entirej.framework.core.properties.interfaces.EJCanvasProperties in project rap by entirej.
the class EJRWTCanvasRetriever method retriveAllFormCanvases.
public static Collection<EJCanvasProperties> retriveAllFormCanvases(EJCoreFormProperties formProperties) {
ArrayList<EJCanvasProperties> formCanvasProperties = new ArrayList<EJCanvasProperties>();
Collection<EJCanvasProperties> retriveAllCanvases = retriveAllCanvases(formProperties);
for (EJCanvasProperties canvasProperties : retriveAllCanvases) {
if (canvasProperties.getType() == EJCanvasType.FORM) {
formCanvasProperties.add(canvasProperties);
}
}
return formCanvasProperties;
}
use of org.entirej.framework.core.properties.interfaces.EJCanvasProperties in project rap by entirej.
the class EJRWTFormRenderer method createGroupCanvas.
private void createGroupCanvas(Composite parent, final EJCanvasProperties canvasProperties, EJCanvasController canvasController) {
final EJRWTTrayPane trayPane = new EJRWTTrayPane(parent);
trayPane.setLayoutData(createCanvasGridData(canvasProperties));
EJ_RWT.setTestId(trayPane, _form.getProperties().getName() + "." + canvasProperties.getName());
parent = trayPane;
String frameTitle = canvasProperties.getGroupFrameTitle();
if (canvasProperties.getDisplayGroupFrame() && frameTitle != null && frameTitle.length() > 0) {
Group group = new Group(parent, SWT.NONE);
group.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_FORM);
group.setLayout(new FillLayout());
group.setLayoutData(createCanvasGridData(canvasProperties));
group.setText(frameTitle);
trayPane.initBase(group);
parent = group;
}
final EJRWTEntireJGridPane groupPane = new EJRWTEntireJGridPane(parent, canvasProperties.getNumCols(), canvasProperties.getDisplayGroupFrame() && (frameTitle == null || frameTitle.length() == 0) ? SWT.BORDER : SWT.NONE);
groupPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_FORM);
if (canvasProperties.getDisplayGroupFrame()) {
// .cleanLayoutTop();
} else {
// groupPane.cleanLayout();
}
groupPane.setPaneName(canvasProperties.getName());
if (!(canvasProperties.getDisplayGroupFrame() && frameTitle != null && frameTitle.length() > 0)) {
groupPane.setLayoutData(createCanvasGridData(canvasProperties));
trayPane.initBase(groupPane);
}
CanvasHandler canvasHandler = new CanvasHandler() {
private Collection<EJMessage> msgs;
@Override
public void clearCanvasMessages() {
this.msgs = null;
if (trayPane != null && !trayPane.isDisposed()) {
trayPane.closeTray();
}
}
@Override
public void setCanvasMessages(Collection<EJMessage> messages) {
this.msgs = messages;
if (trayPane != null && !trayPane.isDisposed()) {
if (trayPane.getTray() != null) {
trayPane.closeTray();
}
{
MessageTray messageTray = new MessageTray(canvasProperties.getCloseableMessagePane()) {
@Override
void close() {
if (trayPane != null && !trayPane.isDisposed()) {
trayPane.closeTray();
}
}
};
messageTray.setMessages(msgs);
TrayLocation location = TrayLocation.RIGHT;
switch(canvasProperties.getMessagePosition()) {
case BOTTOM:
location = TrayLocation.BOTTOM;
break;
case LEFT:
location = TrayLocation.LEFT;
break;
case RIGHT:
location = TrayLocation.RIGHT;
break;
case TOP:
location = TrayLocation.TOP;
break;
default:
break;
}
trayPane.openTray(location, messageTray, canvasProperties.getMessagePaneSize());
}
}
}
@Override
public void add(EJInternalBlock block) {
EJRWTAppBlockRenderer blockRenderer = (EJRWTAppBlockRenderer) block.getRendererController().getRenderer();
if (blockRenderer == null) {
throw new EJApplicationException(new EJMessage("Block " + block.getProperties().getName() + " has a canvas defined but no renderer. A block cannot be rendererd if no canvas has been defined."));
}
blockRenderer.buildGuiComponent(groupPane);
trayPane.setLayoutData(groupPane.getLayoutData());
}
@Override
public EJCanvasType getType() {
return EJCanvasType.BLOCK;
}
};
_canvases.put(groupPane.getPaneName(), canvasHandler);
_canvasesIds.add(groupPane.getPaneName());
EJInternalBlock block = _blocks.get(groupPane.getPaneName());
if (block != null) {
canvasHandler.add(block);
}
if (!canvasProperties.getCloseableMessagePane()) {
canvasHandler.setCanvasMessages(Collections.<EJMessage>emptyList());
}
if (canvasProperties.getType() == EJCanvasType.GROUP) {
for (EJCanvasProperties containedCanvas : canvasProperties.getGroupCanvasContainer().getAllCanvasProperties()) {
switch(containedCanvas.getType()) {
case BLOCK:
case GROUP:
createGroupCanvas(groupPane, containedCanvas, canvasController);
break;
case FORM:
createFormCanvas(groupPane, containedCanvas, canvasController);
break;
case SEPARATOR:
createSeparatorCanvas(groupPane, containedCanvas);
break;
case SPLIT:
createSplitCanvas(groupPane, containedCanvas, canvasController);
break;
case STACKED:
createStackedCanvas(groupPane, containedCanvas, canvasController);
break;
case TAB:
createTabCanvas(groupPane, containedCanvas, canvasController);
break;
case DRAWER:
createDrawerCanvas(groupPane, containedCanvas, canvasController);
break;
case POPUP:
throw new AssertionError();
}
}
}
}
use of org.entirej.framework.core.properties.interfaces.EJCanvasProperties in project rap by entirej.
the class EJRWTFormRenderer method initialiseForm.
@Override
public void initialiseForm(EJInternalForm form) {
EJParameterChecker.checkNotNull(form, "initialiseForm", "formController");
_form = form;
// build all form canvases
Collection<EJCanvasProperties> allFormCanvases = EJRWTCanvasRetriever.retriveAllFormCanvases(_form.getProperties());
for (EJCanvasProperties formCanvas : allFormCanvases) {
if (formCanvas.getReferredFormId() != null && formCanvas.getReferredFormId().length() > 0) {
final String name = formCanvas.getName();
_form.addEmbeddedForm(formCanvas.getReferredFormId(), name, null);
}
}
}
Aggregations