Search in sources :

Example 1 with EJRWTAppFormRenderer

use of org.entirej.applicationframework.rwt.renderer.interfaces.EJRWTAppFormRenderer in project rap by entirej.

the class EJRWTFormPopUp method showForm.

public void showForm() {
    final int height = _popupController.getPopupForm().getProperties().getFormHeight();
    final int width = _popupController.getPopupForm().getProperties().getFormWidth();
    EJManagedFormRendererWrapper wrapper = _popupController.getPopupForm().getManagedRenderer();
    final EJRWTAppFormRenderer formRenderer = (EJRWTAppFormRenderer) wrapper.getUnmanagedRenderer();
    _popupDialog = new EJRWTAbstractDialog(_mainShell) {

        @Override
        public void createBody(Composite parent) {
            parent.setLayout(new FillLayout());
            final ScrolledComposite scrollComposite = new EJRWTScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
            formRenderer.createControl(scrollComposite);
            scrollComposite.setContent(formRenderer.getGuiComponent());
            scrollComposite.setExpandHorizontal(true);
            scrollComposite.setExpandVertical(true);
            scrollComposite.setMinSize(width, height);
        }

        @Override
        public void canceled() {
            _popupController.getPopupForm().close();
        }
    };
    _popupDialog.create();
    _popupDialog.getShell().setText(_popupController.getPopupForm().getProperties().getTitle());
    // add offset
    _popupDialog.getShell().setSize(width + 50, height + 70);
    _popupDialog.open();
    _popupDialog.activateDialog();
}
Also used : EJRWTScrolledComposite(org.entirej.applicationframework.rwt.layout.EJRWTScrolledComposite) EJRWTScrolledComposite(org.entirej.applicationframework.rwt.layout.EJRWTScrolledComposite) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) EJRWTScrolledComposite(org.entirej.applicationframework.rwt.layout.EJRWTScrolledComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) FillLayout(org.eclipse.swt.layout.FillLayout) EJManagedFormRendererWrapper(org.entirej.framework.core.renderers.EJManagedFormRendererWrapper) EJRWTAppFormRenderer(org.entirej.applicationframework.rwt.renderer.interfaces.EJRWTAppFormRenderer)

Example 2 with EJRWTAppFormRenderer

use of org.entirej.applicationframework.rwt.renderer.interfaces.EJRWTAppFormRenderer in project rap by entirej.

the class EJRWTSingleFormContainer method createContainer.

@Override
public void createContainer(EJRWTApplicationManager manager, Composite parent, EJFrameworkExtensionProperties rendererprop) {
    String formid = null;
    formid = getFormId(rendererprop);
    if (formid != null) {
        try {
            _form = manager.getFrameworkManager().createInternalForm(formid, null);
            if (_form != null) {
                Composite composite = new Composite(parent, rendererprop.getBooleanProperty("BORDER", true) ? SWT.BORDER : SWT.NONE);
                FillLayout fillLayout = new FillLayout();
                fillLayout.marginHeight = 5;
                fillLayout.marginWidth = 5;
                String style = rendererprop.getStringProperty("CSS");
                if (style != null)
                    composite.setData(EJ_RWT.CUSTOM_VARIANT, style);
                composite.setLayout(fillLayout);
                EJRWTAppFormRenderer renderer = (EJRWTAppFormRenderer) _form.getRenderer();
                renderer.createControl(composite);
                EJRWTEntireJGridPane gridPane = (EJRWTEntireJGridPane) renderer.getGuiComponent();
                gridPane.cleanLayout();
                gridPane.addFocusListener(new FocusListener() {

                    @Override
                    public void focusLost(FocusEvent arg0) {
                    // ignore
                    }

                    @Override
                    public void focusGained(FocusEvent arg0) {
                        for (EJRWTFormSelectedListener listener : _formSelectedListeners) {
                            listener.fireFormSelected(_form);
                        }
                        Display.getDefault().asyncExec(new Runnable() {

                            @Override
                            public void run() {
                                _form.focusGained();
                            }
                        });
                    }
                });
                _control = composite;
                return;
            }
        } catch (Exception e) {
            manager.getApplicationMessenger().handleException(e, true);
        }
    }
    Label label = new Label(parent, SWT.NONE);
    label.setText("Form could not be found ID#:" + (formid != null ? formid : "<null>"));
    _control = label;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) EJRWTFormSelectedListener(org.entirej.applicationframework.rwt.application.interfaces.EJRWTFormSelectedListener) FillLayout(org.eclipse.swt.layout.FillLayout) FocusListener(org.eclipse.swt.events.FocusListener) FocusEvent(org.eclipse.swt.events.FocusEvent) EJRWTEntireJGridPane(org.entirej.applicationframework.rwt.layout.EJRWTEntireJGridPane) EJRWTAppFormRenderer(org.entirej.applicationframework.rwt.renderer.interfaces.EJRWTAppFormRenderer)

Aggregations

FillLayout (org.eclipse.swt.layout.FillLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 EJRWTAppFormRenderer (org.entirej.applicationframework.rwt.renderer.interfaces.EJRWTAppFormRenderer)2 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)1 FocusEvent (org.eclipse.swt.events.FocusEvent)1 FocusListener (org.eclipse.swt.events.FocusListener)1 Label (org.eclipse.swt.widgets.Label)1 EJRWTFormSelectedListener (org.entirej.applicationframework.rwt.application.interfaces.EJRWTFormSelectedListener)1 EJRWTEntireJGridPane (org.entirej.applicationframework.rwt.layout.EJRWTEntireJGridPane)1 EJRWTScrolledComposite (org.entirej.applicationframework.rwt.layout.EJRWTScrolledComposite)1 EJManagedFormRendererWrapper (org.entirej.framework.core.renderers.EJManagedFormRendererWrapper)1