Search in sources :

Example 61 with VerticalPanel

use of com.google.gwt.user.client.ui.VerticalPanel in project drools-wb by kiegroup.

the class ColumnsPagePresenter method refreshActionsWidget.

void refreshActionsWidget(final List<ActionCol52> actionColumns) {
    final VerticalPanel actionsWidget = getActionsWidget();
    actionsWidget.clear();
    if (actionColumns.isEmpty()) {
        getAccordion().getItem(ACTION).setOpen(false);
        actionsWidget.add(blankSlate());
        return;
    }
    actionsWidget.add(getActionsPanel());
    final Map<String, List<BaseColumn>> columnGroups = groupByTitle(actionColumns);
    getActionsPanel().renderColumns(columnGroups);
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) List(java.util.List)

Example 62 with VerticalPanel

use of com.google.gwt.user.client.ui.VerticalPanel in project drools-wb by kiegroup.

the class GuidedScoreCardEditor method addCharacteristic.

private FlexTable addCharacteristic(final Characteristic characteristic) {
    final FlexTable cGrid = new FlexTable();
    cGrid.setBorderWidth(0);
    cGrid.setCellPadding(1);
    cGrid.setCellSpacing(1);
    cGrid.setStyleName("rule-ListHeader");
    Button btnAddAttribute = new Button(GuidedScoreCardConstants.INSTANCE.addAttribute(), new ClickHandler() {

        public void onClick(final ClickEvent event) {
            addAttribute(cGrid, null);
        }
    });
    Button btnRemoveCharacteristic = new Button(GuidedScoreCardConstants.INSTANCE.removeCharacteristic(), new ClickHandler() {

        public void onClick(ClickEvent event) {
            removeCharacteristic(cGrid);
        }
    });
    String selectedFact = "";
    if (characteristic != null) {
        selectedFact = characteristic.getFact();
        if (selectedFact.lastIndexOf(".") > -1) {
            selectedFact = selectedFact.substring(selectedFact.lastIndexOf(".") + 1);
        }
    }
    // Fields List Box
    final ListBox dropDownFields = new ListBox();
    // Facts List Box
    final ListBox dropDownFacts = new ListBox();
    final String[] eligibleFacts = oracle.getFactTypes();
    for (final String factType : eligibleFacts) {
        dropDownFacts.addItem(factType);
    }
    dropDownFacts.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(final ChangeEvent event) {
            characteristicFactChanged(characteristic, dropDownFacts, dropDownFields);
        }
    });
    final int selectedFactIndex = Arrays.asList(eligibleFacts).indexOf(selectedFact);
    dropDownFacts.setSelectedIndex(selectedFactIndex >= 0 ? selectedFactIndex : 0);
    characteristicFactChanged(characteristic, dropDownFacts, dropDownFields);
    cGrid.setWidget(0, 0, new Label(GuidedScoreCardConstants.INSTANCE.name()));
    final TextBox tbName = TextBoxFactory.getTextBox(DataType.TYPE_STRING);
    cGrid.setWidget(0, 1, tbName);
    cGrid.setWidget(0, 2, btnRemoveCharacteristic);
    cGrid.setWidget(0, 3, btnAddAttribute);
    cGrid.setWidget(1, 0, new Label(GuidedScoreCardConstants.INSTANCE.fact()));
    cGrid.setWidget(1, 1, new Label(GuidedScoreCardConstants.INSTANCE.characteristic()));
    cGrid.setWidget(1, 2, new Label(GuidedScoreCardConstants.INSTANCE.baselineScore()));
    cGrid.setWidget(1, 3, new Label(GuidedScoreCardConstants.INSTANCE.reasonCode()));
    cGrid.setWidget(2, 0, dropDownFacts);
    cGrid.setWidget(2, 1, dropDownFields);
    final TextBox tbBaseline = TextBoxFactory.getTextBox(DataType.TYPE_NUMERIC_DOUBLE);
    final boolean useReasonCodesValue = "true".equalsIgnoreCase(ddUseReasonCode.getValue(ddUseReasonCode.getSelectedIndex()));
    tbBaseline.setEnabled(useReasonCodesValue);
    cGrid.setWidget(2, 2, tbBaseline);
    final TextBox tbReasonCode = TextBoxFactory.getTextBox(DataType.TYPE_STRING);
    tbReasonCode.setEnabled(useReasonCodesValue);
    cGrid.setWidget(2, 3, tbReasonCode);
    final SimplePanel gapPanel = new SimplePanel();
    gapPanel.add(new HTML("<br/>"));
    final VerticalPanel panel = new VerticalPanel();
    panel.add(cGrid);
    characteristicsAttrPanelMap.put(cGrid, panel);
    // panel.add( addAttributeCellTable( cGrid, characteristic ) );
    panel.setWidth("100%");
    DecoratorPanel decoratorPanel = new DecoratorPanel();
    decoratorPanel.add(panel);
    characteristicsPanel.add(decoratorPanel);
    characteristicsPanel.add(gapPanel);
    characteristicsTables.add(cGrid);
    cGrid.getColumnFormatter().setWidth(0, "150px");
    cGrid.getColumnFormatter().setWidth(1, "250px");
    cGrid.getColumnFormatter().setWidth(2, "150px");
    cGrid.getColumnFormatter().setWidth(3, "150px");
    if (characteristic != null) {
        tbReasonCode.setValue(characteristic.getReasonCode());
        tbBaseline.setValue("" + characteristic.getBaselineScore());
        tbName.setValue(characteristic.getName());
    }
    return cGrid;
}
Also used : ClickEvent(com.google.gwt.event.dom.client.ClickEvent) FlexTable(com.google.gwt.user.client.ui.FlexTable) Label(com.google.gwt.user.client.ui.Label) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) HTML(com.google.gwt.user.client.ui.HTML) TextBox(org.gwtbootstrap3.client.ui.TextBox) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) Button(org.gwtbootstrap3.client.ui.Button) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) DecoratorPanel(com.google.gwt.user.client.ui.DecoratorPanel) ListBox(org.gwtbootstrap3.client.ui.ListBox)

Example 63 with VerticalPanel

use of com.google.gwt.user.client.ui.VerticalPanel in project drools-wb by kiegroup.

the class GuidedScoreCardEditor method setContent.

public void setContent(final ScoreCardModel model, final AsyncPackageDataModelOracle oracle) {
    this.model = model;
    this.oracle = oracle;
    final DecoratedDisclosurePanel disclosurePanel = new DecoratedDisclosurePanel(GuidedScoreCardConstants.INSTANCE.scoreCardTitle0(model.getName()));
    disclosurePanel.setWidth("100%");
    disclosurePanel.setTitle(GuidedScoreCardConstants.INSTANCE.scorecard());
    disclosurePanel.setOpen(true);
    final DecoratedDisclosurePanel configPanel = new DecoratedDisclosurePanel(GuidedScoreCardConstants.INSTANCE.setupParameters());
    configPanel.setWidth("95%");
    configPanel.setOpen(true);
    configPanel.add(getScorecardProperties());
    final DecoratedDisclosurePanel ruleAttributesPanel = new DecoratedDisclosurePanel(GuidedScoreCardConstants.INSTANCE.ruleAttributes());
    ruleAttributesPanel.setWidth("95%");
    ruleAttributesPanel.setOpen(false);
    ruleAttributesPanel.add(getRuleAttributesPanel());
    final DecoratedDisclosurePanel characteristicsPanel = new DecoratedDisclosurePanel(GuidedScoreCardConstants.INSTANCE.characteristics());
    characteristicsPanel.setOpen(model.getCharacteristics().size() > 0);
    characteristicsPanel.setWidth("95%");
    characteristicsPanel.add(getCharacteristics());
    final VerticalPanel config = new VerticalPanel();
    config.setWidth("100%");
    config.add(ruleAttributesPanel);
    config.add(configPanel);
    config.add(characteristicsPanel);
    disclosurePanel.add(config);
    container.setWidget(disclosurePanel);
    characteristicsAttrMap.clear();
    characteristicsAttrPanelMap.clear();
    for (final Characteristic characteristic : model.getCharacteristics()) {
        final FlexTable flexTable = addCharacteristic(characteristic);
        for (Attribute attribute : characteristic.getAttributes()) {
            addAttribute(flexTable, attribute);
        }
    }
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) Attribute(org.drools.workbench.models.guided.scorecard.shared.Attribute) Characteristic(org.drools.workbench.models.guided.scorecard.shared.Characteristic) FlexTable(com.google.gwt.user.client.ui.FlexTable) DecoratedDisclosurePanel(org.uberfire.ext.widgets.common.client.common.DecoratedDisclosurePanel)

Aggregations

VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)63 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)19 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)19 Label (com.google.gwt.user.client.ui.Label)18 HTML (com.google.gwt.user.client.ui.HTML)14 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)12 CheckBox (com.google.gwt.user.client.ui.CheckBox)9 SmallHeading (com.google.gerrit.client.ui.SmallHeading)7 Button (com.google.gwt.user.client.ui.Button)7 ScrollPanel (com.google.gwt.user.client.ui.ScrollPanel)7 TextBox (com.google.gwt.user.client.ui.TextBox)7 FlexTable (com.google.gwt.user.client.ui.FlexTable)6 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)6 SimplePanel (com.google.gwt.user.client.ui.SimplePanel)6 GerritCallback (com.google.gerrit.client.rpc.GerritCallback)5 OnEditEnabler (com.google.gerrit.client.ui.OnEditEnabler)4 Grid (com.google.gwt.user.client.ui.Grid)4 Image (com.google.gwt.user.client.ui.Image)4 InlineLabel (com.google.gwt.user.client.ui.InlineLabel)4 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)4