Search in sources :

Example 1 with ITextLabelBluePrint

use of org.jowidgets.api.widgets.blueprint.ITextLabelBluePrint in project jo-client-platform by jo-source.

the class CsvExportParameterContentProvider method createContent.

@Override
public void createContent(final IInputContentContainer container) {
    final ITextLabelBluePrint textLabelBp = BPF.textLabel().alignRight();
    container.setLayout(new MigLayoutDescriptor("[][grow, 250::]", "[][]"));
    container.add(textLabelBp.setText(Messages.getString("CsvExportParameterContentProvider.header")), "alignx r");
    final IComboBoxSelectionBluePrint<Boolean> headerCmbBp = BPF.comboBoxSelectionBoolean().setAutoCompletion(false);
    headerCmb = container.add(headerCmbBp, "growx ,w  0:: , wrap");
    container.add(textLabelBp.setText(Messages.getString("CsvExportParameterContentProvider.properties")), "alignx r, growx");
    final IComboBoxSelectionBluePrint<Boolean> propertiesCmbBp = BPF.comboBoxSelection(createExportAttributesConverter());
    propertiesCmbBp.setElements(Boolean.TRUE, Boolean.FALSE).setValue(Boolean.FALSE).setAutoCompletion(false);
    propertiesCmb = container.add(propertiesCmbBp, "growx, w 0::, wrap");
    container.add(textLabelBp.setText(Messages.getString("CsvExportParameterContentProvider.Export")), "alignx r");
    final IComboBoxSelectionBluePrint<ICsvExportParameter.ExportType> exportTypeCmbBp = BPF.comboBoxSelection(createExportTypesConverter());
    exportTypeCmbBp.setAutoCompletion(false).setElements(ICsvExportParameter.ExportType.values());
    exportTypeCmb = container.add(exportTypeCmbBp, "growx, w 0::, wrap");
    container.add(textLabelBp.setText(Messages.getString("CsvExportParameterContentProvider.separator")), "alignx r");
    final IComboBoxSelectionBluePrint<String> separatorCmbBp = BPF.comboBoxSelection(";", ",", "|");
    separatorCmbBp.setAutoCompletion(false);
    separatorCmb = container.add(separatorCmbBp, "growx, w 0::, wrap");
    container.add(textLabelBp.setText(Messages.getString("CsvExportParameterContentProvider.mask")), "align r");
    final IComboBoxSelectionBluePrint<String> maskCmbBp = BPF.comboBoxSelection("*", String.valueOf('"'));
    maskCmbBp.setAutoCompletion(false);
    maskCmb = container.add(maskCmbBp, "growx, w 0::, wrap");
    container.add(textLabelBp.setText(Messages.getString("CsvExportParameterContentProvider.encoding")), "alignx r");
    final IComboBoxSelectionBluePrint<String> encodingCmbBp = BPF.comboBoxSelection("UTF-8", "Cp1250", "ISO8859_1");
    encodingCmbBp.setAutoCompletion(false);
    encodingCmb = container.add(encodingCmbBp, "growx, w 0::");
}
Also used : ITextLabelBluePrint(org.jowidgets.api.widgets.blueprint.ITextLabelBluePrint) MigLayoutDescriptor(org.jowidgets.common.widgets.layout.MigLayoutDescriptor)

Example 2 with ITextLabelBluePrint

use of org.jowidgets.api.widgets.blueprint.ITextLabelBluePrint in project jo-client-platform by jo-source.

the class GraphSettingsDialog method createSliderComponent.

private void createSliderComponent(final IScrollComposite content, final double defaultValue, final int forceNumber, final GraphLayout layout) {
    int max = 0;
    int min = 0;
    String description = null;
    switch(layout) {
        case RADIAL_TREE_LAYOUT:
            max = RADIAL_RADIUS_MAX;
            min = RADIAL_RADIUS_MIN;
            description = RADIAL_RADIUS_DISTANCES[forceNumber];
            break;
        case NODE_TREE_LINK_LAYOUT:
            max = NODE_LINK_DISTANCE_MAX;
            min = NODE_LINK_DISTANCE_MIN;
            description = NODE_LINK_DISTANCES[forceNumber];
            break;
        default:
            break;
    }
    final ITextLabelBluePrint labelBp = BPF.textLabel().alignRight();
    content.add(labelBp.setText(description), "sg lg");
    final ISliderBluePrint sliderBp = BPF.slider();
    final ISlider slider;
    final int defaultVal = (int) defaultValue;
    final int step = (max - min) / 100;
    sliderBp.setMaximum(max).setMinimum(min).setTickSpacing((max - min) / 20);
    slider = content.add(sliderBp, "growx, w 0::");
    slider.setValue(defaultVal);
    final IInputField<Integer> inputField;
    inputField = content.add(BPF.inputFieldIntegerNumber(), "growx, w 0::, wrap");
    inputField.setValue((int) (slider.getValue()));
    DEFAULT_SLIDER_SETTINGS.put(slider, defaultVal);
    inputField.addInputListener(new ParameterListener(slider, inputField, null, forceNumber, step, min, false, Listener.INPUTFIELD, layout));
    slider.addInputListener(new ParameterListener(slider, inputField, null, forceNumber, step, min, false, Listener.SLIDER, layout));
}
Also used : ISlider(org.jowidgets.api.widgets.ISlider) ITextLabelBluePrint(org.jowidgets.api.widgets.blueprint.ITextLabelBluePrint) ISliderBluePrint(org.jowidgets.api.widgets.blueprint.ISliderBluePrint) ISliderBluePrint(org.jowidgets.api.widgets.blueprint.ISliderBluePrint) ITextLabelBluePrint(org.jowidgets.api.widgets.blueprint.ITextLabelBluePrint)

Example 3 with ITextLabelBluePrint

use of org.jowidgets.api.widgets.blueprint.ITextLabelBluePrint in project jo-client-platform by jo-source.

the class GraphSettingsDialog method createSliderComponent.

private void createSliderComponent(final IScrollComposite content, final Force force, final int param, final String description) {
    final String forceParameter = force.getParameterName(param);
    final double value = MODIFIED_VALUES.containsKey(forceParameter + "_DEFAULT") ? MODIFIED_VALUES.get(forceParameter + "_DEFAULT") : force.getParameter(param);
    final double min = MODIFIED_VALUES.containsKey(forceParameter + "_MIN") ? MODIFIED_VALUES.get(forceParameter + "_MIN") : force.getMinValue(param);
    final double max = MODIFIED_VALUES.containsKey(forceParameter + "_MAX") ? MODIFIED_VALUES.get(forceParameter + "_MAX") : force.getMaxValue(param);
    final boolean displayPercent;
    final double step = (max - min) / 100;
    final ITextLabelBluePrint labelBp = BPF.textLabel().alignRight();
    content.add(labelBp.setText(description), "sg lg");
    final ISliderBluePrint sliderBp = BPF.slider();
    final ISlider slider;
    final int defaultValue;
    final IInputField<Integer> inputField;
    if (Arrays.asList(DISPLAY_PERCENT_PARAMETER).contains(forceParameter)) {
        sliderBp.setMaximum(100).setMinimum(0).setTickSpacing(5);
        slider = content.add(sliderBp, "growx, w 0::");
        defaultValue = (int) (100 / max * value);
        slider.setValue(defaultValue);
        inputField = content.add(BPF.inputFieldIntegerNumber(), "growx, w 0::, split2");
        content.add(BPF.label().setText("%"), "wrap");
        inputField.setValue((int) (slider.getValue()));
        displayPercent = true;
        useForce(displayPercent, param, force, min, slider, step);
    } else {
        sliderBp.setMaximum((int) max).setMinimum((int) min).setTickSpacing((int) (max - min) / 20);
        slider = content.add(sliderBp, "growx, w 0::");
        defaultValue = (int) value;
        slider.setValue(defaultValue);
        inputField = content.add(BPF.inputFieldIntegerNumber(), "growx, w 0::, wrap");
        inputField.setValue((int) value);
        displayPercent = false;
        useForce(displayPercent, param, force, min, slider, step);
    }
    DEFAULT_SLIDER_SETTINGS.put(slider, defaultValue);
    inputField.addInputListener(new ParameterListener(slider, inputField, force, param, step, min, displayPercent, Listener.INPUTFIELD, GraphLayout.FORCE_DIRECTED_LAYOUT));
    slider.addInputListener(new ParameterListener(slider, inputField, force, param, step, min, displayPercent, Listener.SLIDER, GraphLayout.FORCE_DIRECTED_LAYOUT));
}
Also used : ISlider(org.jowidgets.api.widgets.ISlider) ITextLabelBluePrint(org.jowidgets.api.widgets.blueprint.ITextLabelBluePrint) ISliderBluePrint(org.jowidgets.api.widgets.blueprint.ISliderBluePrint) ISliderBluePrint(org.jowidgets.api.widgets.blueprint.ISliderBluePrint) ITextLabelBluePrint(org.jowidgets.api.widgets.blueprint.ITextLabelBluePrint)

Example 4 with ITextLabelBluePrint

use of org.jowidgets.api.widgets.blueprint.ITextLabelBluePrint in project jo-client-platform by jo-source.

the class BeanFormLayouterImpl method layout.

@Override
public void layout(final IContainer parent, final IBeanFormControlFactory controlFactory) {
    final IBeanFormInfo beanFormInfo = controlFactory.getBeanFormInfo();
    final IContainer container;
    if (controlFactory.getScrollbarsAllowed() && beanFormInfo != null) {
        parent.setLayout(MigLayoutFactory.growingInnerCellLayout());
        container = parent.add(BPF.scrollComposite(), MigLayoutFactory.GROWING_CELL_CONSTRAINTS);
    } else {
        container = parent;
    }
    final String colConstraints = insets.getLeft() + "[grow, 0::]" + insets.getRight();
    final String rowConstraints;
    if (beanFormInfo != null) {
        rowConstraints = insets.getTop() + "[][grow, 0::]" + insets.getBottom();
    } else {
        rowConstraints = insets.getTop() + "[grow, 0::]" + insets.getBottom();
    }
    container.setLayout(new MigLayoutDescriptor(colConstraints, rowConstraints));
    if (beanFormInfo != null) {
        final IExpandCompositeBluePrint expandCompositeBp = expandCompositeBp();
        expandCompositeBp.setExpanded(beanFormInfo.isExpanded());
        expandCompositeBp.setText(beanFormInfo.getHeader().get());
        expandCompositeBp.setIcon(beanFormInfo.getHeaderIcon());
        final IExpandComposite expandComposite = container.add(expandCompositeBp, "growx, w 0::, wrap");
        final String cc = contentInsets.getLeft() + "[grow, 0::]" + contentInsets.getRight();
        final String rc = contentInsets.getTop() + "[]" + contentInsets.getBottom();
        expandComposite.setLayout(new MigLayoutDescriptor(cc, rc));
        final ITextLabelBluePrint labelBp = BPF.textLabel(beanFormInfo.getText().get());
        labelBp.setForegroundColor(contentTextColor).setMarkup(contentTextMarkup);
        expandComposite.add(labelBp, "growx, w 0::");
        expandComposite.addExpandListener(new IExpandListener() {

            @Override
            public void expandedChanged(final boolean expanded) {
                getRootContainer(parent).layout();
            }
        });
    }
    final boolean contentScrollbar = beanFormInfo == null && controlFactory.getScrollbarsAllowed();
    final IContainer contentContainer = createAndAddContentContainer(container, controlFactory, contentScrollbar);
    contentLayouter.layout(contentContainer, controlFactory);
}
Also used : IExpandListener(org.jowidgets.api.controller.IExpandListener) IExpandComposite(org.jowidgets.api.widgets.IExpandComposite) ITextLabelBluePrint(org.jowidgets.api.widgets.blueprint.ITextLabelBluePrint) IBeanFormInfo(org.jowidgets.cap.ui.api.form.IBeanFormInfo) IContainer(org.jowidgets.api.widgets.IContainer) MigLayoutDescriptor(org.jowidgets.common.widgets.layout.MigLayoutDescriptor) IExpandCompositeBluePrint(org.jowidgets.api.widgets.blueprint.IExpandCompositeBluePrint)

Aggregations

ITextLabelBluePrint (org.jowidgets.api.widgets.blueprint.ITextLabelBluePrint)4 ISlider (org.jowidgets.api.widgets.ISlider)2 ISliderBluePrint (org.jowidgets.api.widgets.blueprint.ISliderBluePrint)2 MigLayoutDescriptor (org.jowidgets.common.widgets.layout.MigLayoutDescriptor)2 IExpandListener (org.jowidgets.api.controller.IExpandListener)1 IContainer (org.jowidgets.api.widgets.IContainer)1 IExpandComposite (org.jowidgets.api.widgets.IExpandComposite)1 IExpandCompositeBluePrint (org.jowidgets.api.widgets.blueprint.IExpandCompositeBluePrint)1 IBeanFormInfo (org.jowidgets.cap.ui.api.form.IBeanFormInfo)1