use of org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties in project rap by entirej.
the class EJRWTLineChartRecordBlockRenderer 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 LineChart(group, style) {
protected void action(String method, org.eclipse.rap.json.JsonObject parameters) {
processAction(method, parameters);
}
};
} else {
_chartView = new LineChart(_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 LineChart(_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.properties.definitions.interfaces.EJFrameworkExtensionProperties in project rap by entirej.
the class EJRWTPieChartRecordBlockRenderer 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 PieChart(group, style) {
protected void action(String method, org.eclipse.rap.json.JsonObject parameters) {
processAction(method, parameters);
}
};
} else {
_chartView = new PieChart(_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 PieChart(_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());
}
}
}
refresh();
}
use of org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties in project rap by entirej.
the class EJSpringRestSecurityConfig method getProvider.
private static EJSpringSecurityConfigProvider getProvider() {
EJCoreProperties instance = EJCoreProperties.getInstance();
EJFrameworkExtensionProperties definedProperties = instance.getApplicationDefinedProperties();
if (definedProperties != null) {
EJFrameworkExtensionProperties settings = definedProperties.getPropertyGroup(SPRING_SECURITY);
if (settings != null) {
String configClass = settings.getStringProperty(SPRING_SECURITY_AUTH);
if (configClass != null && !configClass.isEmpty()) {
Class<?> factoryClass;
try {
factoryClass = Class.forName(configClass);
Object obj = factoryClass.newInstance();
if (obj instanceof EJSpringSecurityConfigProvider) {
return (EJSpringSecurityConfigProvider) obj;
} else {
System.err.println("invalid EJSpringSecurityConfigProvider switch to default");
}
} catch (ClassNotFoundException e) {
System.err.println("invalid EJSpringSecurityConfigProvider switch to default");
e.printStackTrace();
} catch (InstantiationException e) {
System.err.println("invalid EJSpringSecurityConfigProvider switch to default");
e.printStackTrace();
} catch (IllegalAccessException e) {
System.err.println("invalid EJSpringSecurityConfigProvider switch to default");
e.printStackTrace();
}
}
}
}
return new EJDefaultSpringSecurityConfigProvider();
}
use of org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties in project rap by entirej.
the class EJRWTHtmlTableBlockRenderer method buildGuiComponent.
@Override
public void buildGuiComponent(EJRWTEntireJGridPane blockCanvas) {
if (_browser != null && !_browser.isDisposed()) {
_browser.dispose();
}
EJBlockProperties blockProperties = _block.getProperties();
EJMainScreenProperties mainScreenProperties = blockProperties.getMainScreenProperties();
EJFrameworkExtensionProperties blockRendererProperties = blockProperties.getBlockRendererProperties();
boolean addHeader = true;
if (blockRendererProperties != null) {
addHeader = blockRendererProperties.getBooleanProperty(EJRWTMultiRecordBlockDefinitionProperties.SHOW_HEADING_PROPERTY, true);
EJCoreFrameworkExtensionPropertyList propertyList = blockRendererProperties.getPropertyList(ACTIONS);
if (propertyList != null) {
List<EJFrameworkExtensionPropertyListEntry> allListEntries = propertyList.getAllListEntries();
for (EJFrameworkExtensionPropertyListEntry entry : allListEntries) {
String actionID = entry.getProperty(ACTION_ID);
String actionkey = entry.getProperty(ACTION_KEY);
if (actionID != null && actionkey != null && actionID.trim().length() > 0 && actionkey.trim().length() > 0) {
addActionKeyinfo(actionkey, actionID);
}
}
}
}
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.minimumHeight = mainScreenProperties.getHeight();
// if (gridData.grabExcessVerticalSpace)
// gridData.minimumWidth = mainScreenProperties.getHeight();
blockCanvas.setLayoutData(gridData);
scrollComposite = new EJRWTScrolledComposite(blockCanvas, SWT.V_SCROLL | SWT.H_SCROLL);
scrollComposite.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
scrollComposite.setExpandHorizontal(true);
scrollComposite.setExpandVertical(true);
scrollComposite.setMinSize(mainScreenProperties.getWidth(), mainScreenProperties.getHeight());
boolean filtered = blockRendererProperties.getBooleanProperty(EJRWTTreeBlockDefinitionProperties.FILTER, false);
this.filterKeepOnRefresh = blockRendererProperties.getBooleanProperty(EJRWTTreeBlockDefinitionProperties.FILTER_KEEP_ON_REFRESH, false);
this.textSelection = blockRendererProperties.getBooleanProperty(TEXT_SELECTION, false);
if (mainScreenProperties.getDisplayFrame()) {
String frameTitle = mainScreenProperties.getFrameTitle();
if (frameTitle != null && frameTitle.length() > 0) {
Group group = new Group(scrollComposite, SWT.NONE);
group.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
hookKeyListener(group);
scrollComposite.setContent(group);
group.setLayout(new GridLayout());
scrollComposite.setLayoutData(gridData);
if (frameTitle != null && frameTitle.length() > 0) {
group.setText(frameTitle);
}
if (filtered) {
filterHtml = new EJRWTAbstractFilteredHtml(group, SWT.NONE, textSelection) {
@Override
public void filter(String filter) {
_filteredContentProvider.setFilter(filter);
createHTML();
}
@Override
protected EJRWTHtmlView doCreateTableViewer(Composite parent, int style, boolean textSelection) {
return new EJRWTHtmlView(parent, SWT.NONE, textSelection) {
private static final long serialVersionUID = 1L;
@Override
public void action(String method, JsonObject parameters) {
if ("eselect".equals(method)) {
final Object arg1 = parameters.get("0").asString();
if (arg1 instanceof String) {
EJDataRecord recordAt = getRecordAt(Integer.valueOf((String) arg1));
if (currentRec != recordAt) {
currentRec = recordAt;
if (currentRec != null)
_block.newRecordInstance(currentRec);
}
}
} else if ("eaction".equals(method)) {
final Object arg1 = parameters.get("0").asString();
Object arg2 = parameters.get("1").asString();
if (arg1 instanceof String) {
if (arg2 instanceof String) {
EJDataRecord recordAt = getRecordAt(Integer.valueOf((String) arg2));
if (currentRec != recordAt) {
currentRec = recordAt;
if (currentRec != null)
_block.newRecordInstance(currentRec);
}
}
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
try {
_block.executeActionCommand((String) arg1, EJScreenType.MAIN);
} catch (EJApplicationException exception) {
_block.getFrameworkManager().handleException(exception);
}
}
});
}
} else if ("esort".equals(method)) {
handleSort(parameters);
}
}
};
}
};
_browser = filterHtml.getViewer();
defaultMessage = blockRendererProperties.getStringProperty(EJRWTTextItemRendererDefinitionProperties.PROPERTY_MESSAGE);
if (defaultMessage != null)
filterHtml.getFilterControl().setMessage(defaultMessage);
} else {
_browser = new EJRWTHtmlView(group, SWT.NONE, textSelection) {
private static final long serialVersionUID = 1L;
@Override
public void action(String method, JsonObject parameters) {
if ("eselect".equals(method)) {
final Object arg1 = parameters.get("0").asString();
if (arg1 instanceof String) {
EJDataRecord recordAt = getRecordAt(Integer.valueOf((String) arg1));
if (currentRec != recordAt) {
currentRec = recordAt;
if (currentRec != null)
_block.newRecordInstance(currentRec);
}
}
} else if ("eaction".equals(method)) {
final Object arg1 = parameters.get("0").asString();
Object arg2 = parameters.get("1").asString();
if (arg1 instanceof String) {
if (arg2 instanceof String) {
EJDataRecord recordAt = getRecordAt(Integer.valueOf((String) arg2));
if (currentRec != recordAt) {
currentRec = recordAt;
if (currentRec != null)
_block.newRecordInstance(currentRec);
}
}
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
try {
_block.executeActionCommand((String) arg1, EJScreenType.MAIN);
} catch (EJApplicationException exception) {
_block.getFrameworkManager().handleException(exception);
}
}
});
}
} else if ("esort".equals(method)) {
handleSort(parameters);
}
}
};
}
} else {
if (filtered) {
filterHtml = new EJRWTAbstractFilteredHtml(scrollComposite, SWT.NONE, textSelection) {
@Override
public void filter(String filter) {
_filteredContentProvider.setFilter(filter);
createHTML();
}
@Override
protected EJRWTHtmlView doCreateTableViewer(Composite parent, int style, boolean textSelection) {
return new EJRWTHtmlView(parent, SWT.NONE, textSelection) {
private static final long serialVersionUID = 1L;
@Override
public void action(String method, JsonObject parameters) {
if ("eselect".equals(method)) {
final Object arg1 = parameters.get("0").asString();
if (arg1 instanceof String) {
EJDataRecord recordAt = getRecordAt(Integer.valueOf((String) arg1));
if (currentRec != recordAt) {
currentRec = recordAt;
if (currentRec != null)
_block.newRecordInstance(currentRec);
}
}
} else if ("eaction".equals(method)) {
final Object arg1 = parameters.get("0").asString();
Object arg2 = parameters.get("1").asString();
if (arg1 instanceof String) {
if (arg2 instanceof String) {
EJDataRecord recordAt = getRecordAt(Integer.valueOf((String) arg2));
if (currentRec != recordAt) {
currentRec = recordAt;
if (currentRec != null)
_block.newRecordInstance(currentRec);
}
}
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
try {
_block.executeActionCommand((String) arg1, EJScreenType.MAIN);
} catch (EJApplicationException exception) {
_block.getFrameworkManager().handleException(exception);
}
}
});
}
} else if ("esort".equals(method)) {
handleSort(parameters);
}
}
};
}
};
_browser = filterHtml.getViewer();
defaultMessage = blockRendererProperties.getStringProperty(EJRWTTextItemRendererDefinitionProperties.PROPERTY_MESSAGE);
if (defaultMessage != null)
filterHtml.getFilterControl().setMessage(defaultMessage);
scrollComposite.setContent(filterHtml);
scrollComposite.setLayoutData(gridData);
} else {
filterHtml = null;
_browser = new EJRWTHtmlView(scrollComposite, SWT.BORDER, textSelection) {
private static final long serialVersionUID = 1L;
@Override
public void action(String method, JsonObject parameters) {
if ("eselect".equals(method)) {
final Object arg1 = parameters.get("0").asString();
if (arg1 instanceof String) {
EJDataRecord recordAt = getRecordAt(Integer.valueOf((String) arg1));
if (currentRec != recordAt) {
currentRec = recordAt;
if (currentRec != null)
_block.newRecordInstance(currentRec);
}
}
} else if ("eaction".equals(method)) {
final Object arg1 = parameters.get("0").asString();
Object arg2 = parameters.get("1").asString();
if (arg1 instanceof String) {
if (arg2 instanceof String) {
EJDataRecord recordAt = getRecordAt(Integer.valueOf((String) arg2));
if (currentRec != recordAt) {
currentRec = recordAt;
if (currentRec != null)
_block.newRecordInstance(currentRec);
}
}
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
try {
_block.executeActionCommand((String) arg1, EJScreenType.MAIN);
} catch (EJApplicationException exception) {
_block.getFrameworkManager().handleException(exception);
}
}
});
}
} else if ("esort".equals(method)) {
handleSort(parameters);
}
}
};
scrollComposite.setContent(_browser);
scrollComposite.setLayoutData(gridData);
}
}
} else {
if (filtered) {
filterHtml = new EJRWTAbstractFilteredHtml(scrollComposite, SWT.NONE, textSelection) {
@Override
public void filter(String filter) {
_filteredContentProvider.setFilter(filter);
createHTML();
}
@Override
protected EJRWTHtmlView doCreateTableViewer(Composite parent, int style, boolean textSelection) {
return new EJRWTHtmlView(parent, SWT.NONE, textSelection) {
private static final long serialVersionUID = 1L;
@Override
public void action(String method, JsonObject parameters) {
if ("eselect".equals(method)) {
final Object arg1 = parameters.get("0").asString();
if (arg1 instanceof String) {
EJDataRecord recordAt = getRecordAt(Integer.valueOf((String) arg1));
if (currentRec != recordAt) {
currentRec = recordAt;
if (currentRec != null)
_block.newRecordInstance(currentRec);
}
}
} else if ("eaction".equals(method)) {
final Object arg1 = parameters.get("0").asString();
Object arg2 = parameters.get("1").asString();
if (arg1 instanceof String) {
if (arg2 instanceof String) {
EJDataRecord recordAt = getRecordAt(Integer.valueOf((String) arg2));
if (currentRec != recordAt) {
currentRec = recordAt;
if (currentRec != null)
_block.newRecordInstance(currentRec);
}
}
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
try {
_block.executeActionCommand((String) arg1, EJScreenType.MAIN);
} catch (EJApplicationException exception) {
_block.getFrameworkManager().handleException(exception);
}
}
});
}
} else if ("esort".equals(method)) {
handleSort(parameters);
}
}
};
}
};
_browser = filterHtml.getViewer();
scrollComposite.setContent(filterHtml);
scrollComposite.setLayoutData(gridData);
defaultMessage = blockRendererProperties.getStringProperty(EJRWTTextItemRendererDefinitionProperties.PROPERTY_MESSAGE);
if (defaultMessage != null)
filterHtml.getFilterControl().setMessage(defaultMessage);
} else {
filterHtml = null;
_browser = new EJRWTHtmlView(scrollComposite, SWT.NONE, textSelection) {
private static final long serialVersionUID = 1L;
@Override
public void action(String method, JsonObject parameters) {
if ("eselect".equals(method)) {
final Object arg1 = parameters.get("0").asString();
if (arg1 instanceof String) {
EJDataRecord recordAt = getRecordAt(Integer.valueOf((String) arg1));
if (currentRec != recordAt) {
currentRec = recordAt;
if (currentRec != null)
_block.newRecordInstance(currentRec);
}
}
} else if ("eaction".equals(method)) {
final Object arg1 = parameters.get("0").asString();
Object arg2 = parameters.get("1").asString();
if (arg1 instanceof String) {
if (arg2 instanceof String) {
EJDataRecord recordAt = getRecordAt(Integer.valueOf((String) arg2));
if (currentRec != recordAt) {
currentRec = recordAt;
if (currentRec != null)
_block.newRecordInstance(currentRec);
}
}
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
try {
_block.executeActionCommand((String) arg1, EJScreenType.MAIN);
} catch (EJApplicationException exception) {
_block.getFrameworkManager().handleException(exception);
}
}
});
}
} else if ("esort".equals(method)) {
handleSort(parameters);
}
}
};
scrollComposite.setContent(_browser);
scrollComposite.setLayoutData(gridData);
hookKeyListener(scrollComposite);
}
}
_browser.addFocusListener(new FocusListener() {
private static final long serialVersionUID = 1L;
@Override
public void focusLost(FocusEvent arg0) {
setHasFocus(false);
}
@Override
public void focusGained(FocusEvent arg0) {
setHasFocus(true);
}
});
_browser.addMouseListener(new MouseAdapter() {
private static final long serialVersionUID = 1L;
@Override
public void mouseDown(MouseEvent arg0) {
setHasFocus(true);
}
});
if (_items.isEmpty()) {
Collection<EJItemGroupProperties> allItemGroupProperties = _block.getProperties().getScreenItemGroupContainer(EJScreenType.MAIN).getAllItemGroupProperties();
int cellSpacing = blockProperties.getBlockRendererProperties().getIntProperty(CELL_SPACING_PROPERTY, 0);
int cellPadding = blockProperties.getBlockRendererProperties().getIntProperty(CELL_PADDING_PROPERTY, 0);
String paddingStyle = "";
if (cellPadding > 0) {
String str = String.valueOf(cellPadding);
paddingStyle += String.format("padding: %spx %spx %spx %spx; ", str, str, str, str);
}
StringBuilder header = new StringBuilder("<thead><tr>");
boolean rowSelection = blockProperties.getBlockRendererProperties().getBooleanProperty(ROW_SELECTION, false);
String selectionTD = "<th width=1 ></td>";
if (rowSelection) {
header.append(selectionTD);
}
for (EJItemGroupProperties groupProperties : allItemGroupProperties) {
Collection<EJScreenItemProperties> itemProperties = groupProperties.getAllItemProperties();
for (EJScreenItemProperties screenItemProperties : itemProperties) {
EJCoreMainScreenItemProperties itemProps = (EJCoreMainScreenItemProperties) screenItemProperties;
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);
_items.add(itemProps);
_itemLabelProviders.put(itemProps.getReferencedItemName(), labelProvider);
if (addHeader) {
String styleClass = "default_all";
EJFrameworkExtensionProperties rendererProperties = item.getReferencedItemProperties().getItemRendererProperties();
EJFrameworkExtensionProperties extentionProperties = itemProps.getBlockRendererRequiredProperties();
int width = -1;
if (width == -1) {
width = extentionProperties.getIntProperty(DISPLAY_WIDTH_PROPERTY, 0);
}
header.append("<th ");
if (width > 0) {
Font font = labelProvider.getFont(new Object());
if (font == null)
font = _browser.getFont();
if (font != null) {
float avgCharWidth = RWTUtils.getAvgCharWidth(font);
if (avgCharWidth > 0) {
if (width != 1) {
// add +1 padding
width = ((int) (((width + 1) * avgCharWidth)));
}
}
}
header.append(String.format(" width=%s ", width));
}
header.append(" ");
String alignment = null;
String alignmentProperty = rendererProperties.getStringProperty(PROPERTY_ALIGNMENT);
if (alignmentProperty == null) {
alignmentProperty = rendererProperties.getStringProperty("ALLIGNMENT");
}
alignment = getComponentAlignment(alignmentProperty);
SortInfo sortInfo = null;
if (extentionProperties.getBooleanProperty(ALLOW_ROW_SORTING, true)) {
EJRWTAbstractTableSorter columnSorter = itemRenderer.getColumnSorter(itemProps, item);
if (columnSorter != null) {
_itemSortProviders.put(itemProps.getReferencedItemName(), columnSorter);
sortInfo = new SortInfo();
sortInfo.columnName = itemProps.getReferencedItemName();
_sortContext.put(sortInfo.id, sortInfo);
}
}
String functionDef = null;
if (sortInfo != null) {
functionDef = String.format("em='esort' earg='%s' ", sortInfo.id);
}
String valueVA = blockProperties.getBlockRendererProperties().getStringProperty(HEADER_VA);
if (valueVA != null && valueVA.length() > 0) {
styleClass = valueVA;
valueVA = rendererProperties.getStringProperty(HEADER_VA);
if (valueVA != null && valueVA.length() > 0)
styleClass = valueVA;
}
header.append(String.format(" class=\"%s\" ", styleClass));
if (alignment != null) {
header.append(String.format(" align=\'%s\'", alignment));
}
if (paddingStyle != null) {
header.append(String.format(" style=\'%s\'", paddingStyle));
}
if (itemProps.getHint() != null && !itemProps.getHint().isEmpty()) {
header.append(String.format(" title=\'%s\'", itemProps.getHint()));
}
header.append("> ");
if (itemProps.getLabel() != null) {
if (functionDef != null) {
header.append(String.format("<ejl><u %s class=\"%s, %s\" ", "style=\"line-height: 100%\"", ("default_all".equals(styleClass) ? "default_link_fg" : "default_link"), styleClass));
header.append(functionDef).append(">");
}
header.append(!(extentionProperties.getBooleanProperty(ENABLE_MARKUP, false) || rendererProperties.getBooleanProperty("HTML_FORMAT", false)) ? ignoreHtml(itemProps.getLabel()) : itemProps.getLabel());
if (sortInfo != null)
header.append(String.format("<esh %s/>", sortInfo.id));
}
header.append("</th>");
}
}
}
}
if (addHeader) {
header.append("</tr></thead>");
_headerTag = header.toString();
}
}
hookKeyListener(_browser);
final EJRWTAbstractFilteredHtml _filterHtml = filterHtml;
_filteredContentProvider = new FilteredContentProvider() {
boolean matchItem(EJDataRecord rec) {
if (filter != null && filter.trim().length() > 0) {
for (ColumnLabelProvider filterTextProvider : _itemLabelProviders.values()) {
String text = filterTextProvider.getText(rec);
if (text != null && text.toLowerCase().contains(filter.toLowerCase())) {
return true;
}
}
// if no match try to match Numeric value
try {
double parseDouble = Double.parseDouble(filter);
for (String item : _itemLabelProviders.keySet()) {
Object value = rec.getValue(item);
if (value instanceof Number) {
if (((Number) value).doubleValue() == parseDouble) {
return true;
}
}
}
} catch (NumberFormatException e) {
// ignore
}
}
return false;
}
@Override
public void setFilter(String filter) {
if (getFilter() != null && getFilter().equals(filter))
return;
super.setFilter(filter);
_tableBaseRecords.clear();
if (filter == null || filter.trim().length() == 0) {
if (_filterHtml != null) {
_filterHtml.clearText();
}
_tableBaseRecords.addAll(_block.getBlock().getRecords());
} else {
for (EJDataRecord record : _block.getBlock().getRecords()) {
if (matchItem(record)) {
_tableBaseRecords.add(record);
}
}
}
}
};
createHTML();
}
use of org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties in project rap by entirej.
the class EJRWTListRecordBlockDefinition method addBlockControlToCanvas.
@Override
public EJRWTTableRendererDefinitionControl addBlockControlToCanvas(EJMainScreenProperties mainScreenProperties, EJDevBlockDisplayProperties blockDisplayProperties, Composite parent, FormToolkit toolkit) {
EJFrameworkExtensionProperties rendererProperties = blockDisplayProperties.getBlockRendererProperties();
if (blockDisplayProperties != null) {
rendererProperties = rendererProperties.getPropertyGroup(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR);
}
Composite layoutBody;
if (rendererProperties != null && rendererProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE) != null && !EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE_GROUP.equals(rendererProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE))) {
int style = ExpandableComposite.TITLE_BAR;
String mode = rendererProperties.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 (rendererProperties.getBooleanProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_EXPANDED, true)) {
style = style | ExpandableComposite.EXPANDED;
}
String title = rendererProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_TITLE);
Section section = toolkit.createSection(parent, style);
if (title != null)
section.setText(title);
section.setFont(parent.getFont());
section.setForeground(parent.getForeground());
if (mainScreenProperties.getDisplayFrame()) {
layoutBody = new Group(section, SWT.NONE);
layoutBody.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
if (mainScreenProperties.getFrameTitle() != null)
((Group) layoutBody).setText(mainScreenProperties.getFrameTitle());
} else {
layoutBody = toolkit.createComposite(section);
}
section.setClient(layoutBody);
} else {
if (mainScreenProperties.getDisplayFrame()) {
layoutBody = new Group(parent, SWT.NONE);
if (mainScreenProperties.getFrameTitle() != null)
((Group) layoutBody).setText(mainScreenProperties.getFrameTitle());
} else {
layoutBody = new Composite(parent, SWT.NONE);
}
}
layoutBody.setLayout(new GridLayout(mainScreenProperties.getNumCols(), false));
EJRWTTableRendererDefinitionControl control = addTable(blockDisplayProperties, layoutBody, toolkit);
return control;
}
Aggregations