/**
  * Change the style row selected or unselected
  *
  * @param row The row afected
  * @param selected Indicates selected unselected row
  */
 private void styleRow(int row, boolean selected) {
   if (row >= 0) {
     if (selected) {
       folderTable.getRowFormatter().addStyleName(row, "okm-Table-SelectedRow");
     } else {
       folderTable.getRowFormatter().removeStyleName(row, "okm-Table-SelectedRow");
     }
   }
 }
Example #2
0
  private void styleRow(int row, boolean selected) {
    if (row != -1) {
      String style = selectionStyle.selectedRow();

      if (selected) {
        table.getRowFormatter().addStyleName(row, style);
      } else {
        table.getRowFormatter().removeStyleName(row, style);
      }
    }
  }
 private void appendRow(Row row) {
   if (row.object == null) {
     Widget groupWidget;
     try {
       groupWidget = createGroupWidget(row.group);
     } catch (Exception ex) {
       throw new RuntimeException(Str.getSimpleName(getClass()) + "getGroupWidget() failed");
     }
     table.setWidget(row.tableRowIndex, 0, groupWidget);
     table.getFlexCellFormatter().setColSpan(row.tableRowIndex, 0, columns.size());
   } else {
     for (AColumn column : columns) {
       table.setWidget(row.tableRowIndex, column.index, column.getCellWidget(row.object));
       column.formatCell(row.tableRowIndex, row.object, table.getCellFormatter());
     }
     if (isClickable()) {
       switch (getMouseover()) {
         case ROW:
           table.getRowFormatter().setStyleName(row.tableRowIndex, "clickable");
           break;
         case CELL:
           for (int col = 0; col < columns.size(); col++) {
             if (isColumnClickable(col)) {
               table.getCellFormatter().setStyleName(row.tableRowIndex, col, "clickable");
             }
           }
           break;
         case NONE:
           break;
       }
     }
   }
 }
  public TrustActionEditView(
      I18NAccount messages, Constants constants, HelpPanel helpPanel, Elements elements) {
    this.messages = messages;
    this.constants = constants;
    this.helpPanel = helpPanel;
    this.elements = elements;

    DockPanel dp = new DockPanel();

    table = new FlexTable();
    table.setStyleName("tableborder");
    table.setText(0, 0, elements.trust());
    table.setText(0, 1, elements.description());
    table.setText(0, 2, elements.trust_default_desc());
    table.setText(0, 3, elements.trust_actionclub());
    table.setText(0, 4, elements.trust_actiontrust());
    table.setText(0, 5, elements.trust_debetpost());
    table.setText(0, 6, elements.trust_creditpost());
    table.setText(0, 7, "");
    table.getRowFormatter().setStyleName(0, "header");

    newButton = new NamedButton("new_trust", elements.new_trust());
    newButton.addClickHandler(this);

    dp.add(newButton, DockPanel.NORTH);
    dp.add(table, DockPanel.NORTH);

    idHolder = new IdHolder<String, Image>();
    initWidget(dp);
  }
Example #5
0
 private void addStylesToElementsInStockList() {
   stocksFlexTable.getRowFormatter().addStyleName(0, "watchListHeader");
   stocksFlexTable.addStyleName("watchList");
   stocksFlexTable.getCellFormatter().addStyleName(0, 1, "watchListNumericColumn");
   stocksFlexTable.getCellFormatter().addStyleName(0, 2, "watchListNumericColumn");
   stocksFlexTable.getCellFormatter().addStyleName(0, 3, "watchListRemoveColumn");
   stocksFlexTable.setCellPadding(6);
 }
Example #6
0
  private void createInputTableRowFor(FactPort factPort) {
    if (longExampleValues) {
      TextBox nameBox = CTextChangeHandler.createTextBox(factPort, "name");
      SuggestBox typeBox =
          CTextChangeHandler.createTypeSuggestBox(
              (ServiceDesigner) factPort.getServiceScreen().get("serviceDesigner"),
              factPort,
              "factType");
      TextArea exampleArea =
          CTextChangeHandler.createTextArea(factPort, "10cm", "8cm", "exampleValue");

      int inputNumRows = inputPortTable.getRowCount();
      inputPortTable.getRowFormatter().addStyleName(inputNumRows, "FindStyleForAlignTop");

      // add the text and suggest boxes
      inputPortTable.setWidget(inputNumRows, 0, nameBox);

      inputPortTable.setWidget(inputNumRows, 1, typeBox);
      inputPortTable.setWidget(inputNumRows, 2, exampleArea);
      // add remove button
      Button removePortButton = new Button("Remove precondition");
      removePortButton.setStyleName("fastButton");
      RemoveInputPortHandler inputPortHandler = new RemoveInputPortHandler();
      inputPortHandler.setFactPort(factPort);
      removePortButton.addClickHandler(inputPortHandler);

      inputPortTable.setWidget(inputNumRows, 3, removePortButton);

      // updateListener
      UpdateTransformationTabListener updateTabListener = new UpdateTransformationTabListener();
      factPort.addPropertyChangeListener("name", updateTabListener);
      factPort.addPropertyChangeListener("factType", updateTabListener);
      factPort.addPropertyChangeListener("exampleValue", updateTabListener);
    } else {
      TextBox nameBox = CTextChangeHandler.createTextBox(factPort, "name");
      SuggestBox typeBox =
          CTextChangeHandler.createTypeSuggestBox(
              (ServiceDesigner) factPort.getServiceScreen().get("serviceDesigner"),
              factPort,
              "factType");
      TextBox exampleBox = CTextChangeHandler.createTextBox(factPort, "exampleValue");

      int inputNumRows = inputPortTable.getRowCount();

      // add the text and suggest boxes
      inputPortTable.setWidget(inputNumRows, 0, nameBox);
      inputPortTable.setWidget(inputNumRows, 1, typeBox);
      inputPortTable.setWidget(inputNumRows, 2, exampleBox);

      // add remove button
      Button removePortButton = new Button("Remove precondition");
      removePortButton.setStyleName("fastButton");
      RemoveInputPortHandler inputPortHandler = new RemoveInputPortHandler();
      inputPortHandler.setFactPort(factPort);
      removePortButton.addClickHandler(inputPortHandler);
      inputPortTable.setWidget(inputNumRows, 3, removePortButton);
    }
  }
  protected void layoutCalendar() {
    calendarGrid.clear();
    calendarGrid.setCellSpacing(0);
    for (int i = 0, row = -2, col = 0; i < simpleDatePickers.size(); i++) {
      if ((i % monthColumns) == 0) {
        col = 0;
        row += 2;
      } else if (i > 0) {
        calendarGrid.setHTML(row, col, "&nbsp;");
        calendarGrid.setHTML(row + 1, col, "&nbsp;");
        calendarGrid.getCellFormatter().addStyleName(row, col, StyleMonthSeparator);
        calendarGrid.getCellFormatter().addStyleName(row + 1, col, StyleMonthSeparator);
        col += 1;
      }

      if (monthSelectorHeader.getParent() == null || simpleDatePickers.size() > 1) {
        if (i == 0 || (i % monthColumns) == 0) {
          calendarGrid.getRowFormatter().addStyleName(row, StyleMonthLabels);
          calendarGrid.getRowFormatter().addStyleName(row + 1, StyleMonthCell);
        }
        Widget w = null;
        if (i == 0 && monthSelectorHeader.getElement().getParentElement() == null)
          w = monthSelectorHeader;
        // calendarGrid.setWidget(row, col, monthSelectorHeader);
        else w = monthHeaders.get(i);
        // calendarGrid.setWidget(row, col, monthHeaders.get(i));

        DockPanel p = null;
        if (leftButtons.iterator().hasNext() && leftButtons.getParent() == null && col == 0) {
          p = leftButtons;
          p.add(w, DockPanel.WEST);
          p.setCellWidth(w, "100%");
          w = p;
          if (simpleDatePickers.size() == 1) {
            Iterator<Widget> it = p.iterator();
            while (it.hasNext()) {
              p.add(it.next(), DockPanel.WEST);
            }
          }
        }
        if (rightButtons.iterator().hasNext()
            && rightButtons.getParent() == null
            && ((i + 1) % monthColumns) == 0) {
          p = rightButtons;
          p.add(w, DockPanel.WEST);
          p.setCellWidth(w, "100%");
          w = p;
        }
        calendarGrid.setWidget(row, col, w);
      }

      calendarGrid.setWidget(row + 1, col, simpleDatePickers.get(i));
      calendarGrid.getColumnFormatter().addStyleName(i, "Month-" + i);
      simpleDatePickers.get(i).addValueChangeHandler(onDaySelected);
      col++;
    }
  }
Example #8
0
  private void addHeader() {

    flexTable.insertRow(HEADER_ROW_INDEX);
    flexTable.getRowFormatter().addStyleName(HEADER_ROW_INDEX, "FlexTable-Header");
    addColumn(constants.NameHead());
    addColumn(constants.ValueHead());
    addColumn(constants.Mandatory());
    addColumn(constants.FieldHead());
    flexTable.getColumnFormatter().setWidth(KEY_COLUMN, "0pt");
  }
Example #9
0
  @Override
  public void addResult(String jobId, String status, String result) {
    int row = results.getRowCount();
    results.getRowFormatter().addStyleName(row, (row % 2) == 0 ? "evenRow" : "oddRow");
    results.setWidget(row, 0, new Label(jobId));
    results.setWidget(row, 1, new Label(status));
    results.setWidget(row, 2, new Label(result));

    resultsScroller.scrollToBottom();
  }
Example #10
0
 /**
  * Fill the table to ensure a minimal size.
  *
  * @param aStartingRow
  */
 protected void fillWithEmptyRows(final FlexTable aTable, int aStartingRow, int aNbColumn) {
   // Fill any remaining slots with empty cells.
   for (; aStartingRow < constants.defaultMinDisplayedItems(); ++aStartingRow) {
     for (int i = 0; i < aNbColumn; i++) {
       aTable.setHTML(aStartingRow, i, NBSP);
     }
     // Set CSS style.
     aTable.getRowFormatter().setStyleName(aStartingRow, "item_list_empty_row");
   }
 }
Example #11
0
  private void applyDataRowStyles() {
    HTMLTable.RowFormatter rf = flexTable.getRowFormatter();

    for (int row = 1; row < flexTable.getRowCount(); ++row) {
      if ((row % 2) != 0) {
        rf.addStyleName(row, "FlexTable-OddRow");
      } else {
        rf.addStyleName(row, "FlexTable-EvenRow");
      }
    }
  }
Example #12
0
 public Viewer(int rowLimit, Set<String> showNames) {
   table = new FlexTable();
   table.setSize("100%", "auto");
   table.setCellSpacing(2);
   cellFormatter = table.getCellFormatter();
   rowFormatter = table.getRowFormatter();
   scroller = new ScrollPanel(table);
   scroller.getElement().getStyle().setProperty("borderTop", "1px solid #333333");
   setPause(false);
   setRowLimit(rowLimit);
   updateRowVisibility(showNames);
 }
Example #13
0
  /** Calculates the number of events that can be displayed in a cell. */
  public void calibrateCalendar() {
    final FlexTable grid = (FlexTable) getWidget();

    final Element row = grid.getRowFormatter().getElement(displayHeaders);
    row.setId("calendar-row-calibration");

    final Element cell =
        grid.getCellFormatter().getElement(displayHeaders, displayWeekNumber ? 1 : 0);
    cell.setId("calendar-cell-calibration");

    eventLimit = (getCellHeight(CELL_DEFAULT_HEIGHT) / EVENT_HEIGHT) - 2;
    if (eventLimit < 0) eventLimit = 0;
  }
Example #14
0
 private void generateQuickReferencePopup() {
   FlexTable fieldTable = new FlexTable();
   fieldTable.setText(0, 0, "Name");
   fieldTable.setText(0, 1, "Field");
   fieldTable.getRowFormatter().setStyleName(0, "data-row-header");
   int row = 1;
   for (FieldInfo fieldInfo : TkoUtils.getFieldList("all_fields")) {
     fieldTable.setText(row, 0, fieldInfo.name);
     fieldTable.setText(row, 1, fieldInfo.field);
     row++;
   }
   quickReferencePopup = new PopupPanel(false);
   quickReferencePopup.add(fieldTable);
 }
Example #15
0
  public void setModel(ProductInfo[] pi) {
    searchModel = pi;
    while (items.getRowCount() > 0) items.removeRow(0);
    if (searchModel == null || searchModel.length == 0) {
      emptyCartLbl.setVisible(true);
      return;
    }

    RowFormatter fmtr = items.getRowFormatter();
    for (int i = 0; i < searchModel.length; i++) {
      int row = items.insertRow(i);
      for (int j = 0; j < 2; j++) items.insertCell(row, j);
      items.setText(row, 0, searchModel[i].name);
      items.setText(row, 1, searchModel[i].description);
      fmtr.addStyleName(row, "ps-GridRow ps-GridRow-sel");
    }
    emptyCartLbl.setVisible(false);
  }
  private void addRow(JSONObject object, int row) {
    String desc = Util.str(object.get("description"));
    String id = Util.str(object.get("id"));
    String trust = Util.str(object.get("fond"));
    String defaultdesc = Util.str(object.get("defaultdesc"));
    String actionclub = Util.str(object.get("actionclub"));
    String actiontrust = Util.str(object.get("actionfond"));
    String debetpost = Util.strSkipNull(object.get("debetpost"));
    String creditpost = Util.strSkipNull(object.get("creditpost"));

    table.setText(row, 0, trustActionCache.trustGivesDesc(trust));
    table.setText(row, 1, desc);
    table.setText(row, 2, defaultdesc);
    table.setText(row, 3, Util.debkred(elements, actionclub));
    table.setText(row, 4, Util.debkred(elements, actiontrust));

    if (!("".equals(debetpost))) {
      table.setText(row, 5, posttypeCache.getDescriptionWithType(debetpost));
    }
    if (!("".equals(creditpost))) {
      table.setText(row, 6, posttypeCache.getDescriptionWithType(creditpost));
    }
    table.getCellFormatter().setStyleName(row, 0, "desc");
    table.getCellFormatter().setStyleName(row, 1, "desc");
    table.getCellFormatter().setStyleName(row, 2, "desc");
    table.getCellFormatter().setStyleName(row, 5, "desc");
    table.getCellFormatter().setStyleName(row, 6, "desc");

    Image editImage = ImageFactory.editImage("projectEditView_editImage");
    editImage.addClickHandler(me);
    idHolder.add(id, editImage);

    table.setWidget(row, 7, editImage);

    String style = (((row + 1) % 6) < 3) ? "line2" : "line1";
    table.getRowFormatter().setStyleName(row, style);
  }
Example #17
0
  /** {@inheritDoc} */
  protected void setRow(FlexTable table, int row, int elementIndex) {
    Alarm alarm = m_alarms[elementIndex];
    if (alarm.getIsDashboardRole()) {
      table.setText(row, 0, alarm.getNodeLabel());
    } else {
      table.setHTML(
          row,
          0,
          "<a href=\"element/node.jsp?node="
              + alarm.getNodeId()
              + "\">"
              + alarm.getNodeLabel()
              + "</a>");
    }

    HTML label = new HTML();
    label.setTitle(stripHtmlTags(alarm.getDescrption()));
    label.setHTML(SafeHtmlUtils.fromTrustedString(alarm.getLogMsg()));
    table.setWidget(row, 1, label);
    table.setText(row, 2, "" + alarm.getCount());
    table.setText(row, 3, alarm.getFirstEventTime().toString());
    table.setText(row, 4, alarm.getLastEventTime().toString());
    table.getRowFormatter().setStyleName(row, alarm.getSeverity());
  }
Example #18
0
 @UiHandler("flexTable")
 protected void onFlexTableClicked(ClickEvent event) {
   removeSelectedRowStyleFromTable();
   Cell cell = flexTable.getCellForEvent(event);
   if (cell != null && totalCount != 0) {
     int row = cell.getRowIndex();
     selectedIndex = row;
     flexTable.getRowFormatter().addStyleName(row, selectionStyle.rowHighlighted());
     RadioButtonContainer radioButtonContainer = radioButtons.get(row);
     if (radioButtonContainer != null && radioButtonContainer.getRadioButton() != null) {
       clearRadioButtons();
       radioButtonContainer.getRadioButton().setValue(true);
       selectedRowId = radioButtonContainer.getIdentifier();
       if (listner != null) {
         listner.onRowSelected(selectedRowId);
       }
     }
     if (radioButtonContainer != null
         && radioButtonContainer.getRadioButton() == null
         && radioButtonContainer.getIdentifier() != null) {
       selectedRowId = radioButtonContainer.getIdentifier();
     }
   }
 }
Example #19
0
 private void removeSelectedRowStyleFromTable() {
   for (int rowId = 0; rowId < flexTable.getRowCount(); rowId++) {
     flexTable.getRowFormatter().removeStyleName(rowId, selectionStyle.rowHighlighted());
   }
 }
  private void buildContent(RowData data) {
    grid = new FlexTable();
    grid.setCellSpacing(5);

    HTML html = new HTML("Working Set Name:  ");
    html.addStyleName("color-dark-blue");
    workingSetName = new TextBox();
    grid.setWidget(0, 0, html);
    grid.setWidget(0, 1, workingSetName);
    workingSetName.setSize("95%", "100%");

    html = new HTML("Creator:  ");
    html.addStyleName("color-dark-blue");
    managerHTML = new HTML();
    grid.setWidget(1, 0, html);
    grid.setWidget(1, 1, managerHTML);

    html = new HTML("Date Created:  ");
    html.addStyleName("color-dark-blue");
    dateCreatedHTML = new HTML();
    grid.setWidget(2, 0, html);
    grid.setWidget(2, 1, dateCreatedHTML);

    html = new HTML("Working Set Type:  ");
    html.addStyleName("color-dark-blue");
    workingSetMode = new ListBox(false);
    workingSetMode.insertItem("none selected", 0);
    workingSetMode.insertItem(WorkingSetData.PRIVATE, PRIVATEINDEX);
    workingSetMode.insertItem(WorkingSetData.PUBLIC, PUBLICINDEX);
    workingSetMode.setVisibleItemCount(1);
    workingSetMode.setEnabled(false);
    workingSetMode.setSelectedIndex(PUBLICINDEX);
    grid.setWidget(3, 0, html);
    grid.setWidget(3, 1, workingSetMode);

    html = new HTML("Associated People:  ");
    html.addStyleName("color-dark-blue");
    people = new SISCompleteList(this, 400);
    grid.setWidget(PEOPLECELL, 0, html);
    grid.setWidget(PEOPLECELL, 1, people);

    html = new HTML("Assessment Scope:  ");
    html.addStyleName("color-dark-blue");
    filterPanel = new AssessmentFilterPanel(new AssessmentFilter(), false, true, false, true);
    grid.setWidget(5, 0, html);
    grid.setWidget(5, 1, filterPanel);

    html = new HTML("Description:  ");
    html.addStyleName("color-dark-blue");
    description = new TextArea();
    grid.setWidget(6, 0, html);
    grid.setWidget(6, 1, description);
    description.setSize("95%", "100%");

    html = new HTML("Working Set Notes: ");
    html.addStyleName("color-dark-blue");
    notes = new TextArea();
    grid.setWidget(7, 0, html);
    grid.setWidget(7, 1, notes);
    notes.setSize("95%", "100%");

    grid.getColumnFormatter().setWidth(0, "130px");
    grid.getColumnFormatter().setWidth(1, "400px");
    grid.getRowFormatter().addStyleName(5, "vertical-align-top");
    grid.getRowFormatter().addStyleName(6, "vertical-align-top");
    grid.getRowFormatter().addStyleName(7, "vertical-align-top");
    grid.getCellFormatter().setHeight(6, 1, "200px");
    grid.getCellFormatter().setHeight(7, 1, "200px");

    HorizontalPanel hp = new HorizontalPanel();
    hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    hp.addStyleName("expert-border");
    hp.add(grid);

    // add(hp, data);

    LayoutContainer widget = new LayoutContainer();
    widget.setScrollMode(Scroll.AUTO);
    widget.setLayout(new FillLayout());
    widget.add(hp);
    add(widget, data);
    grid.setWidth("100%");
  }
Example #21
0
  /**
   * Inits the widget SortableTable, by Parvinder Thapa
   *
   * @link<http://psthapar.googlepages.com/simplesortabletable>
   */
  private void initSortableTable() {
    // sortableTable = new SortableTable();

    table = new FlexTable();

    table.setWidth(500 + "px");
    table.setStyleName("sortableTable");
    table.setBorderWidth(1);
    table.setCellPadding(4);
    table.setCellSpacing(1);

    // sortableTable.setWidth(500 + "px");
    // sortableTable.setStyleName("sortableTable");
    // sortableTable.setBorderWidth(1);
    // sortableTable.setCellPadding(4);
    // sortableTable.setCellSpacing(1);

    // header
    table.setHTML(0, FILE_NAME_COLUMN, FILE_NAME_TEXT);
    table.setHTML(0, STATUS_COLUMN, STATUS_TEXT);
    table.setHTML(0, DATE_COLUMN, DATE_TEXT);
    table.setHTML(0, DOWNLOAD_COLUMN, DOWNLOAD_TEXT);
    // sortableTable.addColumnHeader(FILE_NAME_TEXT, FILE_NAME_COLUMN);
    // sortableTable.addColumnHeader(STATUS_TEXT, STATUS_COLUMN);
    // sortableTable.addColumnHeader(DATE_TEXT, DATE_COLUMN);
    // sortableTable.addColumnHeader(DOWNLOAD_TEXT, DOWNLOAD_COLUMN);

    // COSMETIC PART OF THE WIDGET
    // Set Style Name for the header
    // RowFormatter rowFormatter = sortableTable.getRowFormatter();
    RowFormatter rowFormatter = table.getRowFormatter();
    rowFormatter.setStyleName(0, "tableHeader");

    // Set the Styles for the Data Rows and Columns
    // CellFormatter cellFormatter = sortableTable.getCellFormatter();
    CellFormatter cellFormatter = table.getCellFormatter();
    // Set the styles for the headers
    for (int colIndex = 0; colIndex < 4; colIndex++) {
      cellFormatter.setStyleName(0, colIndex, "headerStyle");
      cellFormatter.setAlignment(
          0, colIndex, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE);
    }

    for (int rowIndex = 1; rowIndex < 21; rowIndex++) {
      if (rowIndex % 2 == 0) {
        rowFormatter.setStyleName(rowIndex, "customRowStyle");
      } else {
        rowFormatter.setStyleName(rowIndex, "tableRow");
      }
      for (int colIndex = 0; colIndex < 4; colIndex++) {
        cellFormatter.setStyleName(rowIndex, colIndex, "customFont");
        if (colIndex == 1 || colIndex == 3) {
          cellFormatter.setAlignment(
              rowIndex,
              colIndex,
              HasHorizontalAlignment.ALIGN_RIGHT,
              HasVerticalAlignment.ALIGN_MIDDLE);
        } else if (colIndex == 0) {
          cellFormatter.setAlignment(
              rowIndex,
              colIndex,
              HasHorizontalAlignment.ALIGN_LEFT,
              HasVerticalAlignment.ALIGN_MIDDLE);
        }
        if (colIndex == 2) {
          cellFormatter.setAlignment(
              rowIndex,
              colIndex,
              HasHorizontalAlignment.ALIGN_CENTER,
              HasVerticalAlignment.ALIGN_MIDDLE);
        }
      }
    }
    // add(sortableTable);
    add(table);
  }
Example #22
0
  private void loadStockWatcher() {
    // Set up sign out hyperlink.
    signOutLink.setHref(loginInfo.getLogoutUrl());

    // Create table for tasks.
    tasksFlexTable.setText(0, 0, "Tâche");
    tasksFlexTable.setText(0, 1, "DeadLine");
    tasksFlexTable.setText(0, 2, "Priorité");
    tasksFlexTable.setText(0, 3, "Remove");

    // Add styles to elements in the stock list table.
    tasksFlexTable.getRowFormatter().addStyleName(0, "watchListHeader");
    tasksFlexTable.addStyleName("watchList");
    tasksFlexTable.getCellFormatter().addStyleName(0, 1, "watchListNumericColumn");
    tasksFlexTable.getCellFormatter().addStyleName(0, 2, "watchListNumericColumn");
    tasksFlexTable.getCellFormatter().addStyleName(0, 3, "watchListRemoveColumn");

    loadStocks();

    // Assemble Add Task panel.
    addPanel.add(newTaskTextBox);
    addPanel.add(addTaskButton);
    addPanel.addStyleName("addPanel");

    // Assemble Main panel.
    errorMsgLabel.setStyleName("errorMessage");
    errorMsgLabel.setVisible(false);

    mainPanel.add(errorMsgLabel);
    mainPanel.add(signOutLink);
    mainPanel.add(tasksFlexTable);
    mainPanel.add(addPanel);
    mainPanel.add(lastUpdatedLabel);

    // Associate the Main panel with the HTML host page.
    RootPanel.get("tasksList").add(mainPanel);

    // Move cursor focus to the input box.
    newTaskTextBox.setFocus(true);

    // Setup timer to refresh list automatically.
    Timer refreshTimer =
        new Timer() {
          @Override
          public void run() {
            refreshWatchList();
          }
        };
    refreshTimer.scheduleRepeating(REFRESH_INTERVAL);

    // Listen for mouse events on the Add button.
    addTaskButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            addTask();
          }
        });

    // Listen for keyboard events in the input box.
    newTaskTextBox.addKeyPressHandler(
        new KeyPressHandler() {
          public void onKeyPress(KeyPressEvent event) {
            if (event.getCharCode() == KeyCodes.KEY_ENTER) {
              addTask();
            }
          }
        });
  }
  /** Construit le tableau de la garantie. */
  private void construireTableauGarantie(GarantiePersonneMoraleModel garantie) {
    if (garantie.getListeInfosGarantie() != null && garantie.getListeInfosGarantie().size() > 0) {
      // On regarde s'il y a des montants souscrits pour afficher la colonne ou non.
      boolean hasMontantSouscrit = false;
      for (InfosGarantiePersonneMoraleModel infosGarantie : garantie.getListeInfosGarantie()) {
        if (infosGarantie.getMontantSouscrit() != null
            && infosGarantie.getMontantSouscrit() > 0.0d) {
          hasMontantSouscrit = true;
          break;
        }
      }

      // Construction du tableau
      final FlexTable tableInfosGarantie = new FlexTable();
      tableInfosGarantie.setWidth(ComposantContratPersonneMoraleConstants.POURCENT_100);
      tableInfosGarantie.setCellPadding(6);
      tableInfosGarantie.setStylePrimaryName(ressources.css().tableau());
      tableInfosGarantie.getRowFormatter().setStyleName(0, ressources.css().ligneEnteteColonne());
      tableInfosGarantie.setWidget(0, 0, new Label(viewConstants.labelCodeTarif()));
      tableInfosGarantie.setWidget(0, 1, new Label(viewConstants.labelGarantieGestion()));
      tableInfosGarantie.setWidget(0, 2, new Label(viewConstants.labelPopulation()));
      if (hasMontantSouscrit) {
        tableInfosGarantie.setWidget(0, 3, new Label(viewConstants.labelCapital()));
      }
      // Remplissage des lignes
      int ligne = 1;
      for (InfosGarantiePersonneMoraleModel infosGarantie : garantie.getListeInfosGarantie()) {
        tableInfosGarantie.setWidget(ligne, 0, new Label(infosGarantie.getCodeTarif()));
        tableInfosGarantie.setWidget(
            ligne, 1, new Label(infosGarantie.getLibelleGarantieGestion()));
        tableInfosGarantie.setWidget(ligne, 2, new Label(infosGarantie.getLibellePopulation()));
        if (hasMontantSouscrit && infosGarantie.getMontantSouscrit() != null) {
          tableInfosGarantie.setWidget(
              ligne, 3, new Label(numberFormat.format(infosGarantie.getMontantSouscrit())));
        }
        final Long idStatut = infosGarantie.getStatut().getIdentifiant();
        if (constantesApp.getIdStatutGarantieEnCours().equals(idStatut)) {
          tableInfosGarantie
              .getRowFormatter()
              .addStyleName(ligne, this.ressources.css().couleurFondGarantieEnCours());
        } else if (constantesApp.getIdStatutGarantieResiliee().equals(idStatut)) {
          tableInfosGarantie
              .getRowFormatter()
              .addStyleName(ligne, this.ressources.css().couleurFondGarantieResiliee());
        }
        ligne++;
      }

      if (hasMontantSouscrit) {
        tableInfosGarantie.getColumnFormatter().setWidth(0, "15%");
        tableInfosGarantie.getColumnFormatter().setWidth(1, "45%");
        tableInfosGarantie.getColumnFormatter().setWidth(2, "25%");
        tableInfosGarantie.getColumnFormatter().setWidth(3, "15%");
      } else {
        tableInfosGarantie.getColumnFormatter().setWidth(0, "20%");
        tableInfosGarantie.getColumnFormatter().setWidth(1, "50%");
        tableInfosGarantie.getColumnFormatter().setWidth(2, "30%");
      }
      conteneurGlobal.add(tableInfosGarantie);
    }
  }
  private Panel getBasicInfoPanel(final Reservoir reservoir) {
    FlowPanel panel = new FlowPanel();
    panel.add(new HTMLPanel("<h3>Reservoir " + reservoir.getName() + "</h3>"));
    table = new FlexTable();
    table.setHTML(1, 0, "Area (Million Sq. Feet): " + reservoir.getArea());
    setBottomElevation("Bottom Elevation (Feet): " + reservoir.getBottomElevation());
    bottomElevationButton = new Button("Recalculate Bottom Elevation");
    table.setWidget(2, 2, bottomElevationButton);
    bottomElevationButton.addClickHandler(
        new ClickHandler() {

          public void onClick(ClickEvent event) {
            final DEMDataServiceAsync service = GWT.create(DEMDataService.class);
            List<double[]> latLngPoints = reservoir.getLatLngPoints();
            List<DataPoint> points = new ArrayList<DataPoint>();
            for (int i = 0; i < latLngPoints.size(); i++) {
              DataPoint p = new DataPoint();
              double[] ll = latLngPoints.get(i);
              double[] utm = GeomUtils.convertToUTM(ll[0], ll[1]);
              p.x = utm[0];
              p.y = utm[1];
              points.add(p);
            }
            service.startCalculationOfAverageElevationInArea(
                points,
                new AsyncCallback<CalculationState>() {
                  private Timer timer;
                  private CalculationState state;

                  public void onSuccess(CalculationState result) {
                    state = result;
                    timer =
                        new Timer() {

                          @Override
                          public void run() {
                            if (state.numberOfTasks == state.numberOfCompletedTasks) {
                              timer.cancel();
                              reservoir.setBottomElevation(state.latestValue);
                              setBottomElevation(
                                  "Bottom Elevation (Feet): " + reservoir.getBottomElevation());
                            } else {
                              service.checkStatus(
                                  state,
                                  new AsyncCallback<CalculationState>() {

                                    public void onFailure(Throwable caught) {
                                      timer.cancel();
                                    }

                                    public void onSuccess(CalculationState result) {
                                      state = result;
                                      setBottomElevation(
                                          "Calculation in progress "
                                              + (state.numberOfCompletedTasks
                                                  / state.numberOfTasks
                                                  * 100)
                                              + "% complete");
                                      timer.schedule(2000);
                                    }
                                  });
                            }
                          }
                        };
                    timer.schedule(2000);
                  }

                  public void onFailure(Throwable caught) {
                    timer = null;
                  }
                });
          }
        });
    panel.add(table);
    FlexTable connectionTable = new FlexTable();
    connectionTable.setStyleName("bordered-title");
    connectionTable.setWidth("100%");
    connectionTable.setHTML(0, 0, "<b>NODE</b>");
    connectionTable.setHTML(0, 1, "<b>COEFF IN</b>");
    connectionTable.setHTML(0, 2, "<b>COEFF OUT</b>");
    connectionTable.getRowFormatter().setStyleName(0, "table-header");
    List<ReservoirConnection> reservoirConnections = reservoir.getReservoirConnections();
    int index = 1;
    for (ReservoirConnection reservoirConnection : reservoirConnections) {
      connectionTable.setHTML(index, 0, reservoirConnection.nodeId);
      connectionTable.setHTML(index, 1, "" + reservoirConnection.coefficientIn);
      connectionTable.setHTML(index, 2, "" + reservoirConnection.coefficientOut);
      index++;
    }
    panel.add(connectionTable);
    return panel;
  }
Example #25
0
 protected void addHeaders() {
   results.getRowFormatter().setStylePrimaryName(0, "tsTableHeader");
   results.setWidget(0, 0, new HTML(constants.jobId(), false));
   results.setWidget(0, 1, new HTML(constants.status(), false));
   results.setWidget(0, 2, new HTML(constants.description(), false));
 }
Example #26
0
 public boolean isVisible() {
   return table.getRowFormatter().isVisible(rowIndex);
 }
Example #27
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);
      }
    }
  }
 public void onCellClicked(SourcesTableEvents sender, int row, int cell) {
   FlexTable table = (FlexTable) sender;
   if ("deleted".equals(table.getRowFormatter().getStylePrimaryName(row))) return; /**/
   clearCurrentSelection(table, row, cell);
   makeWidget(table, row, cell);
 }
Example #29
0
 public void setVisible(boolean visible) {
   table.getRowFormatter().setVisible(rowIndex, visible);
 }
 private void applyColumnFilters() {
   for (Row row : rows) {
     table.getRowFormatter().setVisible(row.tableRowIndex, row.matchesColumnFilters());
   }
   onColumnFiltersChanged();
 }