use of org.entirej.applicationframework.rwt.application.form.containers.EJRWTTrayDialog.TrayLocation 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.applicationframework.rwt.application.form.containers.EJRWTTrayDialog.TrayLocation in project rap by entirej.
the class EJRWTFormRenderer method createFormCanvas.
private void createFormCanvas(Composite parent, final EJCanvasProperties canvasProperties, EJCanvasController canvasController) {
final EJRWTTrayPane trayPane = new EJRWTTrayPane(parent);
trayPane.setLayoutData(createCanvasGridData(canvasProperties));
parent = trayPane;
final String name = canvasProperties.getName();
Composite stackedPane = new Composite(parent, SWT.NONE);
stackedPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_FORM);
stackedPane.setLayout(new FillLayout());
stackedPane.setLayoutData(createCanvasGridData(canvasProperties));
EJ_RWT.setTestId(trayPane, _form.getProperties().getName() + "." + canvasProperties.getName());
_formPanes.put(name, stackedPane);
trayPane.initBase(stackedPane);
_canvasesIds.add(name);
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) {
}
@Override
public EJCanvasType getType() {
return EJCanvasType.FORM;
}
};
_canvases.put(canvasProperties.getName(), canvasHandler);
if (!canvasProperties.getCloseableMessagePane()) {
canvasHandler.setCanvasMessages(Collections.<EJMessage>emptyList());
}
if (canvasProperties.getReferredFormId() != null && canvasProperties.getReferredFormId().length() > 0) {
_form.openEmbeddedForm(canvasProperties.getReferredFormId(), name, null);
}
if (_formPanesCache.containsKey(name)) {
openEmbeddedForm(_formPanesCache.get(name));
_formPanesCache.remove(name);
}
}
use of org.entirej.applicationframework.rwt.application.form.containers.EJRWTTrayDialog.TrayLocation in project rap by entirej.
the class EJRWTFormRenderer method createTabCanvas.
private void createTabCanvas(Composite parent, final EJCanvasProperties canvasProperties, final EJCanvasController canvasController) {
int style = SWT.FLAT;
EJFrameworkExtensionProperties rendererProp = EJCoreProperties.getInstance().getApplicationDefinedProperties();
if (rendererProp != null) {
boolean displayBorder = rendererProp.getBooleanProperty("DISPLAY_TAB_BORDER", false);
if (displayBorder) {
style = SWT.FLAT | SWT.BORDER;
}
}
switch(canvasProperties.getTabPosition()) {
case BOTTOM:
style = style | SWT.BOTTOM;
break;
case LEFT:
style = style | SWT.LEFT;
break;
case RIGHT:
style = style | SWT.RIGHT;
break;
default:
style = style | SWT.TOP;
break;
}
final String name = canvasProperties.getName();
final EJRWTTrayPane trayPane = new EJRWTTrayPane(parent);
EJ_RWT.setTestId(trayPane, _form.getProperties().getName() + "." + canvasProperties.getName());
trayPane.setLayoutData(createCanvasGridData(canvasProperties));
parent = trayPane;
ITabFolder folder = null;
CTabFolder cfolder = new CTabFolder(parent, style);
cfolder.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_FORM);
final EJTabFolder tabFolder = new EJTabFolder(this, cfolder, canvasController);
trayPane.initBase(tabFolder.getFolder());
cfolder.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
canvasController.tabPageChanged(name, tabFolder.getActiveKey());
EJ_RWT.setAttribute(cfolder, "ej-item-selection", tabFolder.getActiveKey());
}
});
folder = tabFolder;
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) {
}
@Override
public EJCanvasType getType() {
return EJCanvasType.TAB;
}
};
_canvases.put(canvasProperties.getName(), canvasHandler);
if (!canvasProperties.getCloseableMessagePane()) {
canvasHandler.setCanvasMessages(Collections.<EJMessage>emptyList());
}
_tabFolders.put(name, folder);
folder.getFolder().setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
Collection<EJTabPageProperties> allTabPageProperties = canvasProperties.getTabPageContainer().getAllTabPageProperties();
int index = 0;
for (EJTabPageProperties page : allTabPageProperties) {
ITabFolder.ITab tab = folder.newTab(page);
if (page.isVisible()) {
tab.create(index == 0);
}
tab.setIndex(index);
index++;
folder.put(page.getName(), tab);
}
if (_tabFoldersCache.containsKey(name)) {
folder.showPage(_tabFoldersCache.get(name));
_tabFoldersCache.remove(name);
}
_canvasesIds.add(name);
}
use of org.entirej.applicationframework.rwt.application.form.containers.EJRWTTrayDialog.TrayLocation in project rap by entirej.
the class EJRWTFormRenderer method createStackedCanvas.
private void createStackedCanvas(Composite parent, final EJCanvasProperties canvasProperties, final EJCanvasController canvasController) {
final String name = canvasProperties.getName();
final EJRWTTrayPane trayPane = new EJRWTTrayPane(parent);
trayPane.setLayoutData(createCanvasGridData(canvasProperties));
parent = trayPane;
final EJRWTEntireJStackedPane stackedPane = new EJRWTEntireJStackedPane(parent);
trayPane.initBase(stackedPane);
stackedPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_FORM);
stackedPane.setLayoutData(createCanvasGridData(canvasProperties));
_stackedPanes.put(name, stackedPane);
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) {
}
@Override
public EJCanvasType getType() {
return EJCanvasType.STACKED;
}
};
_canvases.put(canvasProperties.getName(), canvasHandler);
if (!canvasProperties.getCloseableMessagePane()) {
canvasHandler.setCanvasMessages(Collections.<EJMessage>emptyList());
}
for (final EJStackedPageProperties page : canvasProperties.getStackedPageContainer().getAllStackedPageProperties()) {
stackedPane.add(page.getName(), new EJRWTEntireJStackedPane.StackedPage() {
Control control;
@Override
public String getKey() {
return page.getName();
}
@Override
public Control getControl() {
if (control != null && !control.isDisposed()) {
return control;
}
final ScrolledComposite scrollComposite = new EJRWTScrolledComposite(stackedPane, SWT.V_SCROLL | SWT.H_SCROLL);
control = scrollComposite;
final EJRWTEntireJGridPane pagePane = new EJRWTEntireJGridPane(scrollComposite, page.getNumCols());
pagePane.cleanLayout();
int width = 0;
int height = 0;
for (EJCanvasProperties properties : page.getContainedCanvases().getAllCanvasProperties()) {
createCanvas(pagePane, properties, canvasController);
int width2 = properties.getWidth();
int height2 = properties.getHeight();
if (properties.getBlockProperties() != null) {
width2 = properties.getBlockProperties().getMainScreenProperties().getWidth();
height2 = properties.getBlockProperties().getMainScreenProperties().getHeight();
}
if (width < width2) {
width = width2;
}
if (height < height2) {
height = height2;
}
}
scrollComposite.setContent(pagePane);
scrollComposite.setMinSize(width, height);
scrollComposite.setExpandHorizontal(true);
scrollComposite.setExpandVertical(true);
scrollComposite.setContent(pagePane);
stackedPane.layout();
return control;
}
});
}
if (canvasProperties.getInitialStackedPageName() != null) {
stackedPane.showPane(canvasProperties.getInitialStackedPageName());
}
if (_stackedPanesCache.containsKey(name)) {
stackedPane.showPane(_stackedPanesCache.get(name));
_stackedPanesCache.remove(name);
}
_canvasesIds.add(name);
}
use of org.entirej.applicationframework.rwt.application.form.containers.EJRWTTrayDialog.TrayLocation in project rap by entirej.
the class EJRWTFormRenderer method createDrawerCanvas.
private void createDrawerCanvas(Composite parent, final EJCanvasProperties canvasProperties, final EJCanvasController canvasController) {
int style = SWT.NONE;
final String name = canvasProperties.getName();
final EJRWTTrayPane trayPane = new EJRWTTrayPane(parent);
trayPane.setLayoutData(createCanvasGridData(canvasProperties));
EJ_RWT.setTestId(trayPane, _form.getProperties().getName() + "." + canvasProperties.getName());
parent = trayPane;
EJDrawerFolder folder = null;
final EJDrawerFolder tabFolder = new EJDrawerFolder(this, canvasController, parent, style) {
@Override
protected void selection(String page) {
canvasController.drawerPageChanged(name, page);
EJ_RWT.setAttribute(getFolder(), "ej-item-selection", page);
}
};
// tabFolder.setDefaultWidth(canvasProperties.getWidth());
tabFolder.setPosition(canvasProperties.getDrawerPosition());
tabFolder.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_FORM);
trayPane.initBase(tabFolder.getFolder());
folder = tabFolder;
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) {
}
@Override
public EJCanvasType getType() {
return EJCanvasType.TAB;
}
};
_canvases.put(canvasProperties.getName(), canvasHandler);
if (!canvasProperties.getCloseableMessagePane()) {
canvasHandler.setCanvasMessages(Collections.<EJMessage>emptyList());
}
_drawerFolders.put(name, folder);
folder.getFolder().setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
Collection<EJDrawerPageProperties> allTabPageProperties = canvasProperties.getDrawerPageContainer().getAllDrawerPageProperties();
int index = 0;
for (EJDrawerPageProperties page : allTabPageProperties) {
DrawerTab tab = folder.newTab(page);
if (page.isVisible()) {
tab.create(index == 0);
}
tab.setIndex(index);
index++;
folder.put(page.getName(), tab);
}
if (_drawerFoldersCache.containsKey(name)) {
folder.showPage(_drawerFoldersCache.get(name));
_drawerFoldersCache.remove(name);
}
_canvasesIds.add(name);
}
Aggregations