Search in sources :

Example 1 with DetailLayout

use of aero.minova.rcp.css.widgets.DetailLayout in project aero.minova.rcp by minova-afis.

the class WFCDetailPart method layoutForm.

private void layoutForm(Composite parent) {
    // Wir wollen eine horizontale Scrollbar, damit auch bei breiten Details alles erreichbar ist
    scrolled = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
    Composite wrap = new Composite(scrolled, SWT.NO_SCROLL);
    DetailLayout detailLayout = new DetailLayout();
    wrap.setLayout(detailLayout);
    parent.setData(Constants.DETAIL_COMPOSITE, wrap);
    mPerspective.getContext().set(Constants.DETAIL_LAYOUT, detailLayout);
    // Abschnitte der Hauptmaske und OPs erstellen
    for (Object headOrPage : form.getDetail().getHeadAndPageAndGrid()) {
        HeadOrPageOrGridWrapper wrapper = new HeadOrPageOrGridWrapper(headOrPage);
        layoutSection(wrap, wrapper);
    }
    loadOptionPages(wrap);
    scrolled.setContent(wrap);
    scrolled.setExpandHorizontal(true);
    scrolled.setExpandVertical(true);
    scrolled.addListener(SWT.Resize, event -> adjustScrollbar(scrolled, wrap));
    // Setzen der TabListe der Sections.
    parent.setTabList(parent.getChildren());
    // Holen des Parts
    Composite part = parent.getParent();
    // Setzen der TabListe des Parts. Dabei bestimmt SelectAllControls, ob die Toolbar mit selektiert wird.
    part.setTabList(TabUtil.getTabListForPart(part, selectAllControls));
    // Wir setzen eine leere TabListe für die Perspektive, damit nicht durch die Anwendung mit Tab navigiert werden kann.
    part.getParent().setTabList(new Control[0]);
    // Helper-Klasse initialisieren
    initializeHelper(form.getHelperClass());
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) DetailLayout(aero.minova.rcp.css.widgets.DetailLayout) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite)

Example 2 with DetailLayout

use of aero.minova.rcp.css.widgets.DetailLayout in project aero.minova.rcp by minova-afis.

the class WFCStatisticDetailPart method postConstruct.

@PostConstruct
public void postConstruct(Composite parent) {
    this.parent = parent;
    formToolkit = new FormToolkit(parent.getDisplay());
    resManager = new LocalResourceManager(JFaceResources.getResources(), parent);
    mDetail = new MDetail();
    mDetail.setDetailAccessor(new DetailAccessor(mDetail));
    DetailLayout detailLayout = new DetailLayout();
    parent.setLayout(detailLayout);
    mPerspective.getContext().set(Constants.DETAIL_LAYOUT, detailLayout);
    layoutSection();
}
Also used : MDetail(aero.minova.rcp.model.form.MDetail) DetailAccessor(aero.minova.rcp.rcp.accessor.DetailAccessor) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) LocalResourceManager(org.eclipse.jface.resource.LocalResourceManager) DetailLayout(aero.minova.rcp.css.widgets.DetailLayout) PostConstruct(javax.annotation.PostConstruct)

Example 3 with DetailLayout

use of aero.minova.rcp.css.widgets.DetailLayout in project aero.minova.rcp by minova-afis.

the class OptimizeDetailHandler method execute.

@Execute
public void execute(EModelService emservice, MWindow mwindow, MPerspective mPerspective) {
    MPart detail = emservice.findElements(emservice.getActivePerspective(mwindow), "aero.minova.rcp.rcp.part.details", MPart.class).get(0);
    Integer defaultSectionWidth = (Integer) mPerspective.getContext().get(Constants.DETAIL_WIDTH);
    // Detail-Composite finden (Kann auch Statistik-Part sein)
    Composite detailComposite;
    if (detail.getObject() instanceof WFCDetailPart) {
        WFCDetailPart wfcDetailPart = (WFCDetailPart) detail.getObject();
        detailComposite = (Composite) wfcDetailPart.getComposite().getData(Constants.DETAIL_COMPOSITE);
    } else {
        WFCStatisticDetailPart wfcStatisticDetailPart = (WFCStatisticDetailPart) detail.getObject();
        detailComposite = wfcStatisticDetailPart.getComposite();
    }
    // Optimale Breite des Details. Dabei werden die horizontalFill-Abschnitte ignoriert
    DetailLayout detailLayout = (DetailLayout) mPerspective.getContext().get(Constants.DETAIL_LAYOUT);
    int prefDetailWidth = detailLayout.layout(detailComposite, false, detailComposite.getSize().x, false, false).x;
    int size = 100000;
    float detailSize = (float) (prefDetailWidth + 35.0) / mwindow.getWidth();
    float leftSize = 1.0f - detailSize;
    MPartSashContainer element = emservice.findElements(emservice.getActivePerspective(mwindow), "aero.minova.rcp.rcp.partsashcontainer.main", MPartSashContainer.class).get(0);
    for (MPartSashContainerElement e : element.getChildren()) {
        if (e.getElementId() != null && e.getElementId().equalsIgnoreCase("aero.minova.rcp.rcp.partstack.details")) {
            e.setContainerData(Integer.toString((int) (detailSize * size)));
        } else {
            e.setContainerData(Integer.toString((int) (leftSize * size)));
        }
    }
}
Also used : MPart(org.eclipse.e4.ui.model.application.ui.basic.MPart) Composite(org.eclipse.swt.widgets.Composite) WFCStatisticDetailPart(aero.minova.rcp.rcp.parts.WFCStatisticDetailPart) DetailLayout(aero.minova.rcp.css.widgets.DetailLayout) WFCDetailPart(aero.minova.rcp.rcp.parts.WFCDetailPart) MPartSashContainerElement(org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainerElement) MPartSashContainer(org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainer) Execute(org.eclipse.e4.core.di.annotations.Execute)

Aggregations

DetailLayout (aero.minova.rcp.css.widgets.DetailLayout)3 Composite (org.eclipse.swt.widgets.Composite)2 MDetail (aero.minova.rcp.model.form.MDetail)1 DetailAccessor (aero.minova.rcp.rcp.accessor.DetailAccessor)1 WFCDetailPart (aero.minova.rcp.rcp.parts.WFCDetailPart)1 WFCStatisticDetailPart (aero.minova.rcp.rcp.parts.WFCStatisticDetailPart)1 PostConstruct (javax.annotation.PostConstruct)1 Execute (org.eclipse.e4.core.di.annotations.Execute)1 MPart (org.eclipse.e4.ui.model.application.ui.basic.MPart)1 MPartSashContainer (org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainer)1 MPartSashContainerElement (org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainerElement)1 LocalResourceManager (org.eclipse.jface.resource.LocalResourceManager)1 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)1 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)1 FormToolkit (org.eclipse.ui.forms.widgets.FormToolkit)1