Search in sources :

Example 1 with EJRWTApplicationComponent

use of org.entirej.applicationframework.rwt.application.interfaces.EJRWTApplicationComponent in project rap by entirej.

the class EJRWTApplicationContainer method buildApplicationContainer.

protected void buildApplicationContainer() {
    GridLayout gridLayout = new GridLayout(_layoutContainer.getColumns(), false);
    _mainPane.setLayout(gridLayout);
    List<EJCoreLayoutItem> items = _layoutContainer.getItems();
    for (EJCoreLayoutItem item : items) {
        switch(item.getType()) {
            case GROUP:
                createGroupLayout(_mainPane, (LayoutGroup) item);
                break;
            case SPACE:
                createSpace(_mainPane, (LayoutSpace) item);
                break;
            case COMPONENT:
                createComponent(_mainPane, (LayoutComponent) item);
                break;
            case SPLIT:
                createSplitLayout(_mainPane, (SplitGroup) item);
                break;
            case TAB:
                createTabLayout(_mainPane, (TabGroup) item);
                break;
        }
    }
    _mainPane.layout();
    if (_formContainer != null) {
        for (EJRWTApplicationComponent applicationComponent : _addedComponents) {
            if (applicationComponent instanceof EJRWTFormSelectedListener) {
                _formContainer.addFormSelectedListener(applicationComponent);
            }
        }
    }
    for (EJRWTSingleFormContainer singleFormContainer : _singleFormContainers) {
        if (singleFormContainer.getForm() != null) {
            fireFormOpened(singleFormContainer.getForm());
        }
    }
}
Also used : EJRWTSingleFormContainer(org.entirej.applicationframework.rwt.application.form.containers.EJRWTSingleFormContainer) GridLayout(org.eclipse.swt.layout.GridLayout) EJCoreLayoutItem(org.entirej.framework.core.properties.EJCoreLayoutItem) EJRWTFormSelectedListener(org.entirej.applicationframework.rwt.application.interfaces.EJRWTFormSelectedListener) EJRWTApplicationComponent(org.entirej.applicationframework.rwt.application.interfaces.EJRWTApplicationComponent)

Example 2 with EJRWTApplicationComponent

use of org.entirej.applicationframework.rwt.application.interfaces.EJRWTApplicationComponent in project rap by entirej.

the class EJRWTApplicationContainer method createComponent.

private void createComponent(Composite parent, EJCoreLayoutItem.LayoutComponent component) {
    try {
        EJApplicationComponentRenderer applicationComponentRenderer = EJRendererFactory.getInstance().getApplicationComponentRenderer(component.getRenderer());
        if (applicationComponentRenderer instanceof EJRWTFormContainer) {
            if (_formContainer != null) {
                throw new IllegalStateException("Multiple EJRWTFormContainer setup in layout");
            }
            _formContainer = (EJRWTFormContainer) applicationComponentRenderer;
        }
        if (applicationComponentRenderer instanceof EJRWTApplicationStatusbar) {
            if (_statusbar != null) {
                throw new IllegalStateException("Multiple EJRWTApplicationStatusbar setup in layout");
            }
            _statusbar = (EJRWTApplicationStatusbar) applicationComponentRenderer;
        }
        if (applicationComponentRenderer instanceof EJRWTSingleFormContainer) {
            _singleFormContainers.add((EJRWTSingleFormContainer) applicationComponentRenderer);
        }
        if (applicationComponentRenderer instanceof EJRWTApplicationComponent) {
            _addedComponents.add((EJRWTApplicationComponent) applicationComponentRenderer);
        }
        EJRWTAppComponentRenderer renderer = (EJRWTAppComponentRenderer) applicationComponentRenderer;
        renderer.createContainer(_applicationManager, parent, component.getRendereProperties());
        EJ_RWT.setTestId(renderer.getGuiComponent(), component.getName());
        renderer.getGuiComponent().setLayoutData(createGridData(component));
        return;
    } catch (Exception e) {
        _applicationManager.getApplicationMessenger().handleException(e, true);
    }
    // fail over
    Composite layoutBody = new Composite(parent, SWT.NO_FOCUS | SWT.BORDER);
    layoutBody.setLayoutData(createGridData(component));
    layoutBody.setLayout(new GridLayout());
    Label spaceLabel = new Label(layoutBody, SWT.NONE);
    spaceLabel.setText(String.format("<%s>", component.getRenderer() == null || component.getRenderer().length() == 0 ? "<component>" : component.getRenderer()));
    spaceLabel.setLayoutData(createGridData(component));
    spaceLabel.setLayoutData(new GridData(GridData.FILL_BOTH));
}
Also used : EJRWTSingleFormContainer(org.entirej.applicationframework.rwt.application.form.containers.EJRWTSingleFormContainer) GridLayout(org.eclipse.swt.layout.GridLayout) EJRWTFormContainer(org.entirej.applicationframework.rwt.application.interfaces.EJRWTFormContainer) Composite(org.eclipse.swt.widgets.Composite) EJRWTScrolledComposite(org.entirej.applicationframework.rwt.layout.EJRWTScrolledComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) EJApplicationComponentRenderer(org.entirej.framework.core.renderers.interfaces.EJApplicationComponentRenderer) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) EJRWTApplicationStatusbar(org.entirej.applicationframework.rwt.application.interfaces.EJRWTApplicationStatusbar) EJRWTApplicationComponent(org.entirej.applicationframework.rwt.application.interfaces.EJRWTApplicationComponent) EJRWTAppComponentRenderer(org.entirej.applicationframework.rwt.application.interfaces.EJRWTAppComponentRenderer) EJActionProcessorException(org.entirej.framework.core.EJActionProcessorException)

Aggregations

GridLayout (org.eclipse.swt.layout.GridLayout)2 EJRWTSingleFormContainer (org.entirej.applicationframework.rwt.application.form.containers.EJRWTSingleFormContainer)2 EJRWTApplicationComponent (org.entirej.applicationframework.rwt.application.interfaces.EJRWTApplicationComponent)2 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)1 GridData (org.eclipse.swt.layout.GridData)1 Composite (org.eclipse.swt.widgets.Composite)1 Label (org.eclipse.swt.widgets.Label)1 EJRWTAppComponentRenderer (org.entirej.applicationframework.rwt.application.interfaces.EJRWTAppComponentRenderer)1 EJRWTApplicationStatusbar (org.entirej.applicationframework.rwt.application.interfaces.EJRWTApplicationStatusbar)1 EJRWTFormContainer (org.entirej.applicationframework.rwt.application.interfaces.EJRWTFormContainer)1 EJRWTFormSelectedListener (org.entirej.applicationframework.rwt.application.interfaces.EJRWTFormSelectedListener)1 EJRWTScrolledComposite (org.entirej.applicationframework.rwt.layout.EJRWTScrolledComposite)1 EJActionProcessorException (org.entirej.framework.core.EJActionProcessorException)1 EJCoreLayoutItem (org.entirej.framework.core.properties.EJCoreLayoutItem)1 EJApplicationComponentRenderer (org.entirej.framework.core.renderers.interfaces.EJApplicationComponentRenderer)1