Exemplo n.º 1
0
  public void setData(List<String> data) {
    contactsTable.removeAllRows();

    for (int i = 0; i < data.size(); ++i) {
      contactsTable.setWidget(i, 0, new CheckBox());
      contactsTable.setText(i, 1, data.get(i));
    }
  }
Exemplo n.º 2
0
  @Override
  public void setData(JsArray<Weapon> data) {
    contactsTable.removeAllRows();

    for (int i = 0; i < data.length(); ++i) {
      contactsTable.setWidget(i, 0, new CheckBox());
      contactsTable.setText(i, 1, data.get(i).getName());
    }
  }
Exemplo n.º 3
0
  /** {@inheritDoc} */
  @SuppressWarnings("unchecked")
  public void setMappings(List<DefinitionMapping> mappings) {
    table.removeAllRows();
    definitionsPanels.clear();
    includeCheckBoxes.clear();
    targetWidgets.clear();
    definitions.clear();

    setupTableHeaders(includeTargetColumn);

    table.getColumnFormatter().setWidth(DEFINITION_COLUMN, "100%");
    // table.getColumnFormatter().setWidth(ARROW_COLUMN, "70px");

    if (mappings.isEmpty()) {
      Label noAttributesLabel = new Label("No attributes or links");
      table.setWidget(1, 0, noAttributesLabel);
      table.getFlexCellFormatter().setColSpan(1, 0, includeTargetColumn ? 3 : 4);
      table.getFlexCellFormatter().setStyleName(1, 0, style.emptyCell());

    } else {
      FlexCellFormatter cellFormatter = table.getFlexCellFormatter();
      for (DefinitionMapping mapping : mappings) {

        final int row = table.getRowCount();
        UIDefinition definition = mapping.getDefinition();
        definitions.add(definition);

        DefinitionPanel definitionPanel = new DefinitionPanel();
        definitionPanel.setDefinition(definition);
        definitionPanel.setEnabled(mapping.isMapped());

        definitionsPanels.add(definitionPanel);
        table.setWidget(row, DEFINITION_COLUMN, definitionPanel);
        cellFormatter.setVerticalAlignment(
            row, DEFINITION_COLUMN, HasVerticalAlignment.ALIGN_MIDDLE);

        final SimpleCheckBox includeCheckBox = new SimpleCheckBox();
        includeCheckBox.setStyleName(
            CommonResources.INSTANCE.css().simpleCheckbox() + " " + style.checkbox());
        includeCheckBox.addClickHandler(
            new ClickHandler() {

              @Override
              public void onClick(ClickEvent event) {
                setInclude(row, includeCheckBox.getValue());
              }
            });

        includeCheckBox.setValue(mapping.isMapped());
        table.setWidget(row, INCLUDE_COLUMN, includeCheckBox);
        cellFormatter.setVerticalAlignment(row, INCLUDE_COLUMN, HasVerticalAlignment.ALIGN_MIDDLE);
        includeCheckBoxes.add(includeCheckBox);

        Widget targetWidget = widgetProvider.getTargetWidget((T) mapping.getTarget());

        if (targetWidget != null) {

          Image arrow = new Image(Resources.INSTANCE.arrow());
          arrow.setStyleName(style.arrow());
          table.setWidget(row, ARROW_COLUMN, arrow);
          cellFormatter.setVerticalAlignment(row, ARROW_COLUMN, HasVerticalAlignment.ALIGN_MIDDLE);
          // table.getCellFormatter().setWidth(row, ARROW_COLUMN, "60px");
          table.getCellFormatter().setHeight(row, ARROW_COLUMN, "40px");

          widgetProvider.include(targetWidget, mapping.isMapped());

          table.setWidget(row, TARGET_COLUMN, targetWidget);
          cellFormatter.setVerticalAlignment(row, TARGET_COLUMN, HasVerticalAlignment.ALIGN_MIDDLE);
          targetWidgets.add(targetWidget);
        }
      }
    }
  }
Exemplo n.º 4
0
 public void clearContent() {
   table.removeAllRows();
 }
Exemplo n.º 5
0
 @Override
 public void clear() {
   GWT.log("app-job-panel.clear");
   results.removeAllRows();
   addHeaders();
 }
Exemplo n.º 6
0
 private void clearInternal() {
   tableField.removeAllRows();
   currentEditors.clear();
   dirty = false;
 }
Exemplo n.º 7
0
 @Override
 public void onLogRotated() {
   table.removeAllRows();
 }
Exemplo n.º 8
0
 public void clear() {
   table.removeAllRows();
   Log.log(Level.INFO, "removeAllRows");
 }
Exemplo n.º 9
0
 private void clearContent() {
   table.removeAllRows();
 }
Exemplo n.º 10
0
  private void update(boolean isRadioButton, int startIndex, int selectedIndexlocal) {
    selectedRowId = null;
    flexTable.removeAllRows();
    navBarTable.removeAllRows();
    createTableHeader(isRadioButton);
    int count = totalCount;
    int max = startIndex + visibleRecodrCount;
    if (max > count) {
      max = count;
    }
    navBar.update(startIndex, count, max);
    setNavigationBar();
    TableHeader header = tableData.getHeader();
    HeaderColumn[] columns = header.getHeaderColumns();
    String width = null;
    int rowCounter = 0;
    String radioName = String.valueOf(new Date().getTime());
    final List<Record> recordList = tableData.getRecordList();
    if (recordList != null) {
      if (!recordList.isEmpty()) {
        for (final Record record : recordList) {
          int colCounter = 0;
          for (; colCounter < columns.length; colCounter++) {
            width = columns[colCounter].getWidth() + "%";
            flexTable.getCellFormatter().setWidth(rowCounter, colCounter, width);
            flexTable.setWidget(rowCounter, colCounter, record.getWidget(columns[colCounter]));
            flexTable
                .getCellFormatter()
                .setHorizontalAlignment(rowCounter, colCounter, HasHorizontalAlignment.ALIGN_LEFT);
            flexTable.getCellFormatter().setWordWrap(rowCounter, colCounter, true);
            flexTable.getCellFormatter().addStyleName(rowCounter, colCounter, "wordWrap");
          }
          if (isRadioButton) {
            final RadioButton radioButton = new RadioButton(radioName);
            if (rowCounter == selectedIndexlocal) {
              radioButton.setValue(true);
              selectedRowId = record.getIdentifier();
              selectedIndex = rowCounter;
              if (null != listner && fireEventForFirstRow) {
                listner.onRowSelected(selectedRowId);
              }

              scrollIntoView(
                  flexTable.getWidget(selectedIndexlocal, FIRST_COLUMN_INDEX).getElement());
            }
            radioButton.addClickHandler(
                new ClickHandler() {

                  @Override
                  public void onClick(ClickEvent arg0) {
                    clearRadioButtons();
                    radioButton.setValue(true);
                    selectedRowId = record.getIdentifier();
                    selectedIndex = recordList.indexOf(record);
                  }
                });
            flexTable.setWidget(rowCounter, 0, radioButton);
            RadioButtonContainer radioButtonContainer =
                new RadioButtonContainer(radioButton, record.getIdentifier());
            radioButtons.put(rowCounter, radioButtonContainer);
            flexTable
                .getCellFormatter()
                .setHorizontalAlignment(rowCounter, 0, HasHorizontalAlignment.ALIGN_CENTER);

            radioButton.addFocusHandler(
                new FocusHandler() {

                  @Override
                  public void onFocus(FocusEvent arg0) {
                    removeSelectedRowStyleFromTable();
                    for (Integer rowId : radioButtons.keySet()) {
                      if (radioButtons.get(rowId).getRadioButton().equals(radioButton)) {
                        selectedIndex = recordList.indexOf(record);
                        flexTable
                            .getRowFormatter()
                            .addStyleName(rowId, selectionStyle.rowHighlighted());
                      }
                    }
                  }
                });
          } else {
            RadioButtonContainer radioButtonContainer =
                new RadioButtonContainer(null, record.getIdentifier());
            radioButtons.put(rowCounter, radioButtonContainer);
          }
          if (rowCounter % 2 == 0) {
            flexTable.getRowFormatter().setStyleName(rowCounter, selectionStyle.oddRow());
          } else {
            flexTable.getRowFormatter().setStyleName(rowCounter, selectionStyle.evenRow());
          }
          rowCounter++;
          flexTable
              .getRowFormatter()
              .addStyleName(selectedIndexlocal, selectionStyle.rowHighlighted());
        }
      } else {
        Label label = new Label();
        label.setWidth("100%");
        label.setText("No record found.");
        flexTable.getCellFormatter().setWidth(1, 0, "100%");
        flexTable.getFlexCellFormatter().setColSpan(1, 0, 3);
        // Record record = new Record("1");
        // tableData.getRecordList().add(record);
        flexTable.setWidget(1, 0, label);
      }
    }
  }
Exemplo n.º 11
0
 /**
  * Removes all rows. Must be when the structure of the calendar has been changed (display mode)
  */
 private void clear() {
   final FlexTable grid = (FlexTable) getWidget();
   grid.clear();
   grid.removeAllRows();
 }