Search in sources :

Example 1 with MinovaSection

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

the class WFCDetailPart method minimizeSection.

private void minimizeSection(MinovaSection section) {
    section.setVisible(false);
    section.setMinimized(true);
    Image image = section.getImageLink().getImage();
    Control textClient = headSection.getTextClient();
    ToolBar bar = (ToolBar) textClient;
    ToolItem tItem = new ToolItem(bar, SWT.PUSH);
    tItem.setImage(image);
    tItem.setData(FieldUtil.TRANSLATE_PROPERTY, section.getData(FieldUtil.TRANSLATE_PROPERTY));
    tItem.setToolTipText(translationService.translate((String) section.getData(FieldUtil.TRANSLATE_PROPERTY), null));
    tItem.addSelectionListener(SelectionListener.widgetSelectedAdapter(selectionEvent -> {
        section.setVisible(true);
        section.setMinimized(false);
        tItem.dispose();
        bar.requestLayout();
        headSection.requestLayout();
    }));
    headSection.requestLayout();
    bar.requestLayout();
}
Also used : ParameterizedCommand(org.eclipse.core.commands.ParameterizedCommand) MLookupField(aero.minova.rcp.model.form.MLookupField) MinovaSection(aero.minova.rcp.css.widgets.MinovaSection) Point(org.eclipse.swt.graphics.Point) ValueChangeListener(aero.minova.rcp.model.event.ValueChangeListener) BackingStoreException(org.osgi.service.prefs.BackingStoreException) Composite(org.eclipse.swt.widgets.Composite) Map(java.util.Map) IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) IWindowCloseHandler(org.eclipse.e4.ui.workbench.modeling.IWindowCloseHandler) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) MButton(aero.minova.rcp.model.form.MButton) ServiceReference(org.osgi.framework.ServiceReference) ValueChangeEvent(aero.minova.rcp.model.event.ValueChangeEvent) MApplication(org.eclipse.e4.ui.model.application.MApplication) MGrid(aero.minova.rcp.model.form.MGrid) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Constants(aero.minova.rcp.constants.Constants) Node(aero.minova.rcp.form.setup.xbs.Node) LookupField(aero.minova.rcp.rcp.fields.LookupField) WFCDetailCASRequestsUtil(aero.minova.rcp.rcp.util.WFCDetailCASRequestsUtil) ToolItem(org.eclipse.swt.widgets.ToolItem) MouseEvent(org.eclipse.swt.events.MouseEvent) IHelper(aero.minova.rcp.model.helper.IHelper) InstanceScope(org.eclipse.core.runtime.preferences.InstanceScope) Item(org.eclipse.swt.widgets.Item) MenuItem(org.eclipse.swt.widgets.MenuItem) Page(aero.minova.rcp.form.model.xsd.Page) SWT(org.eclipse.swt.SWT) MTextField(aero.minova.rcp.model.form.MTextField) SelectionListener(org.eclipse.swt.events.SelectionListener) MPerspective(org.eclipse.e4.ui.model.application.ui.advanced.MPerspective) UIEventTopic(org.eclipse.e4.ui.di.UIEventTopic) TranslationService(org.eclipse.e4.core.services.translation.TranslationService) ECommandService(org.eclipse.e4.core.commands.ECommandService) EPartService(org.eclipse.e4.ui.workbench.modeling.EPartService) MCommand(org.eclipse.e4.ui.model.application.commands.MCommand) JFaceResources(org.eclipse.jface.resource.JFaceResources) ButtonAccessor(aero.minova.rcp.rcp.accessor.ButtonAccessor) ControlListener(org.eclipse.swt.events.ControlListener) MToolBarElement(org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement) ArrayList(java.util.ArrayList) ControlEvent(org.eclipse.swt.events.ControlEvent) MWindow(org.eclipse.e4.ui.model.application.ui.basic.MWindow) ModelToViewModel(aero.minova.rcp.model.form.ModelToViewModel) Named(javax.inject.Named) Section(org.eclipse.ui.forms.widgets.Section) Onclick(aero.minova.rcp.form.model.xsd.Onclick) MParameter(org.eclipse.e4.ui.model.application.commands.MParameter) Procedure(aero.minova.rcp.form.model.xsd.Procedure) SectionAccessor(aero.minova.rcp.rcp.accessor.SectionAccessor) Shell(org.eclipse.swt.widgets.Shell) ShortDateField(aero.minova.rcp.rcp.fields.ShortDateField) MMenu(org.eclipse.e4.ui.model.application.ui.menu.MMenu) FormLayout(org.eclipse.swt.layout.FormLayout) MHandledItem(org.eclipse.e4.ui.model.application.ui.menu.MHandledItem) DateTimeField(aero.minova.rcp.rcp.fields.DateTimeField) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) ExecutionException(java.util.concurrent.ExecutionException) Preference(org.eclipse.e4.core.di.extensions.Preference) EModelService(org.eclipse.e4.ui.workbench.modeling.EModelService) ControlAdapter(org.eclipse.swt.events.ControlAdapter) Form(aero.minova.rcp.form.model.xsd.Form) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ContextInjectionFactory(org.eclipse.e4.core.contexts.ContextInjectionFactory) Head(aero.minova.rcp.form.model.xsd.Head) MDetail(aero.minova.rcp.model.form.MDetail) TabUtil(aero.minova.rcp.rcp.util.TabUtil) ToolBar(org.eclipse.swt.widgets.ToolBar) MBooleanField(aero.minova.rcp.model.form.MBooleanField) MHandledMenuItem(org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem) MNumberField(aero.minova.rcp.model.form.MNumberField) Wizard(aero.minova.rcp.form.model.xsd.Wizard) Preferences(aero.minova.rcp.form.setup.xbs.Preferences) EHandlerService(org.eclipse.e4.core.commands.EHandlerService) GridChangeEvent(aero.minova.rcp.model.event.GridChangeEvent) Locale(java.util.Locale) MField(aero.minova.rcp.model.form.MField) Column(aero.minova.rcp.model.Column) MDateTimeField(aero.minova.rcp.model.form.MDateTimeField) Optional(org.eclipse.e4.core.di.annotations.Optional) Display(org.eclipse.swt.widgets.Display) JAXBException(javax.xml.bind.JAXBException) BundleContext(org.osgi.framework.BundleContext) NumberField(aero.minova.rcp.rcp.fields.NumberField) MShortDateField(aero.minova.rcp.model.form.MShortDateField) List(java.util.List) IWorkbench(org.eclipse.e4.ui.workbench.IWorkbench) GridChangeListener(aero.minova.rcp.model.event.GridChangeListener) Entry(java.util.Map.Entry) PostConstruct(javax.annotation.PostConstruct) MouseAdapter(org.eclipse.swt.events.MouseAdapter) PersistState(org.eclipse.e4.ui.di.PersistState) ShortTimeField(aero.minova.rcp.rcp.fields.ShortTimeField) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) SectionGrid(aero.minova.rcp.rcp.widgets.SectionGrid) TRANSLATE_PROPERTY(aero.minova.rcp.rcp.fields.FieldUtil.TRANSLATE_PROPERTY) Image(org.eclipse.swt.graphics.Image) Rectangle(org.eclipse.swt.graphics.Rectangle) XBSUtil(aero.minova.rcp.form.setup.util.XBSUtil) ImageUtil(aero.minova.rcp.dataservice.ImageUtil) ApplicationPreferences(aero.minova.rcp.preferences.ApplicationPreferences) Inject(javax.inject.Inject) DetailLayout(aero.minova.rcp.css.widgets.DetailLayout) MinovaSectionData(aero.minova.rcp.css.widgets.MinovaSectionData) MPart(org.eclipse.e4.ui.model.application.ui.basic.MPart) MHandledToolItem(org.eclipse.e4.ui.model.application.ui.menu.MHandledToolItem) IEclipseContext(org.eclipse.e4.core.contexts.IEclipseContext) MessageDialogWithToggle(org.eclipse.jface.dialogs.MessageDialogWithToggle) MSection(aero.minova.rcp.model.form.MSection) TextField(aero.minova.rcp.rcp.fields.TextField) Field(aero.minova.rcp.form.model.xsd.Field) TranslateUtil(aero.minova.rcp.rcp.util.TranslateUtil) MParamStringField(aero.minova.rcp.model.form.MParamStringField) FieldUtil(aero.minova.rcp.rcp.fields.FieldUtil) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) MTrimBar(org.eclipse.e4.ui.model.application.ui.basic.MTrimBar) UISynchronize(org.eclipse.e4.ui.di.UISynchronize) GridAccessor(aero.minova.rcp.rcp.accessor.GridAccessor) XmlProcessor(aero.minova.rcp.dataservice.XmlProcessor) MShortTimeField(aero.minova.rcp.model.form.MShortTimeField) LocalResourceManager(org.eclipse.jface.resource.LocalResourceManager) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Menu(org.eclipse.swt.widgets.Menu) Grid(aero.minova.rcp.form.model.xsd.Grid) DetailAccessor(aero.minova.rcp.rcp.accessor.DetailAccessor) BooleanField(aero.minova.rcp.rcp.fields.BooleanField) FrameworkUtil(org.osgi.framework.FrameworkUtil) Control(org.eclipse.swt.widgets.Control) Control(org.eclipse.swt.widgets.Control) ToolBar(org.eclipse.swt.widgets.ToolBar) Image(org.eclipse.swt.graphics.Image) ToolItem(org.eclipse.swt.widgets.ToolItem) MHandledToolItem(org.eclipse.e4.ui.model.application.ui.menu.MHandledToolItem)

Example 2 with MinovaSection

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

the class MinovaSectionPropertyHandler method applyCSSProperty.

@Override
protected void applyCSSProperty(Control control, String property, CSSValue value, String pseudo, CSSEngine engine) throws Exception {
    if (!(control instanceof MinovaSection))
        return;
    if (value.getCssValueType() != CSSValue.CSS_PRIMITIVE_VALUE)
        return;
    MinovaSection minovaSection = (MinovaSection) control;
    String val = value.getCssText();
    // bisher sind alles int-Werte
    int pixel = (int) Float.parseFloat(val.substring(0, val.length() - 2));
    // Skalierung unter Windows beachten -> Felder entsprechend vergrößern
    if ("win32".equals(SWT.getPlatform())) {
        double scaling = Display.getCurrent().getDPI().x / 96.0;
        pixel = (int) (pixel * scaling);
    }
    switch(property) {
        case DATE_WIDTH:
            minovaSection.getCssStyler().setDateWidth(pixel);
            break;
        case DATE_TIME_WIDTH:
            minovaSection.getCssStyler().setDateTimeWidth(pixel);
            break;
        case NUMBER_WIDTH:
            minovaSection.getCssStyler().setNumberWidth(pixel);
            break;
        case ROW_HEIGHT:
            minovaSection.getCssStyler().setRowHeight(pixel);
            break;
        case SECTION_SPACING:
            minovaSection.getCssStyler().setSectionSpacing(pixel);
            break;
        case TEXT_WIDTH:
            minovaSection.getCssStyler().setTextWidth(pixel);
            break;
        case TIME_WIDTH:
            minovaSection.getCssStyler().setTimeWidth(pixel);
            break;
        default:
    }
}
Also used : MinovaSection(aero.minova.rcp.css.widgets.MinovaSection)

Example 3 with MinovaSection

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

the class WFCDetailPart method persistState.

@PersistState
public void persistState() {
    // Grids
    for (SectionGrid sg : sectionGrids) {
        sg.saveState();
    }
    // Sections, ein-/ausgeklappt
    for (MSection s : mDetail.getMSectionList()) {
        MinovaSection section = ((SectionAccessor) s.getSectionAccessor()).getSection();
        String prefsExpandedString = form.getTitle() + "." + section.getData(TRANSLATE_PROPERTY) + ".expanded";
        prefsDetailSections.put(prefsExpandedString, section.isExpanded() + "");
        String prefsMinimizedString = form.getTitle() + "." + section.getData(TRANSLATE_PROPERTY) + ".minimized";
        prefsDetailSections.put(prefsMinimizedString, section.isMinimized() + "");
    }
    try {
        prefsDetailSections.flush();
    } catch (BackingStoreException e1) {
        e1.printStackTrace();
    }
}
Also used : BackingStoreException(org.osgi.service.prefs.BackingStoreException) SectionAccessor(aero.minova.rcp.rcp.accessor.SectionAccessor) MSection(aero.minova.rcp.model.form.MSection) MinovaSection(aero.minova.rcp.css.widgets.MinovaSection) SectionGrid(aero.minova.rcp.rcp.widgets.SectionGrid) PersistState(org.eclipse.e4.ui.di.PersistState)

Example 4 with MinovaSection

use of aero.minova.rcp.css.widgets.MinovaSection 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 5 with MinovaSection

use of aero.minova.rcp.css.widgets.MinovaSection 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

MinovaSection (aero.minova.rcp.css.widgets.MinovaSection)5 MSection (aero.minova.rcp.model.form.MSection)4 MinovaSectionData (aero.minova.rcp.css.widgets.MinovaSectionData)3 SectionAccessor (aero.minova.rcp.rcp.accessor.SectionAccessor)3 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)2 Constants (aero.minova.rcp.constants.Constants)1 DetailLayout (aero.minova.rcp.css.widgets.DetailLayout)1 ImageUtil (aero.minova.rcp.dataservice.ImageUtil)1 XmlProcessor (aero.minova.rcp.dataservice.XmlProcessor)1 Field (aero.minova.rcp.form.model.xsd.Field)1 Form (aero.minova.rcp.form.model.xsd.Form)1 Grid (aero.minova.rcp.form.model.xsd.Grid)1 Head (aero.minova.rcp.form.model.xsd.Head)1 Onclick (aero.minova.rcp.form.model.xsd.Onclick)1 Page (aero.minova.rcp.form.model.xsd.Page)1 Procedure (aero.minova.rcp.form.model.xsd.Procedure)1 Wizard (aero.minova.rcp.form.model.xsd.Wizard)1 XBSUtil (aero.minova.rcp.form.setup.util.XBSUtil)1 Node (aero.minova.rcp.form.setup.xbs.Node)1 Preferences (aero.minova.rcp.form.setup.xbs.Preferences)1