Search in sources :

Example 11 with EJManagedItemRendererWrapper

use of org.entirej.framework.core.renderers.EJManagedItemRendererWrapper in project rap by entirej.

the class EJRWTSingleRecordBlockRenderer method recordSelected.

@Override
public void recordSelected(EJDataRecord record) {
    if (record != null) {
        logger.trace("START recordSelected");
        synchronize();
        _mainItemRegister.register(record);
        Collection<EJManagedItemRendererWrapper> registeredRenderers = _mainItemRegister.getRegisteredRenderers();
        for (EJManagedItemRendererWrapper wrapper : registeredRenderers) {
            if (wrapper.getUnmanagedRenderer() instanceof EJRWTComboItemRenderer) {
                if (((EJRWTComboItemRenderer) wrapper.getUnmanagedRenderer()).isLovInitialiedOnValueSet())
                    wrapper.getUnmanagedRenderer().refreshItemRenderer();
            }
        }
        logger.trace("END recordSelected");
    }
    notifyStatus();
}
Also used : EJManagedItemRendererWrapper(org.entirej.framework.core.renderers.EJManagedItemRendererWrapper) EJRWTComboItemRenderer(org.entirej.applicationframework.rwt.renderers.item.EJRWTComboItemRenderer)

Example 12 with EJManagedItemRendererWrapper

use of org.entirej.framework.core.renderers.EJManagedItemRendererWrapper in project rap by entirej.

the class EJRWTTreeTableRecordBlockRenderer method createScreenItem.

public ColumnLabelProvider createScreenItem(EJRWTTreeTableViewerColumnFactory 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(EJRWTTreeTableBlockDefinitionProperties.COLUMN_ALIGNMENT);
            int displayedWidth = blockProperties.getIntProperty(EJRWTTreeTableBlockDefinitionProperties.DISPLAY_WIDTH_PROPERTY, 0);
            // width
            if (displayedWidth == 0) {
                if (itemProps.getLabel() != null) {
                    // add
                    displayedWidth = itemProps.getLabel().length() + 2;
                // offset
                } else {
                    displayedWidth = 5;
                }
            }
            String visualAttribute = blockProperties.getStringProperty(EJRWTTreeTableBlockDefinitionProperties.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());
            }
            TreeViewerColumn viewerColumn = factory.createColumn(itemProps.getLabel(), displayedWidth, labelProvider, getComponentStyle(labelOrientation));
            TreeColumn column = viewerColumn.getColumn();
            EJ_RWT.setTestId(column, blockProperties.getName() + "." + itemProps.getReferencedItemName());
            column.setData("KEY", itemProps.getReferencedItemName());
            column.setData("VIEWER", viewerColumn);
            column.setData("ITEM", item);
            column.setToolTipText(itemProps.getHint());
            ColumnInfo info = new ColumnInfo();
            column.setData("INFO", info);
            column.setMoveable(blockProperties.getBooleanProperty(EJRWTTreeTableBlockDefinitionProperties.ALLOW_COLUMN_REORDER, true));
            column.setResizable(info.resizable = blockProperties.getBooleanProperty(EJRWTTreeTableBlockDefinitionProperties.ALLOW_COLUMN_RESIZE, true));
            if (blockProperties.getBooleanProperty(EJRWTTreeTableBlockDefinitionProperties.ALLOW_ROW_SORTING, true)) {
                EJRWTAbstractTableSorter columnSorter = itemRenderer.getColumnSorter(itemProps, item);
                if (columnSorter != null) {
                    new EJRWTTreeTableSortSelectionListener(_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.getTree().getFont();
            }
            if (font != null) {
                float avgCharWidth = EJRWTImageRetriever.getGraphicsProvider().getAvgCharWidth(font);
                if (avgCharWidth > 0) {
                    // add
                    column.setWidth(info.width = ((int) ((column.getWidth() + 1) * avgCharWidth)));
                // +1
                // padding
                }
            }
            return labelProvider;
        }
    }
    return null;
}
Also used : EJFrameworkExtensionProperties(org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties) EJRWTAppItemRenderer(org.entirej.applicationframework.rwt.renderer.interfaces.EJRWTAppItemRenderer) Point(org.eclipse.swt.graphics.Point) Font(org.eclipse.swt.graphics.Font) TreeViewerColumn(org.eclipse.jface.viewers.TreeViewerColumn) ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) EJRWTTreeTableSortSelectionListener(org.entirej.applicationframework.rwt.table.EJRWTTreeTableSortSelectionListener) EJScreenItemController(org.entirej.framework.core.interfaces.EJScreenItemController) EJManagedItemRendererWrapper(org.entirej.framework.core.renderers.EJManagedItemRendererWrapper) TreeColumn(org.eclipse.swt.widgets.TreeColumn) EJCoreVisualAttributeProperties(org.entirej.framework.core.properties.EJCoreVisualAttributeProperties) EJRWTAbstractTableSorter(org.entirej.applicationframework.rwt.table.EJRWTAbstractTableSorter)

Example 13 with EJManagedItemRendererWrapper

use of org.entirej.framework.core.renderers.EJManagedItemRendererWrapper in project rap by entirej.

the class EJRWTTreeRecordBlockRenderer method createScreenItem.

public TreeNodeTextProvider createScreenItem(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) {
            return new TreeNodeTextProvider(blockProperties.getStringProperty(EJRWTTreeBlockDefinitionProperties.ITEM_PREFIX), blockProperties.getStringProperty(EJRWTTreeBlockDefinitionProperties.ITEM_SUFFIX), labelProvider);
        }
    }
    return null;
}
Also used : ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) EJScreenItemController(org.entirej.framework.core.interfaces.EJScreenItemController) EJFrameworkExtensionProperties(org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties) EJManagedItemRendererWrapper(org.entirej.framework.core.renderers.EJManagedItemRendererWrapper) EJRWTAppItemRenderer(org.entirej.applicationframework.rwt.renderer.interfaces.EJRWTAppItemRenderer)

Example 14 with EJManagedItemRendererWrapper

use of org.entirej.framework.core.renderers.EJManagedItemRendererWrapper in project rap by entirej.

the class EJRWTStandardLovRenderer 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.getLovRendererRequiredProperties();
        EJRWTAppItemRenderer itemRenderer = (EJRWTAppItemRenderer) renderer.getUnmanagedRenderer();
        ColumnLabelProvider labelProvider = itemRenderer.createColumnLabelProvider(itemProps, item);
        if (labelProvider != null) {
            int _widthHint = blockProperties.getIntProperty(EJRWTMultiRecordBlockDefinitionProperties.DISPLAY_WIDTH_PROPERTY, 0);
            // width
            if (_widthHint == 0) {
                if (itemProps.getLabel() != null) {
                    // offset
                    _widthHint = itemProps.getLabel().length() + 2;
                } else {
                    _widthHint = 5;
                }
            }
            String alignmentProperty = blockProperties.getStringProperty(EJRWTMultiRecordBlockDefinitionProperties.COLUMN_ALIGNMENT);
            TableViewerColumn viewerColumn = factory.createColumn(itemProps.getLabel(), _widthHint, labelProvider, getComponentStyle(alignmentProperty));
            TableColumn column = viewerColumn.getColumn();
            column.setToolTipText(itemProps.getHint());
            column.setMoveable(blockProperties.getBooleanProperty(EJRWTMultiRecordBlockDefinitionProperties.ALLOW_COLUMN_REORDER, true));
            column.setResizable(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
                    column.setWidth((int) ((column.getWidth() + 1) * avgCharWidth));
                // +1
                // padding
                }
            }
            return labelProvider;
        }
    }
    return null;
}
Also used : EJFrameworkExtensionProperties(org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties) TableColumn(org.eclipse.swt.widgets.TableColumn) EJRWTAppItemRenderer(org.entirej.applicationframework.rwt.renderer.interfaces.EJRWTAppItemRenderer) Font(org.eclipse.swt.graphics.Font) ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) EJScreenItemController(org.entirej.framework.core.interfaces.EJScreenItemController) EJManagedItemRendererWrapper(org.entirej.framework.core.renderers.EJManagedItemRendererWrapper) EJRWTTableSortSelectionListener(org.entirej.applicationframework.rwt.table.EJRWTTableSortSelectionListener) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) EJRWTAbstractTableSorter(org.entirej.applicationframework.rwt.table.EJRWTAbstractTableSorter)

Example 15 with EJManagedItemRendererWrapper

use of org.entirej.framework.core.renderers.EJManagedItemRendererWrapper in project rap by entirej.

the class EJRWTInsertScreenRenderer method open.

@Override
public void open(EJDataRecord record) {
    _itemRegister.resetRegister();
    setupInsertScreen();
    _itemRegister.register(record);
    Collection<EJManagedItemRendererWrapper> registeredRenderers = _itemRegister.getRegisteredRenderers();
    for (EJManagedItemRendererWrapper wrapper : registeredRenderers) {
        if (wrapper.getUnmanagedRenderer() instanceof EJRWTComboItemRenderer) {
            if (((EJRWTComboItemRenderer) wrapper.getUnmanagedRenderer()).isLovInitialiedOnValueSet())
                wrapper.getUnmanagedRenderer().refreshItemRenderer();
        }
    }
    _insertDialog.centreLocation();
    if (_maximize) {
        _insertDialog.getShell().setMaximized(_maximize);
    }
    _insertDialog.open();
    _insertDialog.activateDialog();
}
Also used : EJManagedItemRendererWrapper(org.entirej.framework.core.renderers.EJManagedItemRendererWrapper) EJRWTComboItemRenderer(org.entirej.applicationframework.rwt.renderers.item.EJRWTComboItemRenderer)

Aggregations

EJManagedItemRendererWrapper (org.entirej.framework.core.renderers.EJManagedItemRendererWrapper)18 EJScreenItemController (org.entirej.framework.core.interfaces.EJScreenItemController)13 EJFrameworkExtensionProperties (org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties)13 EJRWTAppItemRenderer (org.entirej.applicationframework.rwt.renderer.interfaces.EJRWTAppItemRenderer)10 EJCoreVisualAttributeProperties (org.entirej.framework.core.properties.EJCoreVisualAttributeProperties)7 ColumnLabelProvider (org.eclipse.jface.viewers.ColumnLabelProvider)6 EJBlockProperties (org.entirej.framework.core.properties.interfaces.EJBlockProperties)6 FillLayout (org.eclipse.swt.layout.FillLayout)5 EJRWTEntireJGridPane (org.entirej.applicationframework.rwt.layout.EJRWTEntireJGridPane)5 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)4 Font (org.eclipse.swt.graphics.Font)4 Composite (org.eclipse.swt.widgets.Composite)4 EJRWTScrolledComposite (org.entirej.applicationframework.rwt.layout.EJRWTScrolledComposite)4 EJApplicationException (org.entirej.framework.core.EJApplicationException)4 EJScreenItemProperties (org.entirej.framework.core.properties.interfaces.EJScreenItemProperties)4 Collection (java.util.Collection)3 JsonObject (org.eclipse.rap.json.JsonObject)3 FocusEvent (org.eclipse.swt.events.FocusEvent)3 FocusListener (org.eclipse.swt.events.FocusListener)3 MouseAdapter (org.eclipse.swt.events.MouseAdapter)3