Exemple #1
0
 public void drawUpdating() {
   WebPanel container = getContainer();
   container.removeAll();
   container.setLayout(new HorizontalLayout());
   container.add(updatingPanel);
   container.repaint();
 }
Exemple #2
0
  public void draw(List<DetailsDecoration> details) {

    WebPanel container = getContainer();
    container.removeAll();

    int maxValueLength = convertToCharacters(getWidth() - 15) - maxValueLength(details) - 5;
    maxValueLength = (maxValueLength < 8 ? 8 : maxValueLength);

    int bottomPanelsAmount = (bottomPanels != null) ? bottomPanels.size() : 0;

    double columns[] = {5, TableLayout.PREFERRED, 3, TableLayout.FILL, 5};
    double rows[] = new double[3 + (details.size() + bottomPanelsAmount - 1) * 2];
    rows[0] = 2;
    rows[1] = 2;
    for (int i = 2; i < rows.length - 1; i += 2) {
      rows[i] = TableLayout.PREFERRED;
      rows[i + 1] = 2;
    }
    rows[rows.length - 1] = DEFAULT_MARGIN;

    TableLayout boxLayout = new TableLayout(new double[][] {columns, rows});

    boxLayout.setHGap(4);
    boxLayout.setVGap(4);

    container.setLayout(boxLayout);
    container.validate();

    container.add(createVerticalSeparator(), "2,1,2," + (rows.length - 2));

    int nextDetail = 1;
    for (DetailsDecoration detail : details) {
      int nextRow = nextDetail * 2;
      container.add(createHorizontalSeparator(), "0," + (nextRow - 1) + ",4," + (nextRow - 1));
      container.add(createNameLabel(detail), "1," + nextRow);
      container.add(createValueLabel(detail, maxValueLength), "3," + nextRow);
      nextDetail++;

      if (nextDetail > details.size()) {
        container.add(createHorizontalSeparator(), "0," + (nextRow + 1) + ",4," + (nextRow + 1));
      }
    }

    if (bottomPanels != null) {

      for (JPanel panel : bottomPanels) {
        int nextRow = nextDetail * 2;
        container.add(panel, "1, " + (nextRow) + ", 4, " + (nextRow));
        nextDetail++;
      }
    }

    container.repaint();
  }