Search in sources :

Example 1 with MinovaSectionData

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

the class SectionGrid method fillHorizontal.

public void fillHorizontal() {
    MinovaSectionData rd = (MinovaSectionData) section.getLayoutData();
    rd.horizontalFill = !rd.horizontalFill;
    section.requestLayout();
    // Zustand speichern, damit wiederhergestellt werden kann
    String key = form.getTitle() + "." + section.getData(FieldUtil.TRANSLATE_PROPERTY) + ".horizontalFill";
    prefsDetailSections.put(key, rd.horizontalFill + "");
}
Also used : MinovaSectionData(aero.minova.rcp.css.widgets.MinovaSectionData)

Example 2 with MinovaSectionData

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

the class WFCDetailPart method layoutSection.

/**
 * Diese Methode bekommt einen Composite übergeben, und erstellt aus dem übergenen Objekt ein Section. Diese Sektion ist entweder der Head (Kopfdaten) oder
 * eine OptionPage die sich unterhalb der Kopfdaten eingliedert. Zusätzlich wird ein TraverseListener übergeben, der das Verhalten für TAB und Enter
 * festlegt.
 *
 * @param parent
 * @param headOrPageOrGrid
 */
private void layoutSection(Composite parent, HeadOrPageOrGridWrapper headOrPageOrGrid) {
    MinovaSectionData sectionData = new MinovaSectionData();
    MinovaSection section;
    if (headOrPageOrGrid.isHead) {
        section = new MinovaSection(parent, ExpandableComposite.TITLE_BAR | ExpandableComposite.EXPANDED);
        headSection = section;
    } else {
        section = new MinovaSection(parent, ExpandableComposite.TITLE_BAR | ExpandableComposite.EXPANDED | ExpandableComposite.TWISTIE);
        section.getImageLink().addMouseListener(new MouseAdapter() {

            @Override
            public void mouseDoubleClick(MouseEvent e) {
                minimizeSection(section);
            }
        });
    }
    section.setLayoutData(sectionData);
    section.setData(TRANSLATE_PROPERTY, headOrPageOrGrid.getTranslationText());
    ImageDescriptor imageDescriptor = ImageUtil.getImageDescriptor(headOrPageOrGrid.icon, false);
    if (!imageDescriptor.equals(ImageDescriptor.getMissingImageDescriptor())) {
        section.setImage(resManager.createImage(imageDescriptor));
    }
    section.addControlListener(new ControlAdapter() {

        @Override
        public void controlMoved(ControlEvent e) {
            parent.setTabList(TabUtil.getSortedSectionTabList(parent));
        }
    });
    // Wir erstellen die Section des Details.
    MSection mSection = new MSection(headOrPageOrGrid.isHead, "open", mDetail, headOrPageOrGrid.id, section.getText());
    mSection.setSectionAccessor(new SectionAccessor(mSection, section));
    // Button erstellen, falls vorhanden
    createButton(headOrPageOrGrid, section);
    layoutSectionClient(headOrPageOrGrid, section, mSection);
    section.addListener(SWT.Resize, event -> adjustScrollbar(scrolled, parent));
    // Order setzen und sectionCount erhöhen
    sectionCount++;
    sectionData.order = sectionCount;
    // Alten Zustand wiederherstellen
    // HorizontalFill
    String prefsHorizontalFillKey = form.getTitle() + "." + headOrPageOrGrid.getTranslationText() + ".horizontalFill";
    String horizontalFillString = prefsDetailSections.get(prefsHorizontalFillKey, "false");
    sectionData.horizontalFill = Boolean.parseBoolean(horizontalFillString);
    // Ein-/Ausgeklappt
    String prefsExpandedString = form.getTitle() + "." + headOrPageOrGrid.getTranslationText() + ".expanded";
    String expandedString = prefsDetailSections.get(prefsExpandedString, "true");
    section.setExpanded(Boolean.parseBoolean(expandedString));
    // Minimiert
    String prefsMinimizedString = form.getTitle() + "." + headOrPageOrGrid.getTranslationText() + ".minimized";
    String minimizedString = prefsDetailSections.get(prefsMinimizedString, "false");
    if (Boolean.parseBoolean(minimizedString)) {
        minimizeSection(section);
    }
    detailWidth = section.getCssStyler().getSectionWidth();
    section.requestLayout();
}
Also used : MouseEvent(org.eclipse.swt.events.MouseEvent) ControlAdapter(org.eclipse.swt.events.ControlAdapter) MouseAdapter(org.eclipse.swt.events.MouseAdapter) SectionAccessor(aero.minova.rcp.rcp.accessor.SectionAccessor) MinovaSection(aero.minova.rcp.css.widgets.MinovaSection) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) MSection(aero.minova.rcp.model.form.MSection) ControlEvent(org.eclipse.swt.events.ControlEvent) MinovaSectionData(aero.minova.rcp.css.widgets.MinovaSectionData)

Example 3 with MinovaSectionData

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

the class TabUtil method getSortedSectionTabList.

/**
 * Liefert ein nach der Order sortierten Array von Sections zurück.
 *
 * @param parent
 *            DetailPart
 * @return nach der Order sortierte TabList
 */
public static Control[] getSortedSectionTabList(Composite parent) {
    List<Control> tabList = new ArrayList<>(parent.getChildren().length);
    for (Control section : parent.getChildren()) {
        tabList.add(section);
    }
    Collections.sort(tabList, (f1, f2) -> {
        int order1 = ((MinovaSectionData) f1.getLayoutData()).order;
        int order2 = ((MinovaSectionData) f2.getLayoutData()).order;
        boolean hFill1 = ((MinovaSectionData) f1.getLayoutData()).horizontalFill;
        boolean hFill2 = ((MinovaSectionData) f2.getLayoutData()).horizontalFill;
        if (hFill1 && !hFill2) {
            return 1;
        } else if (!hFill1 && hFill2) {
            return -1;
        } else if (order1 == order2) {
            return 0;
        } else if (order1 < order2) {
            return -1;
        } else {
            return 1;
        }
    });
    return tabList.toArray(new Control[0]);
}
Also used : Control(org.eclipse.swt.widgets.Control) ArrayList(java.util.ArrayList) MinovaSectionData(aero.minova.rcp.css.widgets.MinovaSectionData)

Example 4 with MinovaSectionData

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

the class WFCStatisticDetailPart method layoutSection.

/**
 * Initiales Erstellen der Section und MSection
 *
 * @param parent
 * @param title
 */
private void layoutSection() {
    section = new MinovaSection(parent, ExpandableComposite.TITLE_BAR | ExpandableComposite.EXPANDED);
    section.setData(TRANSLATE_PROPERTY, "@" + STATISTIC);
    MinovaSectionData sectionData = new MinovaSectionData();
    section.setLayoutData(sectionData);
    ImageDescriptor imageDescriptor = ImageUtil.getImageDescriptor(STATISTIC, false);
    if (!imageDescriptor.equals(ImageDescriptor.getMissingImageDescriptor())) {
        section.setImage(resManager.createImage(imageDescriptor));
    }
    mSection = new MSection(true, "open", mDetail, STATISTIC, section.getText());
    mSection.setSectionAccessor(new SectionAccessor(mSection, section));
    mDetail.addMSection(mSection);
    // TabListe des Parts
    Composite cTabFolder = parent.getParent();
    cTabFolder.setTabList(TabUtil.getTabListForPart(cTabFolder, selectAllControls));
    cTabFolder.getParent().setTabList(new Control[0]);
    TranslateUtil.translate(parent, translationService, locale);
    mPerspective.getContext().set(Constants.DETAIL_WIDTH, section.getCssStyler().getSectionWidth());
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) SectionAccessor(aero.minova.rcp.rcp.accessor.SectionAccessor) MinovaSection(aero.minova.rcp.css.widgets.MinovaSection) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) MSection(aero.minova.rcp.model.form.MSection) MinovaSectionData(aero.minova.rcp.css.widgets.MinovaSectionData)

Aggregations

MinovaSectionData (aero.minova.rcp.css.widgets.MinovaSectionData)4 MinovaSection (aero.minova.rcp.css.widgets.MinovaSection)2 MSection (aero.minova.rcp.model.form.MSection)2 SectionAccessor (aero.minova.rcp.rcp.accessor.SectionAccessor)2 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)2 ArrayList (java.util.ArrayList)1 ControlAdapter (org.eclipse.swt.events.ControlAdapter)1 ControlEvent (org.eclipse.swt.events.ControlEvent)1 MouseAdapter (org.eclipse.swt.events.MouseAdapter)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1 Composite (org.eclipse.swt.widgets.Composite)1 Control (org.eclipse.swt.widgets.Control)1 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)1