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();
}
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:
}
}
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();
}
}
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();
}
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());
}
Aggregations