Search in sources :

Example 6 with EJInternalForm

use of org.entirej.framework.core.internal.EJInternalForm in project rap by entirej.

the class EJRWTStackedPaneFormContainer method switchToForm.

@Override
public EJInternalForm switchToForm(EJInternalForm aform) {
    for (EJInternalForm form : _stackedPages.keySet()) {
        if (form.equals(aform)) {
            EJRWTFormRenderer renderer = (EJRWTFormRenderer) form.getRenderer();
            _stackPane.showPane(_stackedPages.get(form));
            EJ_RWT.setAttribute(_stackPane, "ej-item-selection", form.getProperties().getName());
            renderer.gainInitialFocus();
            form.focusGained();
            for (EJRWTFormSelectedListener listener : _formSelectedListeners) {
                listener.fireFormSelected(form);
            }
            return form;
        }
    }
    return null;
}
Also used : EJRWTFormRenderer(org.entirej.applicationframework.rwt.renderers.form.EJRWTFormRenderer) EJRWTFormSelectedListener(org.entirej.applicationframework.rwt.application.interfaces.EJRWTFormSelectedListener) EJInternalForm(org.entirej.framework.core.internal.EJInternalForm)

Example 7 with EJInternalForm

use of org.entirej.framework.core.internal.EJInternalForm in project rap by entirej.

the class EJRWTTabPaneFormContainer method switchToForm.

@Override
public EJInternalForm switchToForm(String key) {
    for (EJInternalForm form : _tabPages.keySet()) {
        if (form.getProperties().getName().equalsIgnoreCase(key)) {
            EJRWTFormRenderer renderer = (EJRWTFormRenderer) form.getRenderer();
            _folder.setSelection(_tabPages.get(form));
            EJ_RWT.setAttribute(_folder, "ej-item-selection", form.getProperties().getName());
            renderer.gainInitialFocus();
            return form;
        }
    }
    return null;
}
Also used : EJRWTFormRenderer(org.entirej.applicationframework.rwt.renderers.form.EJRWTFormRenderer) EJInternalForm(org.entirej.framework.core.internal.EJInternalForm)

Example 8 with EJInternalForm

use of org.entirej.framework.core.internal.EJInternalForm in project rap by entirej.

the class EJRWTApplicationContainer method buildApplication.

void buildApplication(EJRWTApplicationManager applicationManager, Composite mainWindow, String serviceForm) {
    _applicationManager = applicationManager;
    _mainPane = new Composite(mainWindow, SWT.NO_FOCUS);
    _mainPane.setData(EJ_RWT.CUSTOM_VARIANT, "applayout");
    mainWindow.setLayout(new FillLayout());
    if (serviceForm == null)
        buildApplicationContainer();
    else
        buildServiceApplicationContainer(serviceForm);
    if (_formContainer == null) {
        _formContainer = new EJRWTFormContainer() {

            EJRWTAbstractDialog _popupDialog;

            EJRWTFormPopUp _formPopup;

            @Override
            public EJInternalForm switchToForm(String key) {
                // ignore
                return null;
            }

            @Override
            public EJInternalForm switchToForm(EJInternalForm form) {
                // TODO Auto-generated method stub
                return null;
            }

            @Override
            public void removeFormSelectedListener(EJRWTFormSelectedListener selectionListener) {
            // ignore
            }

            @Override
            public void popupFormClosed() {
                if (_formPopup != null) {
                    _formPopup.close();
                    _formPopup = null;
                }
            }

            @Override
            public void openPopupForm(EJPopupFormController popupController) {
                _formPopup = new EJRWTFormPopUp(_applicationManager.getShell(), popupController);
                _formPopup.showForm();
            }

            @Override
            public Collection<EJInternalForm> getAllForms() {
                // ignore
                return Collections.emptyList();
            }

            @Override
            public EJInternalForm getActiveForm() {
                // ignore
                return null;
            }

            @Override
            public boolean containsForm(String formName) {
                // ignore
                return false;
            }

            @Override
            public void closeForm(EJInternalForm form) {
                if (_formPopup != null && _formPopup.getPopupController().getPopupForm().equals(form)) {
                    _formPopup.close();
                    _formPopup = null;
                    return;
                }
                if (_popupDialog != null) {
                    _popupDialog.close();
                    _popupDialog = null;
                }
            }

            @Override
            public void addFormSelectedListener(EJRWTFormSelectedListener selectionListener) {
            // ignore
            }

            @Override
            public EJInternalForm addForm(final EJInternalForm form) {
                final int height = form.getProperties().getFormHeight();
                final int width = form.getProperties().getFormWidth();
                final EJRWTFormRenderer formRenderer = (EJRWTFormRenderer) form.getRenderer();
                _popupDialog = new EJRWTAbstractDialog(_applicationManager.getShell()) {

                    private static final long serialVersionUID = -4685316941898120169L;

                    @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(form.getProperties().getFormWidth(), form.getProperties().getFormHeight());
                        formRenderer.gainInitialFocus();
                    }

                    @Override
                    public int open() {
                        return super.open();
                    }

                    private void addExtraButton(Composite parent, String label, int id) {
                        if (label == null || label.length() == 0) {
                            return;
                        }
                        createButton(parent, id, label, false);
                    }

                    @Override
                    public boolean close() {
                        return super.close();
                    }
                };
                _popupDialog.create();
                final EJCoreFormProperties coreFormProperties = form.getProperties();
                _popupDialog.getShell().setData("POPUP - " + coreFormProperties.getName());
                _popupDialog.getShell().setText(coreFormProperties.getTitle() == null ? coreFormProperties.getName() : coreFormProperties.getTitle());
                // add dialog border offsets
                _popupDialog.getShell().setSize(width + 80, height + 100);
                _popupDialog.centreLocation();
                _popupDialog.open();
                _popupDialog.activateDialog();
                return form;
            }

            @Override
            public void updateFormTitle(EJInternalForm form) {
            // TODO Auto-generated method stub
            }
        };
    }
}
Also used : Composite(org.eclipse.swt.widgets.Composite) EJRWTScrolledComposite(org.entirej.applicationframework.rwt.layout.EJRWTScrolledComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) EJRWTFormPopUp(org.entirej.applicationframework.rwt.application.form.containers.EJRWTFormPopUp) FillLayout(org.eclipse.swt.layout.FillLayout) EJInternalForm(org.entirej.framework.core.internal.EJInternalForm) EJRWTScrolledComposite(org.entirej.applicationframework.rwt.layout.EJRWTScrolledComposite) EJCoreFormProperties(org.entirej.framework.core.properties.EJCoreFormProperties) EJRWTFormContainer(org.entirej.applicationframework.rwt.application.interfaces.EJRWTFormContainer) EJRWTAbstractDialog(org.entirej.applicationframework.rwt.application.form.containers.EJRWTAbstractDialog) Collection(java.util.Collection) EJRWTFormRenderer(org.entirej.applicationframework.rwt.renderers.form.EJRWTFormRenderer) EJRWTScrolledComposite(org.entirej.applicationframework.rwt.layout.EJRWTScrolledComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) EJRWTFormSelectedListener(org.entirej.applicationframework.rwt.application.interfaces.EJRWTFormSelectedListener) EJPopupFormController(org.entirej.framework.core.data.controllers.EJPopupFormController)

Example 9 with EJInternalForm

use of org.entirej.framework.core.internal.EJInternalForm in project rap by entirej.

the class EJRWTApplicationContainer method add.

/**
 * Opens a new form and adds it to the FormContainer
 * <p>
 * If the form passed is <code>null</code> or not
 * {@link EJSwingFormContainer} has been implemented then this method will
 * do nothing
 *
 * @param form
 *            The form to be opened and added to the
 *            {@link EJSwingFormContainer}
 */
public void add(EJInternalForm form) {
    if (form == null) {
        return;
    }
    if (_formContainer != null) {
        EJInternalForm addForm = _formContainer.addForm(form);
        // Inform the listeners that the form was opened
        fireFormOpened(addForm);
    }
}
Also used : EJInternalForm(org.entirej.framework.core.internal.EJInternalForm)

Example 10 with EJInternalForm

use of org.entirej.framework.core.internal.EJInternalForm in project rap by entirej.

the class EJRWTPreviousRecordAction method run.

@Override
public void run() {
    logger.trace("START run");
    if (_currentBlock == null) {
        EJInternalForm form = _toolbar.getForm();
        if (form != null && form.getFocusedBlock() != null) {
            try {
                form.getFocusedBlock().previousRecord();
            } catch (Exception e) {
                form.getFrameworkManager().getApplicationManager().handleException(e);
            }
            _toolbar.synchronize(form.getFocusedBlock().getBlockController());
        }
    } else {
        try {
            _currentBlock.previousRecord();
        } catch (Exception e) {
            _currentBlock.getFrameworkManager().getApplicationManager().handleException(e);
        }
        _toolbar.synchronize(_currentBlock);
    }
    logger.trace("END run");
}
Also used : EJInternalForm(org.entirej.framework.core.internal.EJInternalForm)

Aggregations

EJInternalForm (org.entirej.framework.core.internal.EJInternalForm)13 EJRWTFormRenderer (org.entirej.applicationframework.rwt.renderers.form.EJRWTFormRenderer)7 EJRWTFormSelectedListener (org.entirej.applicationframework.rwt.application.interfaces.EJRWTFormSelectedListener)5 EJInternalEditableBlock (org.entirej.framework.core.internal.EJInternalEditableBlock)2 Collection (java.util.Collection)1 CTabFolder (org.eclipse.swt.custom.CTabFolder)1 CTabFolder2Adapter (org.eclipse.swt.custom.CTabFolder2Adapter)1 CTabFolderEvent (org.eclipse.swt.custom.CTabFolderEvent)1 CTabItem (org.eclipse.swt.custom.CTabItem)1 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 FillLayout (org.eclipse.swt.layout.FillLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 Control (org.eclipse.swt.widgets.Control)1 EJRWTAbstractDialog (org.entirej.applicationframework.rwt.application.form.containers.EJRWTAbstractDialog)1 EJRWTFormPopUp (org.entirej.applicationframework.rwt.application.form.containers.EJRWTFormPopUp)1 EJRWTFormContainer (org.entirej.applicationframework.rwt.application.interfaces.EJRWTFormContainer)1 EJRWTEntireJGridPane (org.entirej.applicationframework.rwt.layout.EJRWTEntireJGridPane)1 EJRWTEntireJStackedPane (org.entirej.applicationframework.rwt.layout.EJRWTEntireJStackedPane)1