Search in sources :

Example 1 with EJRWTEntireJStackedPane

use of org.entirej.applicationframework.rwt.layout.EJRWTEntireJStackedPane in project rap by entirej.

the class EJRWTStackedItemRenderer method createComponent.

@Override
public void createComponent(Composite composite) {
    String alignmentProperty = _rendererProps.getStringProperty(EJRWTTextItemRendererDefinitionProperties.PROPERTY_ALIGNMENT);
    if (alignmentProperty == null) {
        alignmentProperty = _rendererProps.getStringProperty("ALLIGNMENT");
    }
    _numberType = getNumberType(_baseValue);
    _decimalFormatter = createFormatter(_numberType, null);
    _dateFormat = new MultiDateFormater(DateFormat.getDateInstance(DateFormat.SHORT, _item.getForm().getFrameworkManager().getCurrentLocale()));
    String hint = _screenItemProperties.getHint();
    {
        final String alignmentProp = alignmentProperty;
        _actionControl = new EJRWTAbstractPanelAction(composite) {

            @Override
            public Composite createPanel(Composite parent) {
                stackedPane = new EJRWTEntireJStackedPane(parent);
                // _textField.setData(EJ_RWT.CUSTOM_VARIANT, getCSSKey());
                // String customCSSKey =
                // _rendererProps.getStringProperty(EJRWTButtonItemRendererDefinitionProperties.PROPERTY_CSS_KEY);
                // 
                // if (customCSSKey != null && customCSSKey.trim().length()
                // > 0)
                // {
                // _textField.setData(EJ_RWT.CUSTOM_VARIANT, customCSSKey);
                // }
                buildStackUI(stackedPane);
                return stackedPane;
            }

            @Override
            public Control createCustomActionLabel(Composite parent) {
                return createCustomButtonControl(parent);
            }

            @Override
            public Control createActionLabel(Composite parent) {
                Label label = new Label(parent, SWT.NONE);
                label.setImage(EJRWTImageRetriever.get(EJRWTImageRetriever.IMG_FIND_LOV));
                label.addFocusListener(EJRWTStackedItemRenderer.this);
                label.addMouseListener(new MouseListener() {

                    private static final long serialVersionUID = 529634857284996692L;

                    @Override
                    public void mouseUp(MouseEvent arg0) {
                        _item.getItemLovController().displayLov(EJLovDisplayReason.LOV);
                    }

                    @Override
                    public void mouseDown(MouseEvent arg0) {
                    }

                    @Override
                    public void mouseDoubleClick(MouseEvent arg0) {
                    }
                });
                final EJFrameworkExtensionProperties rendererProp = EJCoreProperties.getInstance().getApplicationDefinedProperties();
                final EJFrameworkExtensionProperties propertyGroup = rendererProp.getPropertyGroup(EJRWTSingleRecordBlockDefinitionProperties.ACTION_GROUP);
                String lovKey = "SHIFT+ARROW_DOWN";
                if (propertyGroup != null) {
                    lovKey = propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_LOV_KEY);
                }
                if (lovKey == null) {
                    lovKey = "SHIFT+ARROW_DOWN";
                }
                String[] keys = new String[] { lovKey, "ENTER", "RETURN", "CR" };
                label.setData(EJ_RWT.ACTIVE_KEYS, keys);
                return label;
            }
        };
        if (hint != null && hint.trim().length() > 0) {
            updateStackHint(hint);
        }
        _mandatoryDecoration = new ControlDecoration(_actionControl, SWT.TOP | SWT.LEFT);
        _errorDecoration = new ControlDecoration(_actionControl, SWT.TOP | SWT.LEFT);
        _errorDecoration.setImage(getDecorationImage(FieldDecorationRegistry.DEC_ERROR));
        _mandatoryDecoration.setImage(getDecorationImage(FieldDecorationRegistry.DEC_REQUIRED));
        _mandatoryDecoration.setShowHover(true);
        _mandatoryDecoration.setDescriptionText(_screenItemProperties.getLabel() == null || _screenItemProperties.getLabel().isEmpty() ? "Required Item" : String.format("%s is required", _screenItemProperties.getLabel()));
        if (_isValid) {
            _errorDecoration.hide();
        }
        if (message != null) {
            setMessage(message);
        }
        _mandatoryDecoration.hide();
        setInitialValue(_baseValue);
    }
}
Also used : MultiDateFormater(org.entirej.applicationframework.rwt.renderers.item.EJRWTDateItemRenderer.MultiDateFormater) EJFrameworkExtensionProperties(org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties) MouseEvent(org.eclipse.swt.events.MouseEvent) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) EJRWTEntireJStackedPane(org.entirej.applicationframework.rwt.layout.EJRWTEntireJStackedPane) MouseListener(org.eclipse.swt.events.MouseListener) EJRWTAbstractPanelAction(org.entirej.applicationframework.rwt.application.components.EJRWTAbstractPanelAction) ControlDecoration(org.eclipse.jface.fieldassist.ControlDecoration)

Example 2 with EJRWTEntireJStackedPane

use of org.entirej.applicationframework.rwt.layout.EJRWTEntireJStackedPane in project rap by entirej.

the class EJRWTStackedPaneFormContainer method createContainer.

public Composite createContainer(Composite parent) {
    if (_stackPane != null) {
        _stackPane.dispose();
        _stackPane = null;
    }
    _stackPane = new EJRWTEntireJStackedPane(parent, getStyle());
    return _stackPane;
}
Also used : EJRWTEntireJStackedPane(org.entirej.applicationframework.rwt.layout.EJRWTEntireJStackedPane)

Example 3 with EJRWTEntireJStackedPane

use of org.entirej.applicationframework.rwt.layout.EJRWTEntireJStackedPane in project rap by entirej.

the class EJRWTFormRenderer method createStackedCanvas.

private void createStackedCanvas(Composite parent, final EJCanvasProperties canvasProperties, final EJCanvasController canvasController) {
    final String name = canvasProperties.getName();
    final EJRWTTrayPane trayPane = new EJRWTTrayPane(parent);
    trayPane.setLayoutData(createCanvasGridData(canvasProperties));
    parent = trayPane;
    final EJRWTEntireJStackedPane stackedPane = new EJRWTEntireJStackedPane(parent);
    trayPane.initBase(stackedPane);
    stackedPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_FORM);
    stackedPane.setLayoutData(createCanvasGridData(canvasProperties));
    _stackedPanes.put(name, stackedPane);
    CanvasHandler canvasHandler = new CanvasHandler() {

        private Collection<EJMessage> msgs;

        @Override
        public void clearCanvasMessages() {
            this.msgs = null;
            if (trayPane != null && !trayPane.isDisposed()) {
                trayPane.closeTray();
            }
        }

        @Override
        public void setCanvasMessages(Collection<EJMessage> messages) {
            this.msgs = messages;
            if (trayPane != null && !trayPane.isDisposed()) {
                if (trayPane.getTray() != null) {
                    trayPane.closeTray();
                }
                {
                    MessageTray messageTray = new MessageTray(canvasProperties.getCloseableMessagePane()) {

                        @Override
                        void close() {
                            if (trayPane != null && !trayPane.isDisposed()) {
                                trayPane.closeTray();
                            }
                        }
                    };
                    messageTray.setMessages(msgs);
                    TrayLocation location = TrayLocation.RIGHT;
                    switch(canvasProperties.getMessagePosition()) {
                        case BOTTOM:
                            location = TrayLocation.BOTTOM;
                            break;
                        case LEFT:
                            location = TrayLocation.LEFT;
                            break;
                        case RIGHT:
                            location = TrayLocation.RIGHT;
                            break;
                        case TOP:
                            location = TrayLocation.TOP;
                            break;
                        default:
                            break;
                    }
                    trayPane.openTray(location, messageTray, canvasProperties.getMessagePaneSize());
                }
            }
        }

        @Override
        public void add(EJInternalBlock block) {
        }

        @Override
        public EJCanvasType getType() {
            return EJCanvasType.STACKED;
        }
    };
    _canvases.put(canvasProperties.getName(), canvasHandler);
    if (!canvasProperties.getCloseableMessagePane()) {
        canvasHandler.setCanvasMessages(Collections.<EJMessage>emptyList());
    }
    for (final EJStackedPageProperties page : canvasProperties.getStackedPageContainer().getAllStackedPageProperties()) {
        stackedPane.add(page.getName(), new EJRWTEntireJStackedPane.StackedPage() {

            Control control;

            @Override
            public String getKey() {
                return page.getName();
            }

            @Override
            public Control getControl() {
                if (control != null && !control.isDisposed()) {
                    return control;
                }
                final ScrolledComposite scrollComposite = new EJRWTScrolledComposite(stackedPane, SWT.V_SCROLL | SWT.H_SCROLL);
                control = scrollComposite;
                final EJRWTEntireJGridPane pagePane = new EJRWTEntireJGridPane(scrollComposite, page.getNumCols());
                pagePane.cleanLayout();
                int width = 0;
                int height = 0;
                for (EJCanvasProperties properties : page.getContainedCanvases().getAllCanvasProperties()) {
                    createCanvas(pagePane, properties, canvasController);
                    int width2 = properties.getWidth();
                    int height2 = properties.getHeight();
                    if (properties.getBlockProperties() != null) {
                        width2 = properties.getBlockProperties().getMainScreenProperties().getWidth();
                        height2 = properties.getBlockProperties().getMainScreenProperties().getHeight();
                    }
                    if (width < width2) {
                        width = width2;
                    }
                    if (height < height2) {
                        height = height2;
                    }
                }
                scrollComposite.setContent(pagePane);
                scrollComposite.setMinSize(width, height);
                scrollComposite.setExpandHorizontal(true);
                scrollComposite.setExpandVertical(true);
                scrollComposite.setContent(pagePane);
                stackedPane.layout();
                return control;
            }
        });
    }
    if (canvasProperties.getInitialStackedPageName() != null) {
        stackedPane.showPane(canvasProperties.getInitialStackedPageName());
    }
    if (_stackedPanesCache.containsKey(name)) {
        stackedPane.showPane(_stackedPanesCache.get(name));
        _stackedPanesCache.remove(name);
    }
    _canvasesIds.add(name);
}
Also used : EJInternalBlock(org.entirej.framework.core.internal.EJInternalBlock) EJCanvasProperties(org.entirej.framework.core.properties.interfaces.EJCanvasProperties) EJRWTEntireJStackedPane(org.entirej.applicationframework.rwt.layout.EJRWTEntireJStackedPane) EJRWTScrolledComposite(org.entirej.applicationframework.rwt.layout.EJRWTScrolledComposite) EJStackedPageProperties(org.entirej.framework.core.properties.interfaces.EJStackedPageProperties) Control(org.eclipse.swt.widgets.Control) TrayLocation(org.entirej.applicationframework.rwt.application.form.containers.EJRWTTrayDialog.TrayLocation) Collection(java.util.Collection) EJRWTScrolledComposite(org.entirej.applicationframework.rwt.layout.EJRWTScrolledComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) EJRWTTrayPane(org.entirej.applicationframework.rwt.application.form.containers.EJRWTTrayPane) EJRWTEntireJGridPane(org.entirej.applicationframework.rwt.layout.EJRWTEntireJGridPane)

Aggregations

EJRWTEntireJStackedPane (org.entirej.applicationframework.rwt.layout.EJRWTEntireJStackedPane)3 Collection (java.util.Collection)1 ControlDecoration (org.eclipse.jface.fieldassist.ControlDecoration)1 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1 MouseListener (org.eclipse.swt.events.MouseListener)1 Composite (org.eclipse.swt.widgets.Composite)1 Control (org.eclipse.swt.widgets.Control)1 Label (org.eclipse.swt.widgets.Label)1 EJRWTAbstractPanelAction (org.entirej.applicationframework.rwt.application.components.EJRWTAbstractPanelAction)1 TrayLocation (org.entirej.applicationframework.rwt.application.form.containers.EJRWTTrayDialog.TrayLocation)1 EJRWTTrayPane (org.entirej.applicationframework.rwt.application.form.containers.EJRWTTrayPane)1 EJRWTEntireJGridPane (org.entirej.applicationframework.rwt.layout.EJRWTEntireJGridPane)1 EJRWTScrolledComposite (org.entirej.applicationframework.rwt.layout.EJRWTScrolledComposite)1 MultiDateFormater (org.entirej.applicationframework.rwt.renderers.item.EJRWTDateItemRenderer.MultiDateFormater)1 EJInternalBlock (org.entirej.framework.core.internal.EJInternalBlock)1 EJFrameworkExtensionProperties (org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties)1 EJCanvasProperties (org.entirej.framework.core.properties.interfaces.EJCanvasProperties)1 EJStackedPageProperties (org.entirej.framework.core.properties.interfaces.EJStackedPageProperties)1