Search in sources :

Example 11 with Panel

use of org.gwtbootstrap3.client.ui.Panel in project drools-wb by kiegroup.

the class GuidedRuleTemplateDataViewImpl method setContent.

@Override
public void setContent(final TemplateModel model, final AsyncPackageDataModelOracle oracle, final EventBus eventBus, final boolean isReadOnly) {
    widgetContainer.clear();
    // Initialise table to edit data. The widget needs to be added after the containing panel has
    // been added to the DOM and rendered by the browser as the Merged Grid widget needs the
    // parent panel sizes.
    Scheduler.get().scheduleDeferred(new Command() {

        @Override
        public void execute() {
            final TemplateDataTableWidget dataTable = new TemplateDataTableWidget(model, oracle, isReadOnly, eventBus);
            final Button btnAddRow = new Button(GuidedRuleEditorResources.CONSTANTS.AddRow(), new ClickHandler() {

                public void onClick(ClickEvent event) {
                    dataTable.appendRow();
                }
            });
            widgetContainer.add(btnAddRow);
            widgetContainer.add(dataTable);
        }
    });
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Command(com.google.gwt.user.client.Command) Button(org.gwtbootstrap3.client.ui.Button) ClickEvent(com.google.gwt.event.dom.client.ClickEvent)

Example 12 with Panel

use of org.gwtbootstrap3.client.ui.Panel 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 13 with Panel

use of org.gwtbootstrap3.client.ui.Panel in project ovirt-engine by oVirt.

the class DialogTabPanel method addTab.

@UiChild(tagname = "tab")
public void addTab(final DialogTab tab) {
    navTabs.add(tab.getTabListItem());
    tab.getTabListItem().addStyleName(Styles.LIST_GROUP_ITEM);
    // $NON-NLS-1$
    String tabId = "tab" + navTabs.getWidgetCount();
    tab.getTabListItem().setDataTarget(tabId);
    tab.getTabListItem().addShownHandler(event -> switchTab(event.getTab()));
    TabPane pane = new TabPane();
    FlowPanel panel = new FlowPanel();
    panel.add(tab.getContent());
    pane.add(panel);
    pane.setId(tabId);
    tabContent.add(pane);
    // Switch to first tab automatically
    if (tabContent.getWidgetCount() == 1) {
        switchTab(tab);
    }
}
Also used : TabPane(org.gwtbootstrap3.client.ui.TabPane) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) UiChild(com.google.gwt.uibinder.client.UiChild)

Example 14 with Panel

use of org.gwtbootstrap3.client.ui.Panel in project ovirt-engine by oVirt.

the class AbstractFormPanel method addFormDetailView.

/**
 * Adds new detail view (column) to the form panel.
 */
public void addFormDetailView(int numOfRows, int numOfColumns) {
    container.clear();
    for (int i = 0; i < numOfRows; i++) {
        Row row = createRow(numOfColumns);
        container.add(row);
    }
}
Also used : Row(org.gwtbootstrap3.client.ui.Row)

Aggregations

ClickEvent (com.google.gwt.event.dom.client.ClickEvent)5 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)5 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)3 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)3 Command (com.google.gwt.user.client.Command)3 FlexTable (com.google.gwt.user.client.ui.FlexTable)3 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)3 HTML (com.google.gwt.user.client.ui.HTML)3 Label (com.google.gwt.user.client.ui.Label)3 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)3 Map (java.util.Map)3 Label (org.gwtbootstrap3.client.ui.Label)3 Widget (com.google.gwt.user.client.ui.Widget)2 Collection (java.util.Collection)2 Button (org.gwtbootstrap3.client.ui.Button)2 Panel (org.gwtbootstrap3.client.ui.Panel)2 PanelBody (org.gwtbootstrap3.client.ui.PanelBody)2 TabPane (org.gwtbootstrap3.client.ui.TabPane)2 TextBox (org.gwtbootstrap3.client.ui.TextBox)2 FolderItem (org.kie.workbench.common.screens.explorer.model.FolderItem)2