use of org.entirej.framework.core.properties.EJCoreLayoutItem in project rap by entirej.
the class EJRWTApplicationContainer method createSplitLayout.
private void createSplitLayout(Composite parent, EJCoreLayoutItem.SplitGroup group) {
SashForm layoutBody = new SashForm(parent, group.getOrientation() == ORIENTATION.HORIZONTAL ? SWT.HORIZONTAL : SWT.VERTICAL);
layoutBody.setLayoutData(createGridData(group));
EJ_RWT.setTestId(layoutBody, group.getName());
List<EJCoreLayoutItem> items = group.getItems();
if (items.size() > 0) {
int[] weights = new int[items.size()];
for (EJCoreLayoutItem item : items) {
weights[items.indexOf(item)] = item.getHintWidth() + 1;
switch(item.getType()) {
case GROUP:
createGroupLayout(layoutBody, (LayoutGroup) item);
break;
case SPACE:
createSpace(layoutBody, (LayoutSpace) item);
break;
case COMPONENT:
createComponent(layoutBody, (LayoutComponent) item);
break;
case SPLIT:
createSplitLayout(layoutBody, (SplitGroup) item);
break;
case TAB:
createTabLayout(layoutBody, (TabGroup) item);
break;
}
}
layoutBody.setWeights(weights);
} else {
layoutBody.setLayout(new GridLayout());
Label compLabel = new Label(layoutBody, SWT.NONE);
compLabel.setLayoutData(new GridData(GridData.FILL_BOTH));
}
layoutBody.setBackground(parent.getBackground());
}
use of org.entirej.framework.core.properties.EJCoreLayoutItem in project rap by entirej.
the class EJRWTApplicationContainer method createTabLayout.
private void createTabLayout(Composite parent, final EJCoreLayoutItem.TabGroup group) {
final CTabFolder layoutBody = new CTabFolder(parent, SWT.BORDER | (group.getOrientation() == TabGroup.ORIENTATION.TOP ? SWT.TOP : SWT.BOTTOM));
final EJAppTabFolder appTabFolder = new EJAppTabFolder(this, layoutBody);
_tabFolders.put(group.getName(), appTabFolder);
EJ_RWT.setTestId(layoutBody, group.getName());
layoutBody.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
EJApplicationActionProcessor applicationActionProcessor = _applicationManager.getApplicationActionProcessor();
if (applicationActionProcessor != null) {
CTabItem selection = layoutBody.getSelection();
if (selection == null) {
return;
}
try {
String pageName = (String) selection.getData("TAB_KEY");
applicationActionProcessor.preShowTabPage(_applicationManager.getFrameworkManager(), group.getName(), pageName);
} catch (EJActionProcessorException e1) {
if (appTabFolder.getLastSelection() != null) {
appTabFolder.showPage(appTabFolder.getLastSelection());
}
if (e1.getFrameworkMessage() != null)
_applicationManager.handleMessage(e1.getFrameworkMessage());
return;
}
try {
String pageName = (String) selection.getData("TAB_KEY");
appTabFolder.setLastSelection(pageName);
applicationActionProcessor.tabPageChanged(_applicationManager.getFrameworkManager(), group.getName(), pageName);
} catch (EJActionProcessorException e1) {
e1.printStackTrace();
}
}
}
});
layoutBody.setLayoutData(createGridData(group));
List<EJCoreLayoutItem> items = group.getItems();
for (EJCoreLayoutItem item : items) {
CTabItem tabItem = new CTabItem(layoutBody, SWT.NONE);
appTabFolder.put(item.getName(), tabItem);
Composite composite = new Composite(layoutBody, SWT.NO_FOCUS);
composite.setData(EJ_RWT.CUSTOM_VARIANT, "applayout");
composite.setData("TAB_ITEM", tabItem);
composite.setData("TAB_KEY", item.getName());
EJ_RWT.setTestId(tabItem, group.getName() + "." + item.getName());
tabItem.setData("TAB_KEY", item.getName());
composite.setLayout(new GridLayout());
tabItem.setControl(composite);
tabItem.setText(item.getTitle() != null ? item.getTitle() : item.getName());
switch(item.getType()) {
case GROUP:
createGroupLayout(composite, (LayoutGroup) item);
break;
case SPACE:
createSpace(composite, (LayoutSpace) item);
break;
case COMPONENT:
createComponent(composite, (LayoutComponent) item);
break;
case SPLIT:
createSplitLayout(composite, (SplitGroup) item);
break;
case TAB:
createTabLayout(composite, (TabGroup) item);
break;
}
}
if (items.size() > 0) {
layoutBody.setSelection(0);
}
}
use of org.entirej.framework.core.properties.EJCoreLayoutItem in project rap by entirej.
the class EJRWTApplicationContainer method buildApplicationContainer.
protected void buildApplicationContainer() {
GridLayout gridLayout = new GridLayout(_layoutContainer.getColumns(), false);
_mainPane.setLayout(gridLayout);
List<EJCoreLayoutItem> items = _layoutContainer.getItems();
for (EJCoreLayoutItem item : items) {
switch(item.getType()) {
case GROUP:
createGroupLayout(_mainPane, (LayoutGroup) item);
break;
case SPACE:
createSpace(_mainPane, (LayoutSpace) item);
break;
case COMPONENT:
createComponent(_mainPane, (LayoutComponent) item);
break;
case SPLIT:
createSplitLayout(_mainPane, (SplitGroup) item);
break;
case TAB:
createTabLayout(_mainPane, (TabGroup) item);
break;
}
}
_mainPane.layout();
if (_formContainer != null) {
for (EJRWTApplicationComponent applicationComponent : _addedComponents) {
if (applicationComponent instanceof EJRWTFormSelectedListener) {
_formContainer.addFormSelectedListener(applicationComponent);
}
}
}
for (EJRWTSingleFormContainer singleFormContainer : _singleFormContainers) {
if (singleFormContainer.getForm() != null) {
fireFormOpened(singleFormContainer.getForm());
}
}
}
use of org.entirej.framework.core.properties.EJCoreLayoutItem in project rap by entirej.
the class EJRWTApplicationContainer method createGroupLayout.
private void createGroupLayout(Composite parent, EJCoreLayoutItem.LayoutGroup group) {
Composite layoutBody = new Composite(parent, SWT.NO_FOCUS | (group.isBorder() ? SWT.BORDER : SWT.NONE));
layoutBody.setLayoutData(createGridData(group));
layoutBody.setData(EJ_RWT.CUSTOM_VARIANT, "applayout");
EJ_RWT.setTestId(layoutBody, group.getName());
List<EJCoreLayoutItem> items = group.getItems();
if (items.size() > 0) {
GridLayout gridLayout = new GridLayout(group.getColumns(), false);
if (group.isHideMargin()) {
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
}
layoutBody.setLayout(gridLayout);
for (EJCoreLayoutItem item : items) {
switch(item.getType()) {
case GROUP:
createGroupLayout(layoutBody, (LayoutGroup) item);
break;
case SPACE:
createSpace(layoutBody, (LayoutSpace) item);
break;
case COMPONENT:
createComponent(layoutBody, (LayoutComponent) item);
break;
case SPLIT:
createSplitLayout(layoutBody, (SplitGroup) item);
break;
case TAB:
createTabLayout(layoutBody, (TabGroup) item);
break;
}
}
} else {
layoutBody.setLayout(new GridLayout());
Label compLabel = new Label(layoutBody, SWT.NONE);
compLabel.setLayoutData(new GridData(GridData.FILL_BOTH));
}
}
Aggregations