use of org.entirej.framework.core.renderers.EJManagedItemRendererWrapper in project rap by entirej.
the class EJRWTUpdateScreenRenderer method setupUpdateScreen.
private void setupUpdateScreen() {
// Setup pane for query window
EJFrameworkExtensionProperties rendererProperties = _block.getProperties().getUpdateScreenRendererProperties();
String title = rendererProperties.getStringProperty(EJRWTScreenRendererDefinitionProperties.TITLE);
final int width = rendererProperties.getIntProperty(EJRWTScreenRendererDefinitionProperties.WIDTH, 300);
final int height = rendererProperties.getIntProperty(EJRWTScreenRendererDefinitionProperties.HEIGHT, 500);
_maximize = rendererProperties.getBooleanProperty(EJRWTScreenRendererDefinitionProperties.MAXIMIZE, false);
final int numCols = rendererProperties.getIntProperty(EJRWTScreenRendererDefinitionProperties.NUM_COLS, 1);
final String updateButtonLabel = rendererProperties.getStringProperty(EJRWTScreenRendererDefinitionProperties.EXECUTE_BUTTON_TEXT);
final String cancelButtonLabel = rendererProperties.getStringProperty(EJRWTScreenRendererDefinitionProperties.CANCEL_BUTTON_TEXT);
EJFrameworkExtensionProperties extraButtonsGroup = rendererProperties.getPropertyGroup(EJRWTScreenRendererDefinitionProperties.EXTRA_BUTTONS_GROUP);
final String button1Label = extraButtonsGroup.getStringProperty(EJRWTScreenRendererDefinitionProperties.EXTRA_BUTTON_ONE_LABEL);
final String button1Command = extraButtonsGroup.getStringProperty(EJRWTScreenRendererDefinitionProperties.EXTRA_BUTTON_ONE_COMMAND);
final String button2Label = extraButtonsGroup.getStringProperty(EJRWTScreenRendererDefinitionProperties.EXTRA_BUTTON_TWO_LABEL);
final String button2Command = extraButtonsGroup.getStringProperty(EJRWTScreenRendererDefinitionProperties.EXTRA_BUTTON_TWO_COMMAND);
final String button3Label = extraButtonsGroup.getStringProperty(EJRWTScreenRendererDefinitionProperties.EXTRA_BUTTON_THREE_LABEL);
final String button3Command = extraButtonsGroup.getStringProperty(EJRWTScreenRendererDefinitionProperties.EXTRA_BUTTON_THREE_COMMAND);
final String button4Label = extraButtonsGroup.getStringProperty(EJRWTScreenRendererDefinitionProperties.EXTRA_BUTTON_FOUR_LABEL);
final String button4Command = extraButtonsGroup.getStringProperty(EJRWTScreenRendererDefinitionProperties.EXTRA_BUTTON_FOUR_COMMAND);
final String button5Label = extraButtonsGroup.getStringProperty(EJRWTScreenRendererDefinitionProperties.EXTRA_BUTTON_FIVE_LABEL);
final String button5Command = extraButtonsGroup.getStringProperty(EJRWTScreenRendererDefinitionProperties.EXTRA_BUTTON_FIVE_COMMAND);
final int ID_BUTTON_1 = 1;
final int ID_BUTTON_2 = 2;
final int ID_BUTTON_3 = 3;
final int ID_BUTTON_4 = 4;
final int ID_BUTTON_5 = 5;
_updateDialog = new EJRWTAbstractDialog(getRWTManager().getShell()) {
@Override
public void createBody(Composite parent) {
EJ_RWT.setTestId(parent, _block.getProperties().getName() + ".update-screen");
parent.setLayout(new FillLayout());
final ScrolledComposite scrollComposite = new EJRWTScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
EJRWTEntireJGridPane _mainPane = new EJRWTEntireJGridPane(scrollComposite, numCols);
_mainPane.cleanLayout();
EJBlockProperties blockProperties = _block.getProperties();
addAllItemGroups(blockProperties.getScreenItemGroupContainer(EJScreenType.UPDATE), _mainPane, EJScreenType.UPDATE);
scrollComposite.setContent(_mainPane);
scrollComposite.setExpandHorizontal(true);
scrollComposite.setExpandVertical(true);
// remove the offset
scrollComposite.setMinSize(width, height - 10);
_block.addItemValueChangedListener(EJRWTUpdateScreenRenderer.this);
EJRWTItemTextChangeNotifier.ChangeListener changeListener = new ChangeListener() {
@Override
public void changed() {
validate();
}
};
Collection<EJManagedItemRendererWrapper> registeredRenderers = _itemRegister.getRegisteredRenderers();
for (EJManagedItemRendererWrapper ejManagedItemRendererWrapper : registeredRenderers) {
if (ejManagedItemRendererWrapper.getUnmanagedRenderer() instanceof EJRWTItemTextChangeNotifier) {
((EJRWTItemTextChangeNotifier) ejManagedItemRendererWrapper.getUnmanagedRenderer()).addListener(changeListener);
}
}
}
@Override
public int open() {
validate();
setFoucsItemRenderer();
return super.open();
}
@Override
protected void createButtonsForButtonBar(Composite parent) {
// Add the buttons in reverse order, as they will be added from
// left to right
addExtraButton(parent, button5Label, ID_BUTTON_5);
addExtraButton(parent, button4Label, ID_BUTTON_4);
addExtraButton(parent, button3Label, ID_BUTTON_3);
addExtraButton(parent, button2Label, ID_BUTTON_2);
addExtraButton(parent, button1Label, ID_BUTTON_1);
EJ_RWT.setTestId(createButton(parent, UPDATE_OK_ACTION_COMMAND, updateButtonLabel == null ? "Update" : updateButtonLabel, true), _block.getProperties().getName() + ".ok");
EJ_RWT.setTestId(createButton(parent, UPDATE_CANCEL_ACTION_COMMAND, cancelButtonLabel == null ? "Cancel" : cancelButtonLabel, false), _block.getProperties().getName() + ".cancel");
}
@Override
public void validate() {
Button button = getButton(UPDATE_OK_ACTION_COMMAND);
if (button == null) {
return;
}
Collection<EJScreenItemController> allScreenItems = _block.getAllScreenItems(EJScreenType.UPDATE);
for (EJScreenItemController ejScreenItemController : allScreenItems) {
if (!ejScreenItemController.getManagedItemRenderer().isValid()) {
button.setEnabled(false);
return;
}
}
button.setEnabled(true);
}
private void addExtraButton(Composite parent, String label, int id) {
if (label == null) {
return;
}
Button button = createButton(parent, id, label, false);
EJ_RWT.setTestId(button, _block.getProperties().getName() + ".btn-" + id);
}
@Override
public boolean close() {
_block.removeItemValueChangedListener(EJRWTUpdateScreenRenderer.this);
_block.setRendererFocus(true);
return super.close();
}
@Override
public void canceled() {
_block.updateCancelled();
close();
}
@Override
protected void buttonPressed(int buttonId) {
Display.getDefault().asyncExec(() -> {
try {
switch(buttonId) {
case UPDATE_OK_ACTION_COMMAND:
{
try {
_block.getBlock().updateRecord(_itemRegister.getRegisteredRecord());
if (_block.getUpdateScreenDisplayProperties().getBooleanProperty(EJRWTScreenRendererDefinitionProperties.SAVE_FORM_AFTER_EXECUTE, false)) {
_block.getBlock().getForm().saveChanges();
}
} catch (EJApplicationException e) {
setButtonEnable(buttonId, false);
throw e;
}
close();
break;
}
case UPDATE_CANCEL_ACTION_COMMAND:
{
_block.updateCancelled();
close();
break;
}
case ID_BUTTON_1:
{
_block.executeActionCommand(button1Command, EJScreenType.UPDATE);
break;
}
case ID_BUTTON_2:
{
_block.executeActionCommand(button2Command, EJScreenType.UPDATE);
break;
}
case ID_BUTTON_3:
{
_block.executeActionCommand(button3Command, EJScreenType.UPDATE);
break;
}
case ID_BUTTON_4:
{
_block.executeActionCommand(button4Command, EJScreenType.UPDATE);
break;
}
case ID_BUTTON_5:
{
_block.executeActionCommand(button5Command, EJScreenType.UPDATE);
break;
}
default:
_block.updateCancelled();
break;
}
} catch (EJApplicationException e) {
_logger.trace(e.getMessage());
_frameworkManager.handleException(e);
return;
}
});
}
};
_updateDialog.create();
_updateDialog.getShell().setData("UPDATE - " + _block.getProperties().getName());
_updateDialog.getShell().setText(title != null ? title : "");
// add dialog border offsets
_updateDialog.getShell().setSize(width + 80, height + 100);
}
use of org.entirej.framework.core.renderers.EJManagedItemRendererWrapper in project rap by entirej.
the class EJRWTUpdateScreenRenderer method open.
@Override
public void open(EJDataRecord recordToUpdate) {
_itemRegister.resetRegister();
setupUpdateScreen();
_itemRegister.register(recordToUpdate);
Collection<EJManagedItemRendererWrapper> registeredRenderers = _itemRegister.getRegisteredRenderers();
for (EJManagedItemRendererWrapper wrapper : registeredRenderers) {
if (wrapper.getUnmanagedRenderer() instanceof EJRWTComboItemRenderer) {
if (((EJRWTComboItemRenderer) wrapper.getUnmanagedRenderer()).isLovInitialiedOnValueSet())
wrapper.getUnmanagedRenderer().refreshItemRenderer();
}
}
_updateDialog.centreLocation();
if (_maximize) {
_updateDialog.getShell().setMaximized(_maximize);
}
_updateDialog.open();
_updateDialog.activateDialog();
}
use of org.entirej.framework.core.renderers.EJManagedItemRendererWrapper in project rap by entirej.
the class EJRWTBarChartRecordBlockRenderer method buildGuiComponent.
@Override
public void buildGuiComponent(EJRWTEntireJGridPane blockCanvas) {
EJFrameworkExtensionProperties appProp = EJCoreProperties.getInstance().getApplicationDefinedProperties();
if (appProp != null) {
EJFrameworkExtensionProperties propertyGroup = appProp.getPropertyGroup(EJRWTSingleRecordBlockDefinitionProperties.ACTION_GROUP);
if (propertyGroup != null) {
addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_QUERY_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_QUERY_KEY);
addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_INSERT_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_INSERT_KEY);
addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_UPDATE_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_UPDATE_KEY);
addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_DELETE_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_DELETE_KEY);
addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_REFRESH_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_REFRESH_KEY);
}
}
EJBlockProperties blockProperties = _block.getProperties();
EJMainScreenProperties mainScreenProperties = blockProperties.getMainScreenProperties();
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.widthHint = mainScreenProperties.getWidth();
gridData.heightHint = mainScreenProperties.getHeight();
gridData.horizontalSpan = mainScreenProperties.getHorizontalSpan();
gridData.verticalSpan = mainScreenProperties.getVerticalSpan();
gridData.grabExcessHorizontalSpace = mainScreenProperties.canExpandHorizontally();
gridData.grabExcessVerticalSpace = mainScreenProperties.canExpandVertically();
if (gridData.grabExcessHorizontalSpace) {
gridData.minimumWidth = mainScreenProperties.getWidth();
}
if (gridData.grabExcessVerticalSpace) {
gridData.minimumHeight = mainScreenProperties.getHeight();
}
_rendererProp = blockProperties.getBlockRendererProperties();
blockCanvas.setLayoutData(gridData);
EJFrameworkExtensionProperties sectionProperties = null;
if (_rendererProp != null) {
sectionProperties = _rendererProp.getPropertyGroup(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR);
}
if (sectionProperties != null && sectionProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE) != null && !EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE_GROUP.equals(sectionProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE))) {
int style = ExpandableComposite.TITLE_BAR;
String mode = sectionProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE);
if (EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE_TWISTIE.equals(mode)) {
style = style | ExpandableComposite.TWISTIE;
} else if (EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE_TREE_NODE.equals(mode)) {
style = style | ExpandableComposite.TREE_NODE;
}
if (sectionProperties.getBooleanProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_EXPANDED, true)) {
style = style | ExpandableComposite.EXPANDED;
}
Section section = toolkit.createSection(blockCanvas, style);
section.setLayoutData(gridData);
String title = sectionProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_TITLE);
if (title != null) {
section.setText(title);
}
EJRWTImageRetriever.getGraphicsProvider().rendererSection(section);
String frameTitle = mainScreenProperties.getFrameTitle();
if (mainScreenProperties.getDisplayFrame() && frameTitle != null && frameTitle.length() > 0) {
Group group = new Group(section, SWT.NONE);
group.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
group.setLayout(new FillLayout());
group.setLayoutData(gridData);
hookKeyListener(group);
group.setText(frameTitle);
_mainPane = new EJRWTEntireJGridPane(group, 1, mainScreenProperties.getDisplayFrame() ? SWT.BORDER : SWT.NONE);
_mainPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
section.setClient(group);
} else {
_mainPane = new EJRWTEntireJGridPane(section, 1);
_mainPane.setLayoutData(gridData);
_mainPane.cleanLayoutHorizontal();
_mainPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
section.setClient(_mainPane);
}
final EJFrameworkExtensionPropertyList propertyList = sectionProperties.getPropertyList(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTIONS);
if (propertyList != null && propertyList.getAllListEntries().size() > 0) {
ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
final ToolBar toolbar = toolBarManager.createControl(section);
final Cursor handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
toolbar.setCursor(handCursor);
// Cursor needs to be explicitly disposed
toolbar.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
if (handCursor != null && handCursor.isDisposed() == false) {
handCursor.dispose();
}
}
});
List<EJFrameworkExtensionPropertyListEntry> allListEntries = propertyList.getAllListEntries();
for (EJFrameworkExtensionPropertyListEntry entry : allListEntries) {
final String actionID = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_ID);
String actionImage = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_IMAGE);
String actionName = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_NAME);
String actionTooltip = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_TOOLTIP);
if (actionID != null) {
Action action = new Action(actionID, IAction.AS_PUSH_BUTTON) {
@Override
public void runWithEvent(Event event) {
_block.executeActionCommand(actionID, EJScreenType.MAIN);
}
};
if (actionName != null) {
action.setText(actionName);
}
if (actionTooltip != null) {
action.setDescription(actionTooltip);
}
if (actionImage != null && actionImage.length() > 0) {
action.setImageDescriptor((EJRWTImageRetriever.createDescriptor(actionImage)));
}
toolBarManager.add(action);
}
}
toolBarManager.update(true);
section.setTextClient(toolbar);
}
} else {
String frameTitle = mainScreenProperties.getFrameTitle();
if (mainScreenProperties.getDisplayFrame() && frameTitle != null && frameTitle.length() > 0) {
Group group = new Group(blockCanvas, SWT.NONE);
group.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
group.setLayout(new FillLayout());
group.setLayoutData(gridData);
hookKeyListener(group);
group.setText(frameTitle);
_mainPane = new EJRWTEntireJGridPane(group, 1, mainScreenProperties.getDisplayFrame() ? SWT.BORDER : SWT.NONE);
_mainPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
} else {
_mainPane = new EJRWTEntireJGridPane(blockCanvas, 1);
_mainPane.setLayoutData(gridData);
_mainPane.cleanLayout();
_mainPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
}
}
hookKeyListener(_mainPane);
int style = SWT.NONE;
Collection<EJItemGroupProperties> allItemGroupProperties = _block.getProperties().getScreenItemGroupContainer(EJScreenType.MAIN).getAllItemGroupProperties();
{
_chartView = null;
if (allItemGroupProperties.size() > 0) {
EJItemGroupProperties displayProperties = allItemGroupProperties.iterator().next();
if (displayProperties.dispayGroupFrame() && displayProperties.getFrameTitle() != null && displayProperties.getFrameTitle().length() > 0) {
Group group = new Group(_mainPane, SWT.NONE);
group.setLayout(new FillLayout());
group.setText(displayProperties.getFrameTitle());
group.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
_chartView = new BarChart(group, style) {
protected void action(String method, org.eclipse.rap.json.JsonObject parameters) {
processAction(method, parameters);
}
};
} else {
_chartView = new BarChart(_mainPane, displayProperties.dispayGroupFrame() ? style | SWT.BORDER : style) {
protected void action(String method, org.eclipse.rap.json.JsonObject parameters) {
processAction(method, parameters);
}
};
_chartView.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
}
} else {
_chartView = new BarChart(_mainPane, style) {
protected void action(String method, org.eclipse.rap.json.JsonObject parameters) {
processAction(method, parameters);
}
};
_chartView.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
}
}
_chartView.addFocusListener(new FocusListener() {
@Override
public void focusLost(FocusEvent arg0) {
setHasFocus(false);
}
@Override
public void focusGained(FocusEvent arg0) {
setHasFocus(true);
}
});
_mainPane.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent arg0) {
if (!_chartView.isFocusControl()) {
setHasFocus(true);
}
}
});
_chartView.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent arg0) {
if (!_chartView.isFocusControl()) {
setHasFocus(true);
}
}
});
for (EJItemGroupProperties groupProperties : allItemGroupProperties) {
Collection<EJScreenItemProperties> itemProperties = groupProperties.getAllItemProperties();
for (EJScreenItemProperties screenItemProperties : itemProperties) {
EJCoreMainScreenItemProperties mainScreenItemProperties = (EJCoreMainScreenItemProperties) screenItemProperties;
String visualAttribute = mainScreenItemProperties.getBlockRendererRequiredProperties().getStringProperty(VISUAL_ATTRIBUTE_PROPERTY);
EJScreenItemController item = _block.getScreenItem(EJScreenType.MAIN, mainScreenItemProperties.getReferencedItemName());
EJRWTAppItemRenderer itemRenderer = (EJRWTAppItemRenderer) item.getManagedItemRenderer().getUnmanagedRenderer();
if (visualAttribute != null) {
EJCoreVisualAttributeProperties va = EJCoreProperties.getInstance().getVisualAttributesContainer().getVisualAttributeProperties(visualAttribute);
if (va != null) {
itemRenderer.setInitialVisualAttribute(va);
}
}
if (item.getProperties().getVisualAttributeProperties() != null) {
itemRenderer.setVisualAttribute(item.getProperties().getVisualAttributeProperties());
}
}
}
appItemRenderer = null;
final EJItemController blockItemController = _block.getBlockItemController(xAxisColumn);
String itemRendererName = blockItemController.getProperties().getItemRendererName();
if (itemRendererName != null) {
EJScreenItemController itemController = new EJScreenItemController() {
@Override
public boolean validateFromLov() {
// TODO Auto-generated method stub
return false;
}
@Override
public void setItemLovMapping(String lovMapping) {
// TODO Auto-generated method stub
}
@Override
public void removeItemValueChangedListener(EJScreenItemValueChangedListener listener) {
// TODO Auto-generated method stub
}
@Override
public void removeItemFocusListener(EJItemFocusListener listener) {
// TODO Auto-generated method stub
}
@Override
public void itemValueChaged(Object newValue) {
// TODO Auto-generated method stub
}
@Override
public void itemFocusLost() {
// TODO Auto-generated method stub
}
@Override
public void itemFocusGained() {
// TODO Auto-generated method stub
}
@Override
public boolean isVisible() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isSpacerItem() {
// TODO Auto-generated method stub
return false;
}
@Override
public void initialiseRenderer() {
// TODO Auto-generated method stub
}
@Override
public void initialise(EJBlockItemRendererRegister blockItemRegister) {
// TODO Auto-generated method stub
}
@Override
public EJScreenType getScreenType() {
// TODO Auto-generated method stub
return null;
}
@Override
public EJItemProperties getReferencedItemProperties() {
return blockItemController.getProperties();
}
@Override
public EJScreenItemProperties getProperties() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getName() {
// TODO Auto-generated method stub
return null;
}
@Override
public EJManagedItemRendererWrapper getManagedItemRenderer() {
// TODO Auto-generated method stub
return null;
}
@Override
public EJBlockItemRendererRegister getItemRendererRegister() {
// TODO Auto-generated method stub
return null;
}
@Override
public EJItemRenderer getItemRenderer() {
// TODO Auto-generated method stub
return null;
}
@Override
public EJItemLovController getItemLovController() {
// TODO Auto-generated method stub
return null;
}
@Override
public EJInternalForm getForm() {
// TODO Auto-generated method stub
return _block.getForm();
}
@Override
public EJInternalBlock getBlock() {
return _block.getBlock();
}
@Override
public void gainFocus() {
// TODO Auto-generated method stub
}
@Override
public void executeActionCommand() {
// TODO Auto-generated method stub
}
@Override
public void addItemValueChangedListener(EJScreenItemValueChangedListener listener) {
// TODO Auto-generated method stub
}
@Override
public void addItemFocusListener(EJItemFocusListener listener) {
// TODO Auto-generated method stub
}
};
EJManagedItemRendererWrapper renderer = EJRendererFactory.getInstance().getItemRenderer(itemController, new EJCoreMainScreenItemProperties(_block.getProperties(), false));
if (renderer != null && renderer.getUnmanagedRenderer() instanceof EJRWTAppItemRenderer) {
appItemRenderer = (EJRWTAppItemRenderer) renderer.getUnmanagedRenderer();
}
}
refresh();
}
use of org.entirej.framework.core.renderers.EJManagedItemRendererWrapper in project rap by entirej.
the class EJRWTListRecordBlockRenderer method createScreenItem.
public ColumnLabelProvider createScreenItem(EJRWTTableViewerColumnFactory factory, EJCoreMainScreenItemProperties itemProps) {
if (itemProps.isSpacerItem()) {
return null;
}
EJScreenItemController item = _block.getScreenItem(EJScreenType.MAIN, itemProps.getReferencedItemName());
EJManagedItemRendererWrapper renderer = item.getManagedItemRenderer();
if (renderer != null) {
EJRWTAppItemRenderer itemRenderer = (EJRWTAppItemRenderer) renderer.getUnmanagedRenderer();
ColumnLabelProvider labelProvider = itemRenderer.createColumnLabelProvider(itemProps, item);
if (labelProvider != null) {
EJFrameworkExtensionProperties blockProperties = itemProps.getBlockRendererRequiredProperties();
String visualAttribute = blockProperties.getStringProperty(EJRWTListRecordBlockDefinitionProperties.VISUAL_ATTRIBUTE_PROPERTY);
if (visualAttribute != null) {
EJCoreVisualAttributeProperties va = EJCoreProperties.getInstance().getVisualAttributesContainer().getVisualAttributeProperties(visualAttribute);
if (va != null)
itemRenderer.setInitialVisualAttribute(va);
}
}
return labelProvider;
}
return null;
}
use of org.entirej.framework.core.renderers.EJManagedItemRendererWrapper in project rap by entirej.
the class EJRWTMultiRecordBlockRenderer method createScreenItem.
public ColumnLabelProvider createScreenItem(EJRWTTableViewerColumnFactory factory, EJCoreMainScreenItemProperties itemProps) {
if (itemProps.isSpacerItem()) {
return null;
}
EJScreenItemController item = _block.getScreenItem(EJScreenType.MAIN, itemProps.getReferencedItemName());
EJManagedItemRendererWrapper renderer = item.getManagedItemRenderer();
if (renderer != null) {
EJFrameworkExtensionProperties blockProperties = itemProps.getBlockRendererRequiredProperties();
EJRWTAppItemRenderer itemRenderer = (EJRWTAppItemRenderer) renderer.getUnmanagedRenderer();
ColumnLabelProvider labelProvider = itemRenderer.createColumnLabelProvider(itemProps, item);
if (labelProvider != null) {
String labelOrientation = blockProperties.getStringProperty(EJRWTMultiRecordBlockDefinitionProperties.COLUMN_ALIGNMENT);
int displayedWidth = blockProperties.getIntProperty(EJRWTMultiRecordBlockDefinitionProperties.DISPLAY_WIDTH_PROPERTY, 0);
// width
if (displayedWidth == 0) {
if (itemProps.getLabel() != null) {
// add offset
displayedWidth = itemProps.getLabel().length() + 2;
} else {
displayedWidth = 5;
}
}
String visualAttribute = blockProperties.getStringProperty(EJRWTMultiRecordBlockDefinitionProperties.VISUAL_ATTRIBUTE_PROPERTY);
if (visualAttribute != null) {
EJCoreVisualAttributeProperties va = EJCoreProperties.getInstance().getVisualAttributesContainer().getVisualAttributeProperties(visualAttribute);
if (va != null) {
itemRenderer.setInitialVisualAttribute(va);
}
}
if (item.getProperties().getVisualAttributeProperties() != null) {
renderer.setVisualAttribute(item.getProperties().getVisualAttributeProperties());
}
TableViewerColumn viewerColumn = factory.createColumn(itemProps.getLabel(), displayedWidth, labelProvider, getComponentStyle(labelOrientation));
TableColumn column = viewerColumn.getColumn();
EJ_RWT.setTestId(column, blockProperties.getName() + "." + itemProps.getReferencedItemName());
column.setData("KEY", itemProps.getReferencedItemName());
column.setData("ITEM", item);
column.setToolTipText(itemProps.getHint());
ColumnInfo info = new ColumnInfo();
column.setData("INFO", info);
column.setMoveable(blockProperties.getBooleanProperty(EJRWTMultiRecordBlockDefinitionProperties.ALLOW_COLUMN_REORDER, true));
column.setResizable(info.resizable = blockProperties.getBooleanProperty(EJRWTMultiRecordBlockDefinitionProperties.ALLOW_COLUMN_RESIZE, true));
if (blockProperties.getBooleanProperty(EJRWTMultiRecordBlockDefinitionProperties.ALLOW_ROW_SORTING, true)) {
EJRWTAbstractTableSorter columnSorter = itemRenderer.getColumnSorter(itemProps, item);
if (columnSorter != null) {
new EJRWTTableSortSelectionListener(_tableViewer, column, columnSorter, SWT.UP, false);
}
}
// ensure that the width property of the table column is in
// Characters
Font font = labelProvider.getFont(new Object());
if (font == null) {
font = _tableViewer.getTable().getFont();
}
if (font != null) {
float avgCharWidth = EJRWTImageRetriever.getGraphicsProvider().getAvgCharWidth(font);
if (avgCharWidth > 0) {
// add + 1 padding
column.setWidth(info.width = ((int) ((column.getWidth() + 1) * avgCharWidth)));
}
}
if (!item.isVisible()) {
column.setWidth(0);
column.setResizable(false);
}
return labelProvider;
}
}
return null;
}
Aggregations