/** Creates a new ProjectList */
  public ProjectList() {
    projects = new ArrayList<Project>();
    selectedProjects = new ArrayList<Project>();
    projectWidgets = new HashMap<Project, ProjectWidgets>();

    sortField = SortField.DATE_MODIFIED;
    sortOrder = SortOrder.DESCENDING;

    // Initialize UI
    table = new Grid(1, 4); // The table initially contains just the header row.
    table.addStyleName("ode-ProjectTable");
    table.setWidth("100%");
    table.setCellSpacing(0);
    nameSortIndicator = new Label("");
    dateCreatedSortIndicator = new Label("");
    dateModifiedSortIndicator = new Label("");
    refreshSortIndicators();
    setHeaderRow();

    VerticalPanel panel = new VerticalPanel();
    panel.setWidth("100%");

    panel.add(table);
    initWidget(panel);

    // It is important to listen to project manager events as soon as possible.
    Ode.getInstance().getProjectManager().addProjectManagerEventListener(this);
  }
  public void loadTable(final IncludedInDetail detail) {
    int row = 0;
    table.resizeRows(detail.getBranches().size() + 1);
    table.addStyleName(Gerrit.RESOURCES.css().changeTable());
    final CellFormatter fmt = table.getCellFormatter();
    fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().dataHeader());
    table.setText(row, 0, Util.C.includedInTableBranch());

    for (final String branch : detail.getBranches()) {
      fmt.addStyleName(++row, 0, Gerrit.RESOURCES.css().dataCell());
      fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().leftMostCell());
      table.setText(row, 0, branch);
    }

    if (!detail.getTags().isEmpty()) {
      table.resizeRows(table.getRowCount() + 2 + detail.getTags().size());
      row++;
      fmt.addStyleName(++row, 0, Gerrit.RESOURCES.css().dataHeader());
      table.setText(row, 0, Util.C.includedInTableTag());

      for (final String tag : detail.getTags()) {
        fmt.addStyleName(++row, 0, Gerrit.RESOURCES.css().dataCell());
        fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().leftMostCell());
        table.setText(row, 0, tag);
      }
    }

    table.setVisible(true);
    loaded = true;
  }
Esempio n. 3
0
  /**
   * Skeleton of toolbar creation
   *
   * @return
   */
  protected Widget buildStepBar() {
    HorizontalPanel uiToolbar = new HorizontalPanel();
    uiToolbar.setStylePrimaryName("blockSteps");
    uiToolbar.setWidth("100%");
    uiToolbar.setHorizontalAlignment(ALIGN_RIGHT);
    uiToolbar.setVerticalAlignment(ALIGN_MIDDLE);

    // Build stepBar
    int nbSteps = controller.getNbViews();

    Grid table = new Grid(1, nbSteps);
    table.setCellSpacing(3);
    Image currentImg = null;
    for (int i = 0; i < nbSteps; i++) {
      if (i == stepNumber) {
        currentImg = new Image("img/red_round_button.jpg");
      } else if (i < stepNumber) {
        currentImg = new Image("img/green_round_tick.jpg");
      } else {
        currentImg = new Image("img/green_round_button.jpg");
      }
      table.setWidget(0, i, currentImg);
    }

    uiToolbar.add(table);
    return uiToolbar;
  }
Esempio n. 4
0
 public void initLayout() {
   Grid table = new Grid(1, 2);
   table.setWidget(0, 0, getWarningImage());
   table.setWidget(
       0, 1, getMessage(messages.conceptDeleteTermWarning(tObj.getLabel(), tObj.getLang())));
   addWidget(table);
 }
  @Inject
  public TransUnitsTableView(
      FilterViewConfirmationDisplay filterViewConfirmationDisplay, LoadingPanel loadingPanel) {
    this.filterViewConfirmationDisplay = filterViewConfirmationDisplay;
    this.loadingPanel = loadingPanel;
    initWidget(uiBinder.createAndBindUi(this));
    noContentLabel.setText(messages.noContent());
    noContentLabel.setStyleName("gamma");

    transUnitTable.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            HTMLTable.Cell cellForEvent = transUnitTable.getCellForEvent(event);
            if (cellForEvent != null) {
              selectRow(cellForEvent.getRowIndex());
            }
          }
        });
    transUnitTable.resize(0, 2);
    transUnitTable.getColumnFormatter().setWidth(0, "49%");
    transUnitTable.getColumnFormatter().setWidth(1, "51%");
    Window.addResizeHandler(
        new ResizeHandler() {
          @Override
          public void onResize(ResizeEvent event) {
            listener.refreshView();
          }
        });

    transUnitTable.ensureDebugId("transUnitTable");
  }
  private void insertTableRows(final Table type, final Integer r) {
    final int rows = r.intValue();

    if (Table.GRID.equals(type)) {
      final Grid grid = (Grid) table;

      for (int i = 0; i < rows; i++) {
        final Number num = new Integer(i);
        grid.resizeRows(i + 1);
        for (int j = i; j > 0; j--) {
          grid.setWidget(j, 0, grid.getWidget(j - 1, 0));
        }
        grid.setWidget(0, 0, makeLabel(num));
      }

    } else if (Table.FLEX_TABLE.equals(type)) {
      final FlexTable flexTable = (FlexTable) table;

      for (int i = 0; i < rows; i++) {
        final Number num = new Integer(i);
        flexTable.insertRow(0);
        flexTable.setWidget(0, 0, makeLabel(num));
      }

    } else if (Table.OBJECT_LIST_TABLE.equals(type)) {
      final ObjectListTable olt = (ObjectListTable) table;

      for (int i = 0; i < rows; i++) {
        final Number num = new Integer(i);
        olt.getObjects().add(0, num);
      }
    }
  }
Esempio n. 7
0
 /**
  * Creates a grid according to the current row and column count information.
  *
  * @return grid
  */
 private Grid createGrid() {
   grid = new Grid(rows, columns);
   grid.setWidth("100%");
   grid.setHeight("100%");
   grid.addClickHandler(this);
   return grid;
 }
Esempio n. 8
0
 private void populatePersonResult(List<Person> persons) {
   searchResult.resizeRows(persons.size());
   for (int i = 0; i < persons.size(); i++) {
     Person person = persons.get(i);
     searchResult.setHTML(i, 0, person.getFirstName());
     searchResult.setHTML(i, 1, person.getLastName());
   }
 }
Esempio n. 9
0
  public Geocoder2Demo() {
    Panel panel = new FlowPanel();
    final FormPanel form = new FormPanel();
    form.setAction("#");
    Panel formElements = new FlowPanel();
    Label label = new Label("Search for an address:");
    formElements.add(label);
    final TextBox addressBox = new TextBox();
    addressBox.setVisibleLength(40);
    formElements.add(addressBox);
    Button submit = new Button("Search");
    submit.addClickListener(
        new ClickListener() {
          public void onClick(Widget sender) {
            form.submit();
          }
        });
    formElements.add(submit);
    form.add(formElements);
    form.addFormHandler(
        new FormHandler() {
          public void onSubmit(FormSubmitEvent event) {
            showAddress(addressBox.getText());
            event.setCancelled(true);
          }

          public void onSubmitComplete(FormSubmitCompleteEvent event) {}
        });
    panel.add(form);

    map = new MapWidget(LatLng.newInstance(34, 0), 1);
    map.setSize("100%", "480px");
    panel.add(map);

    Grid grid = new Grid((sampleAddresses.length / NUM_ADDRESS_COLUMNS) + 1, NUM_ADDRESS_COLUMNS);

    for (int i = 0; i < sampleAddresses.length; i++) {
      final String address = sampleAddresses[i];
      Button link = new Button(address);
      // Hyperlink link = new Hyperlink(address, true,
      // "Extracting Structured Address Information");
      link.addClickListener(
          new ClickListener() {
            public void onClick(Widget sender) {
              addressBox.setText(address);
              form.submit();
            }
          });
      grid.setWidget(i / NUM_ADDRESS_COLUMNS, i % NUM_ADDRESS_COLUMNS, link);
    }
    panel.add(grid);

    initWidget(panel);
    geocoder = new Geocoder();
  }
Esempio n. 10
0
  private void storeCellWidgets() {
    cellWidgets = new FocusWidget[boardGrid.getRowCount()][boardGrid.getCellCount(0)];

    for (int row = 0; row < boardGrid.getRowCount(); row++) {
      int cellCount = boardGrid.getCellCount(row);
      for (int col = 0; col < cellCount; col++) {

        cellWidgets[row][col] = (FocusWidget) boardGrid.getWidget(row, col);
      }
    }
  }
 @Override
 public void applySelectedStyle(int rowIndex) {
   HTMLTable.RowFormatter rowFormatter = transUnitTable.getRowFormatter();
   for (int i = 0; i < transUnitTable.getRowCount(); i++) {
     if (i == rowIndex) {
       rowFormatter.addStyleName(i, "selected");
     } else {
       rowFormatter.removeStyleName(i, "selected");
     }
   }
 }
Esempio n. 12
0
 @Inject
 public TargetContentsView(
     Provider<ValidationMessagePanelView> validationMessagePanelViewProvider,
     TableEditorMessages messages) {
   validationPanel = validationMessagePanelViewProvider.get();
   rootPanel = binder.createAndBindUi(this);
   editorGrid.addStyleName("TableEditorCell-Target-Table");
   editorGrid.ensureDebugId("target-contents-grid");
   editorGrid.setWidth("100%");
   editors = Lists.newArrayList();
 }
Esempio n. 13
0
  @Override
  public Grid getWidget() {
    if (table != null) {
      return table;
    }
    table = new Grid(1, 2);

    table.setText(0, 0, "Phone number");
    table.setWidget(0, 1, number);

    return table;
  }
 public void updateRow(int row) {
   WalrusInfoWeb walrus = this.walrusList.get(row);
   Grid g = (Grid) this.grid.getWidget(row, 0);
   HorizontalPanel p = (HorizontalPanel) g.getWidget(0, 1);
   walrus.setHost(((TextBox) p.getWidget(0)).getText());
   int widgetStartIndex = 1;
   ArrayList<String> properties = walrus.getProperties();
   for (int i = 0; i < (properties.size() / 4); ++i) {
     if (properties.get(4 * i).startsWith("KEYVALUE"))
       properties.set(4 * i + 2, ((TextBox) g.getWidget(widgetStartIndex + i, 1)).getText());
   }
 }
Esempio n. 15
0
 private void row(Grid grid, int row, String name, Widget field) {
   final CellFormatter fmt = grid.getCellFormatter();
   if (LocaleInfo.getCurrentLocale().isRTL()) {
     grid.setText(row, 1, name);
     grid.setWidget(row, 0, field);
     fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().header());
   } else {
     grid.setText(row, 0, name);
     grid.setWidget(row, 1, field);
     fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().header());
   }
 }
Esempio n. 16
0
  /** Initialize this example. */
  @ShowcaseSource
  @Override
  public Widget onInitialize() {
    // Use a Grid to layout the content
    Grid layout = new Grid(4, 2);
    layout.setCellSpacing(5);

    // Add a field to select the pattern
    patternList = new ListBox();
    patternList.setWidth("17em");
    String[] patterns = constants.cwNumberFormatPatterns();
    for (String pattern : patterns) {
      patternList.addItem(pattern);
    }
    patternList.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            updatePattern();
          }
        });
    layout.setHTML(0, 0, constants.cwNumberFormatPatternLabel());
    layout.setWidget(0, 1, patternList);

    // Add a field to display the pattern
    patternBox = new TextBox();
    patternBox.setWidth("17em");
    patternBox.addKeyUpHandler(
        new KeyUpHandler() {
          public void onKeyUp(KeyUpEvent event) {
            updatePattern();
          }
        });
    layout.setWidget(1, 1, patternBox);

    // Add a field to set the value
    valueBox = new TextBox();
    valueBox.setWidth("17em");
    valueBox.setText("31415926535.897932");
    valueBox.addKeyUpHandler(
        new KeyUpHandler() {
          public void onKeyUp(KeyUpEvent event) {
            updateFormattedValue();
          }
        });
    layout.setHTML(2, 0, constants.cwNumberFormatValueLabel());
    layout.setWidget(2, 1, valueBox);

    // Add a field to display the formatted value
    formattedBox = new Label();
    formattedBox.setWidth("17em");
    layout.setHTML(3, 0, constants.cwNumberFormatFormattedLabel());
    layout.setWidget(3, 1, formattedBox);

    // Return the layout Widget
    updatePattern();
    return layout;
  }
  public void beginTableAppendRow(final Table type, final Integer rows) {
    if (Table.GRID.equals(type)) {
      final Grid grid;
      table = grid = new Grid();
      grid.resizeColumns(1);

    } else if (Table.FLEX_TABLE.equals(type)) {
      table = new FlexTable();

    } else if (Table.OBJECT_LIST_TABLE.equals(type)) {
      table = new ObjectListTable(new NumberRenderer());
    }
  }
Esempio n. 18
0
 private void addDatePanel() {
   Grid datePanel = new Grid(2, 2);
   datePanel.setText(0, 0, "Departure Date:");
   DateBox departureBox = new DateBox();
   Date departureDate = new Date();
   departureBox.setValue(departureDate);
   datePanel.setWidget(0, 1, departureBox);
   datePanel.setText(1, 0, "Return Date:");
   DateBox returnBox = new DateBox();
   Date returnDate = DateUtils.datePlusWeek(departureDate);
   returnBox.setValue(returnDate);
   datePanel.setWidget(1, 1, returnBox);
   RootPanel.get("date-panel").add(datePanel);
 }
Esempio n. 19
0
  /** Adds the header row to the table. */
  private void setHeaderRow() {
    table.getRowFormatter().setStyleName(0, "ode-ProjectHeaderRow");

    HorizontalPanel nameHeader = new HorizontalPanel();
    final Label nameHeaderLabel = new Label(MESSAGES.projectNameHeader());
    nameHeaderLabel.addStyleName("ode-ProjectHeaderLabel");
    nameHeader.add(nameHeaderLabel);
    nameSortIndicator.addStyleName("ode-ProjectHeaderLabel");
    nameHeader.add(nameSortIndicator);
    table.setWidget(0, 1, nameHeader);

    HorizontalPanel dateCreatedHeader = new HorizontalPanel();
    final Label dateCreatedHeaderLabel = new Label(MESSAGES.projectDateCreatedHeader());
    dateCreatedHeaderLabel.addStyleName("ode-ProjectHeaderLabel");
    dateCreatedHeader.add(dateCreatedHeaderLabel);
    dateCreatedSortIndicator.addStyleName("ode-ProjectHeaderLabel");
    dateCreatedHeader.add(dateCreatedSortIndicator);
    table.setWidget(0, 2, dateCreatedHeader);

    HorizontalPanel dateModifiedHeader = new HorizontalPanel();
    final Label dateModifiedHeaderLabel = new Label(MESSAGES.projectDateModifiedHeader());
    dateModifiedHeaderLabel.addStyleName("ode-ProjectHeaderLabel");
    dateModifiedHeader.add(dateModifiedHeaderLabel);
    dateModifiedSortIndicator.addStyleName("ode-ProjectHeaderLabel");
    dateModifiedHeader.add(dateModifiedSortIndicator);
    table.setWidget(0, 3, dateModifiedHeader);

    MouseDownHandler mouseDownHandler =
        new MouseDownHandler() {
          @Override
          public void onMouseDown(MouseDownEvent e) {
            SortField clickedSortField;
            if (e.getSource() == nameHeaderLabel || e.getSource() == nameSortIndicator) {
              clickedSortField = SortField.NAME;
            } else if (e.getSource() == dateCreatedHeaderLabel
                || e.getSource() == dateCreatedSortIndicator) {
              clickedSortField = SortField.DATE_CREATED;
            } else {
              clickedSortField = SortField.DATE_MODIFIED;
            }
            changeSortOrder(clickedSortField);
          }
        };
    nameHeaderLabel.addMouseDownHandler(mouseDownHandler);
    nameSortIndicator.addMouseDownHandler(mouseDownHandler);
    dateCreatedHeaderLabel.addMouseDownHandler(mouseDownHandler);
    dateCreatedSortIndicator.addMouseDownHandler(mouseDownHandler);
    dateModifiedHeaderLabel.addMouseDownHandler(mouseDownHandler);
    dateModifiedSortIndicator.addMouseDownHandler(mouseDownHandler);
  }
  public IndicatorWidget(ProjectMediator med) {
    this.med = med;

    name_lbl = new Label();
    author_lbl = new Label();
    description_lbl = new Label();
    version_lbl = new Label();
    activated_btn = new Button();
    setActivated(false);
    activated_btn.addClickHandler(this);

    labelPanel.setStyleName("indicatorInfoPanel");
    labelPanel.add(name_lbl);
    labelPanel.add(author_lbl);
    labelPanel.add(version_lbl);
    labelPanel.add(description_lbl);
    labelPanel.add(activated_btn);

    name_lbl.addStyleName("indicatorInfoTitle");
    author_lbl.addStyleName("indicatorInfoStage");
    version_lbl.addStyleName("indicatorInfoStage");
    description_lbl.addStyleName("indicatorInfoDescription");

    mainPanel.setWidget(0, 0, labelPanel);
    initWidget(mainPanel);
  }
Esempio n. 21
0
 private Grid getDestinationTerm(ArrayList<TermObject> result) {
   Grid table = new Grid(result.size(), 1);
   for (int i = 0; i < result.size(); i++) {
     TermObject tObj = (TermObject) result.get(i);
     table.setWidget(
         i,
         0,
         new HTML(
             getTermColorByStatus(
                 tObj.getLabel() + "&nbsp;(" + tObj.getLang().toLowerCase() + ")",
                 tObj.getStatus(),
                 tObj.isMainLabel())));
   }
   table.setWidth("100%");
   return table;
 }
Esempio n. 22
0
 private void populateRankTable(AccountInfo[] info) {
   Util.removeGridData(rankGrid);
   rankGrid.resizeRows(info.length + 1);
   for (int row = 1; row <= info.length; row++) {
     insertRankTableRow(row, info[row - 1]);
   }
 }
    public InnerItem(Serializable s) {
      close.addStyleDependentName("SMALLER");
      close.addClickHandler(
          new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
              inner.hide();
            }
          });
      innerLayout.add(close);
      grid.getCellFormatter().setWidth(0, 0, "85%");
      grid.getCellFormatter().setWidth(0, 1, "5%");
      label.setText(s.getName());
      grid.setWidget(0, 0, label);
      if (s instanceof CategorySerializable) {
        CategorySerializable c = (CategorySerializable) s;
        if (c.getDoc() != null || c.getAttributes().get("children_dsid") != null) {
          image.addClickHandler(
              new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                  inner.setPopupPosition(image.getAbsoluteLeft(), image.getAbsoluteTop());
                  inner.show();
                }
              });
          grid.setWidget(0, 1, image);
          if (c.getDoc() != null) {
            String url = c.getDoc();
            if (!c.getDoc().equals("")) {
              Anchor link = new Anchor("Documentation", url, "_blank");
              innerLayout.add(link);
            }
          }
          if (c.getAttributes().get("children_dsid") != null) {
            Anchor meta =
                new Anchor(
                    "Variable and Grid Description",
                    "getMetadata.do?dsid=" + c.getAttributes().get("children_dsid"),
                    "_blank");
            innerLayout.add(meta);
          }
          inner.add(innerLayout);
        }
      }
      initWidget(grid);
    }
Esempio n. 24
0
  @Override
  public void setState(EditingState editingState) {
    if (this.editingState == editingState) {
      return;
    }
    this.editingState = editingState;
    if (editingState == EditingState.UNSAVED) {
      editorGrid.setStyleName(style.unsaved());
      savingIndicator.setVisible(false);

    } else if (editingState == EditingState.SAVING) {
      savingIndicator.setVisible(true);
    } else {
      editorGrid.setStyleName(resolveStyleName(cachedValue.getStatus()));
      savingIndicator.setVisible(false);
    }
  }
Esempio n. 25
0
  @Override
  protected void onInitUI() {
    super.onInitUI();

    tokenLabel = new CopyableLabel("");
    tokenLabel.addStyleName(Gerrit.RESOURCES.css().oauthToken());

    expiresLabel = new Label("");
    expiresLabel.addStyleName(Gerrit.RESOURCES.css().oauthExpires());

    grid = new Grid(2, 2);
    grid.setStyleName(Gerrit.RESOURCES.css().infoBlock());
    grid.addStyleName(Gerrit.RESOURCES.css().oauthInfoBlock());
    add(grid);

    expiredNote = new Label(Util.C.labelOAuthExpired());
    expiredNote.setVisible(false);
    add(expiredNote);

    row(grid, 0, Util.C.labelOAuthToken(), tokenLabel);
    row(grid, 1, Util.C.labelOAuthExpires(), expiresLabel);

    CellFormatter fmt = grid.getCellFormatter();
    fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().topmost());
    fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().topmost());
    fmt.addStyleName(1, 0, Gerrit.RESOURCES.css().bottomheader());

    flow = new FlowPanel();
    flow.setStyleName(Gerrit.RESOURCES.css().oauthPanel());
    add(flow);

    Label netrcLabel = new Label(Util.C.labelOAuthNetRCEntry());
    netrcLabel.setStyleName(Gerrit.RESOURCES.css().oauthPanelNetRCHeading());
    flow.add(netrcLabel);
    netrcValue = new CopyableLabel("");
    netrcValue.setStyleName(Gerrit.RESOURCES.css().oauthPanelNetRCEntry());
    flow.add(netrcValue);

    Label cookieLabel = new Label(Util.C.labelOAuthGitCookie());
    cookieLabel.setStyleName(Gerrit.RESOURCES.css().oauthPanelCookieHeading());
    flow.add(cookieLabel);
    cookieValue = new CopyableLabel("");
    cookieValue.setStyleName(Gerrit.RESOURCES.css().oauthPanelCookieEntry());
    flow.add(cookieValue);
  }
  private void toggleSplit() {
    isSplit = !isSplit;
    if (isSplit) {
      splitPurchaseGrid = new SplitPurchaseGrid(billTypeManager);

      splitPurchaseGrid.setTotalCost(getCost());

      costField.setFieldLabel("Total Cost");

      fieldPanel.removeRow(3);
      fieldPanel.removeRow(3);

      matchingField.addDisplayableReportWidget(splitPurchaseGrid);
    } else {
      costField.setFieldLabel("Cost");

      fieldPanel.insertRow(3);

      fieldPanel.setText(2, 0, "Bill Type:");
      fieldPanel.setWidget(2, 1, billTypeComboBox);

      fieldPanel.insertRow(4);
      fieldPanel.setText(3, 0, "Note:");
      fieldPanel.setWidget(3, 1, noteField);

      matchingField.addDisplayableReportWidget(null);
    }
  }
Esempio n. 27
0
 @Override
 public void revertEditorContents() {
   List<String> cachedTargets = cachedValue.getTargets();
   for (int i = 0; i < cachedTargets.size(); i++) {
     String target = cachedTargets.get(i);
     editors.get(i).setTextAndValidate(target);
   }
   editorGrid.setStyleName(resolveStyleName(cachedValue.getStatus()));
 }
Esempio n. 28
0
  @Override
  public void onClick(ClickEvent event) {
    Cell cell = grid.getCellForEvent(event);
    if (cell == null) {
      return;
    }

    selectedY = cell.getRowIndex();
    selectedX = cell.getCellIndex();
  }
Esempio n. 29
0
  private void refreshTable(boolean needToSort) {
    if (needToSort) {
      // Sort the projects.
      Comparator<Project> comparator;
      switch (sortField) {
        default:
        case NAME:
          comparator =
              (sortOrder == SortOrder.ASCENDING)
                  ? ProjectComparators.COMPARE_BY_NAME_ASCENDING
                  : ProjectComparators.COMPARE_BY_NAME_DESCENDING;
          break;
        case DATE_CREATED:
          comparator =
              (sortOrder == SortOrder.ASCENDING)
                  ? ProjectComparators.COMPARE_BY_DATE_CREATED_ASCENDING
                  : ProjectComparators.COMPARE_BY_DATE_CREATED_DESCENDING;
          break;
        case DATE_MODIFIED:
          comparator =
              (sortOrder == SortOrder.ASCENDING)
                  ? ProjectComparators.COMPARE_BY_DATE_MODIFIED_ASCENDING
                  : ProjectComparators.COMPARE_BY_DATE_MODIFIED_DESCENDING;
          break;
      }
      Collections.sort(projects, comparator);
    }

    refreshSortIndicators();

    // Refill the table.
    table.resize(1 + projects.size(), 5);
    int row = 1;
    for (Project project : projects) {
      ProjectWidgets pw = projectWidgets.get(project);
      if (selectedProjects.contains(project)) {
        table.getRowFormatter().setStyleName(row, "ode-ProjectRowHighlighted");
        pw.checkBox.setValue(true);
      } else {
        table.getRowFormatter().setStyleName(row, "ode-ProjectRowUnHighlighted");
        pw.checkBox.setValue(false);
      }
      table.setWidget(row, 0, pw.checkBox);
      table.setWidget(row, 1, pw.nameLabel);
      table.setWidget(row, 2, pw.dateCreatedLabel);
      table.setWidget(row, 3, pw.dateModifiedLabel);
      table.setWidget(row, 4, pw.editButton);
      preparePublishApp(project, pw);
      row++;
    }

    Ode.getInstance().getProjectToolbar().updateButtons();
  }
 /**
  * sets the css for a row in a grid. the top row will get the header style and other rows get
  * either the even or odd style.
  *
  * @param grid
  * @param row
  * @param selected
  */
 private void setGridRowStyle(Grid grid, int row, boolean selected) {
   String style = "";
   if (row > 0) {
     if (selected) {
       style = SELECTED_ROW_CSS;
     } else {
       if (row % 2 == 0) {
         style = EVEN_ROW_CSS;
       } else {
         style = ODD_ROW_CSS;
       }
     }
   } else {
     style = GRID_HEADER_CSS;
   }
   for (int i = 0; i < grid.getColumnCount(); i++) {
     grid.getCellFormatter().setStyleName(row, i, style);
   }
 }