Search in sources :

Example 21 with Grid

use of com.google.gwt.user.client.ui.Grid in project ovirt-engine by oVirt.

the class NicPanel method getContents.

@Override
protected Widget getContents() {
    Grid rowPanel = new Grid(1, 5);
    // $NON-NLS-1$
    rowPanel.addStyleName("ts3");
    // $NON-NLS-1$
    rowPanel.setWidth("100%");
    // $NON-NLS-1$
    rowPanel.setHeight("100%");
    ColumnFormatter columnFormatter = rowPanel.getColumnFormatter();
    // $NON-NLS-1$
    columnFormatter.setWidth(0, "5px");
    // $NON-NLS-1$
    columnFormatter.setWidth(1, "10px");
    // $NON-NLS-1$
    columnFormatter.setWidth(2, "30px");
    // $NON-NLS-1$
    columnFormatter.setWidth(3, "100%");
    // $NON-NLS-1$
    columnFormatter.setWidth(4, "30px");
    Label titleLabel = new Label(item.getName());
    // $NON-NLS-1$
    titleLabel.setHeight("100%");
    Image nicImage = new Image(getNicIcon());
    rowPanel.setWidget(0, 0, dragImage);
    ImageResource statusImage = getStatusImage();
    if (statusImage != null) {
        rowPanel.setWidget(0, 1, new Image(statusImage));
    }
    rowPanel.setWidget(0, 2, nicImage);
    rowPanel.setWidget(0, 3, titleLabel);
    rowPanel.setWidget(0, 4, actionButton);
    actionButton.setVisible(item.isSriovEnabled());
    return rowPanel;
}
Also used : ImageResource(com.google.gwt.resources.client.ImageResource) Grid(com.google.gwt.user.client.ui.Grid) Label(com.google.gwt.user.client.ui.Label) Image(com.google.gwt.user.client.ui.Image) ColumnFormatter(com.google.gwt.user.client.ui.HTMLTable.ColumnFormatter)

Example 22 with Grid

use of com.google.gwt.user.client.ui.Grid in project opentsdb by OpenTSDB.

the class QueryUi method makeKeyPanel.

/**
 * Builds the panel containing the customizations for the key of the graph.
 */
private Widget makeKeyPanel() {
    final Grid grid = new Grid(5, 5);
    addKeyRadioButton(grid, 0, 0, "out left top");
    addKeyRadioButton(grid, 0, 2, "out center top");
    addKeyRadioButton(grid, 0, 4, "out right top");
    addKeyRadioButton(grid, 1, 1, "top left");
    addKeyRadioButton(grid, 1, 2, "top center");
    addKeyRadioButton(grid, 1, 3, "top right").setValue(true);
    addKeyRadioButton(grid, 2, 0, "out center left");
    addKeyRadioButton(grid, 2, 1, "center left");
    addKeyRadioButton(grid, 2, 2, "center");
    addKeyRadioButton(grid, 2, 3, "center right");
    addKeyRadioButton(grid, 2, 4, "out center right");
    addKeyRadioButton(grid, 3, 1, "bottom left");
    addKeyRadioButton(grid, 3, 2, "bottom center");
    addKeyRadioButton(grid, 3, 3, "bottom right");
    addKeyRadioButton(grid, 4, 0, "out bottom left");
    addKeyRadioButton(grid, 4, 2, "out bottom center");
    addKeyRadioButton(grid, 4, 4, "out bottom right");
    final Grid.CellFormatter cf = grid.getCellFormatter();
    cf.getElement(1, 1).getStyle().setProperty("borderLeft", "1px solid #000");
    cf.getElement(1, 1).getStyle().setProperty("borderTop", "1px solid #000");
    cf.getElement(1, 2).getStyle().setProperty("borderTop", "1px solid #000");
    cf.getElement(1, 3).getStyle().setProperty("borderTop", "1px solid #000");
    cf.getElement(1, 3).getStyle().setProperty("borderRight", "1px solid #000");
    cf.getElement(2, 1).getStyle().setProperty("borderLeft", "1px solid #000");
    cf.getElement(2, 3).getStyle().setProperty("borderRight", "1px solid #000");
    cf.getElement(3, 1).getStyle().setProperty("borderLeft", "1px solid #000");
    cf.getElement(3, 1).getStyle().setProperty("borderBottom", "1px solid #000");
    cf.getElement(3, 2).getStyle().setProperty("borderBottom", "1px solid #000");
    cf.getElement(3, 3).getStyle().setProperty("borderBottom", "1px solid #000");
    cf.getElement(3, 3).getStyle().setProperty("borderRight", "1px solid #000");
    final VerticalPanel vbox = new VerticalPanel();
    vbox.add(new InlineLabel("Key location:"));
    vbox.add(grid);
    vbox.add(horizontalkey);
    keybox.setValue(true);
    vbox.add(keybox);
    vbox.add(nokey);
    return vbox;
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) Grid(com.google.gwt.user.client.ui.Grid) InlineLabel(com.google.gwt.user.client.ui.InlineLabel)

Example 23 with Grid

use of com.google.gwt.user.client.ui.Grid in project opentsdb by OpenTSDB.

the class QueryUi method makeStylePanel.

/**
 * Additional styling options.
 */
private Grid makeStylePanel() {
    for (Entry<String, Integer> item : stylesMap.entrySet()) {
        styles.insertItem(item.getKey(), item.getValue());
    }
    final Grid grid = new Grid(5, 3);
    grid.setText(0, 1, "Smooth");
    grid.setWidget(0, 2, smooth);
    grid.setText(1, 1, "Style");
    grid.setWidget(1, 2, styles);
    return grid;
}
Also used : Grid(com.google.gwt.user.client.ui.Grid) JSONString(com.google.gwt.json.client.JSONString)

Example 24 with Grid

use of com.google.gwt.user.client.ui.Grid in project gwt-test-utils by gwt-test-utils.

the class UiBinderWithGridTest method instanciation.

@Test
public void instanciation() {
    // When
    UiBinderWithGrid uiBinderGrid = new UiBinderWithGrid();
    Grid grid = uiBinderGrid.getGrid();
    // Then
    assertThat(grid.getRowCount()).isEqualTo(2);
    assertThat(grid.getWidget(0, 0)).isSameAs(uiBinderGrid.myLabel);
    assertThat(grid.getWidget(0, 1)).isSameAs(uiBinderGrid.myHTML);
    assertThat(grid.getCellFormatter().getElement(1, 0).getInnerHTML()).isEqualTo(uiBinderGrid.myDiv.toString());
    assertThat(grid.getCellFormatter().getElement(1, 1).getInnerHTML()).isEqualTo(uiBinderGrid.mySpan.toString());
    // styles
    assertThat(grid.getRowFormatter().getStyleName(0)).isEqualTo("optionalHeaderStyle");
    assertThat(grid.getCellFormatter().getStyleName(0, 0)).isEqualTo("optionalFooCellStyle");
    assertThat(grid.getCellFormatter().getStyleName(1, 1)).isEqualTo("optionalSpanCellStyle");
}
Also used : Grid(com.google.gwt.user.client.ui.Grid) GwtTestTest(com.googlecode.gwt.test.GwtTestTest) Test(org.junit.Test)

Example 25 with Grid

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

the class GuidedScoreCardEditor method getScorecardProperties.

private Widget getScorecardProperties() {
    scorecardPropertiesGrid = new Grid(4, 4);
    scorecardPropertiesGrid.setCellSpacing(5);
    scorecardPropertiesGrid.setCellPadding(5);
    tbInitialScore = TextBoxFactory.getTextBox(DataType.TYPE_NUMERIC_DOUBLE);
    tbInitialScore.setText(Double.toString(model.getInitialScore()));
    String factName = model.getFactName();
    // if fact is a fully qualified className, strip off the packageName
    if (factName.lastIndexOf(".") > -1) {
        factName = factName.substring(factName.lastIndexOf(".") + 1);
    }
    dropDownFacts.clear();
    dropDownFacts.addItem(GuidedScoreCardConstants.INSTANCE.pleaseChoose());
    final String[] eligibleFacts = oracle.getFactTypes();
    for (final String factType : eligibleFacts) {
        dropDownFacts.addItem(factType);
    }
    dropDownFacts.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(final ChangeEvent event) {
            scoreCardPropertyFactChanged(dropDownFacts, dropDownFields);
        }
    });
    final int selectedFactIndex = Arrays.asList(eligibleFacts).indexOf(factName);
    dropDownFacts.setSelectedIndex(selectedFactIndex >= 0 ? selectedFactIndex + 1 : 0);
    scoreCardPropertyFactChanged(dropDownFacts, dropDownFields);
    // Reason Codes List Box
    ddReasonCodeField = new ListBox();
    getEligibleFields(factName, typesForRC, new Callback<String[]>() {

        @Override
        public void callback(final String[] eligibleReasonCodeFields) {
            ddReasonCodeField.addItem(GuidedScoreCardConstants.INSTANCE.pleaseChoose());
            ddReasonCodeField.setEnabled(eligibleReasonCodeFields.length > 0);
            for (final String field : eligibleReasonCodeFields) {
                ddReasonCodeField.addItem(field);
            }
            final String rcField = model.getReasonCodeField() + " : List";
            final int selectedReasonCodeIndex = Arrays.asList(eligibleReasonCodeFields).indexOf(rcField);
            ddReasonCodeField.setSelectedIndex(selectedReasonCodeIndex >= 0 ? selectedReasonCodeIndex : 0);
        }
    });
    final boolean useReasonCodes = model.isUseReasonCodes();
    final String reasonCodesAlgo = model.getReasonCodesAlgorithm();
    ddUseReasonCode = booleanEditor(Boolean.toString(useReasonCodes));
    ddReasonCodeAlgorithm = listBoxEditor(reasonCodeAlgorithms, reasonCodesAlgo, true);
    tbBaselineScore = TextBoxFactory.getTextBox(DataType.TYPE_NUMERIC_DOUBLE);
    scorecardPropertiesGrid.setText(0, 0, GuidedScoreCardConstants.INSTANCE.facts());
    scorecardPropertiesGrid.setText(0, 1, GuidedScoreCardConstants.INSTANCE.resultantScoreField());
    scorecardPropertiesGrid.setText(0, 2, GuidedScoreCardConstants.INSTANCE.initialScore());
    scorecardPropertiesGrid.setWidget(1, 0, dropDownFacts);
    scorecardPropertiesGrid.setWidget(1, 1, dropDownFields);
    scorecardPropertiesGrid.setWidget(1, 2, tbInitialScore);
    scorecardPropertiesGrid.setText(2, 0, GuidedScoreCardConstants.INSTANCE.useReasonCodes());
    scorecardPropertiesGrid.setText(2, 1, GuidedScoreCardConstants.INSTANCE.resultantReasonCodesField());
    scorecardPropertiesGrid.setText(2, 2, GuidedScoreCardConstants.INSTANCE.reasonCodesAlgorithm());
    scorecardPropertiesGrid.setText(2, 3, GuidedScoreCardConstants.INSTANCE.baselineScore());
    scorecardPropertiesGrid.setWidget(3, 0, ddUseReasonCode);
    scorecardPropertiesGrid.setWidget(3, 1, ddReasonCodeField);
    scorecardPropertiesGrid.setWidget(3, 2, ddReasonCodeAlgorithm);
    scorecardPropertiesGrid.setWidget(3, 3, tbBaselineScore);
    /* TODO : Remove this explicitly Disabled Reasoncode support field*/
    ddUseReasonCode.setEnabled(false);
    ddReasonCodeField.setEnabled(false);
    tbBaselineScore.setText(Double.toString(model.getBaselineScore()));
    scorecardPropertiesGrid.getCellFormatter().setWidth(0, 0, "200px");
    scorecardPropertiesGrid.getCellFormatter().setWidth(0, 1, "250px");
    scorecardPropertiesGrid.getCellFormatter().setWidth(0, 2, "200px");
    scorecardPropertiesGrid.getCellFormatter().setWidth(0, 3, "200px");
    return scorecardPropertiesGrid;
}
Also used : ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) Grid(com.google.gwt.user.client.ui.Grid) ListBox(org.gwtbootstrap3.client.ui.ListBox)

Aggregations

Grid (com.google.gwt.user.client.ui.Grid)38 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)10 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)9 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)9 Label (com.google.gwt.user.client.ui.Label)7 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)7 Button (com.google.gwt.user.client.ui.Button)6 CellFormatter (com.google.gwt.user.client.ui.HTMLTable.CellFormatter)6 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)6 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)5 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)5 ColumnFormatter (com.google.gwt.user.client.ui.HTMLTable.ColumnFormatter)4 Image (com.google.gwt.user.client.ui.Image)4 CheckBox (com.google.gwt.user.client.ui.CheckBox)3 TextBox (com.google.gwt.user.client.ui.TextBox)3 GerritUiExtensionPoint (com.google.gerrit.client.GerritUiExtensionPoint)2 NativeString (com.google.gerrit.client.rpc.NativeString)2 HintTextBox (com.google.gerrit.client.ui.HintTextBox)2 OnEditEnabler (com.google.gerrit.client.ui.OnEditEnabler)2 KeyPressEvent (com.google.gwt.event.dom.client.KeyPressEvent)2