use of org.entirej.framework.core.actionprocessor.interfaces.EJApplicationActionProcessor 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.actionprocessor.interfaces.EJApplicationActionProcessor in project rap by entirej.
the class EJRWTBanner method createContainer.
@Override
public void createContainer(final EJRWTApplicationManager manager, Composite parent, final EJFrameworkExtensionProperties rendererprop) {
canvas = new Label(parent, getComponentStyle(rendererprop.getStringProperty(PROPERTY_ALIGNMENT), SWT.NONE));
canvas.setLayoutData(new GridData(GridData.FILL_BOTH));
String imagePath = null;
if (rendererprop != null) {
String paramName = rendererprop.getStringProperty(IMAGE_PARAM);
final String action = rendererprop.getStringProperty(ACTION);
if (action != null && !action.isEmpty()) {
final Cursor cursor = new Cursor(canvas.getDisplay(), SWT.CURSOR_HAND);
canvas.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent event) {
cursor.dispose();
}
});
canvas.setCursor(cursor);
canvas.addMouseListener(new MouseAdapter() {
@Override
public void mouseUp(MouseEvent e) {
EJApplicationActionProcessor applicationActionProcessor = manager.getApplicationActionProcessor();
if (applicationActionProcessor != null) {
try {
applicationActionProcessor.executeActionCommand(manager.getFrameworkManager(), action);
} catch (EJActionProcessorException e1) {
e1.printStackTrace();
}
}
}
});
}
if (paramName != null && paramName.length() > 0) {
final EJApplicationLevelParameter applicationLevelParameter = manager.getApplicationLevelParameter(paramName);
if (applicationLevelParameter != null) {
Object value = applicationLevelParameter.getValue();
imagePath = (String) value;
if (imagePath != null) {
updateImage(manager, imagePath);
} else {
imagePath = rendererprop.getStringProperty(IMAGE_PATH);
updateImage(manager, imagePath);
}
applicationLevelParameter.addParameterChangedListener(new ParameterChangedListener() {
@Override
public void parameterChanged(String parameterName, Object oldValue, Object newValue) {
if (newValue != null) {
updateImage(manager, (String) newValue);
} else {
updateImage(manager, rendererprop.getStringProperty(IMAGE_PATH));
}
}
});
} else {
imagePath = rendererprop.getStringProperty(IMAGE_PATH);
updateImage(manager, imagePath);
}
} else {
imagePath = rendererprop.getStringProperty(IMAGE_PATH);
updateImage(manager, imagePath);
}
}
}
Aggregations