/** 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);
  }
Exemple #2
0
    public void initLayout() {
      lang = new ListBox();
      lang =
          Convert.makeSelectedLanguageListBox(
              (ArrayList<String[]>) MainApp.getLanguage(), tObj.getLang());
      lang.setWidth("100%");
      lang.setEnabled(false);

      term = new TextBox();
      term.setText(tObj.getLabel());
      term.setWidth("100%");

      main = new CheckBox(constants.conceptPreferredTerm());
      if (tObj.isMainLabel()) {
        main.setValue(tObj.isMainLabel());
        // main.setEnabled(false);
      }

      Grid table = new Grid(2, 2);
      table.setWidget(0, 0, new HTML(constants.conceptTerm()));
      table.setWidget(1, 0, new HTML(constants.conceptLanguage()));
      table.setWidget(0, 1, term);
      table.setWidget(1, 1, lang);
      table.setWidth("100%");
      table.getColumnFormatter().setWidth(1, "80%");

      VerticalPanel vp = new VerticalPanel();
      vp.add(GridStyle.setTableConceptDetailStyleleft(table, "gslRow1", "gslCol1", "gslPanel1"));
      vp.add(main);
      vp.setSpacing(0);
      vp.setWidth("100%");
      vp.setCellHorizontalAlignment(main, HasHorizontalAlignment.ALIGN_RIGHT);

      addWidget(vp);
    }
Exemple #3
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;
 }
 @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();
 }
  @Override
  public void setPropertyList(Map<String, Object> propertyList) {
    noRec.clear();
    map(propertyList);

    Grid grid = new Grid(noRec.keySet().size(), 2);
    grid.setWidth("100%");
    grid.setStyleName("propertyGrid");

    int i = 0;
    for (String k : noRec.keySet()) {
      if (k.equals("_id")) {
        if (noRec.get(k).substring(0, 1).equals("n")) {
          grid.setWidget(i, 0, new Label("source"));
          grid.setWidget(
              i,
              1,
              new HTML(
                  "<a target=\"_blank\" href=\"http://www.openstreetmap.org/browse/node/"
                      + noRec.get(k).substring(1, noRec.get(k).length())
                      + "\">OSM CC-By-SA</a>"));
        } else if (noRec.get(k).substring(0, 1).equals("w")) {
          grid.setWidget(i, 0, new Label("source"));
          grid.setWidget(
              i,
              1,
              new HTML(
                  "<a target=\"_blank\" href=\"http://www.openstreetmap.org/browse/way/"
                      + noRec.get(k).substring(1, noRec.get(k).length())
                      + "\">OSM CC-By-SA</a>"));
        } else if (noRec.get(k).substring(0, 1).equals("r")) {
          grid.setWidget(i, 0, new Label("source"));
          grid.setWidget(
              i,
              1,
              new HTML(
                  "<a target=\"_blank\" href=\"http://www.openstreetmap.org/browse/relation/"
                      + noRec.get(k).substring(1, noRec.get(k).length())
                      + "\">OSM CC-By-SA</a>"));
        }
      } else {
        grid.setWidget(i, 0, new Label(k));
        grid.setWidget(i, 1, new Label(noRec.get(k)));
      }

      grid.getCellFormatter().setStyleName(i, 0, "namecell");
      grid.getCellFormatter().setStyleName(i, 1, "valuecell");

      i++;
    }

    _siPa.setWidget(grid);
  }
Exemple #6
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;
 }
Exemple #7
0
    private Widget getRelationshipTermTable(TermRelationshipObject trObj) {

      HashMap<ClassObject, HashMap<TermObject, Boolean>> resultList = trObj.getResult();
      Iterator<ClassObject> it = resultList.keySet().iterator();
      Grid table = new Grid(resultList.size() + 1, 2);
      table.setWidget(0, 0, new HTML(constants.termRelationship()));
      table.setWidget(0, 1, new HTML(constants.termTerm()));
      int i = 1;
      while (it.hasNext()) {
        ClassObject rObj = (ClassObject) it.next();
        HashMap<TermObject, Boolean> termList = (HashMap<TermObject, Boolean>) resultList.get(rObj);
        // table.setWidget(i, 0, new HTML(Convert.getRelationshipLabel(rObj)));
        // table.setWidget(i, 1, getDestinationTerm(rObj, new
        // ArrayList<TermObject>(termList.keySet())));
        table.setWidget(i, 0, new HTML(rObj.getLabel()));
        table.setWidget(i, 1, getDestinationTerm(new ArrayList<TermObject>(termList.keySet())));
        i++;
      }

      table.setWidth("100%");
      return GridStyle.setTableConceptDetailStyleTop(
          table, "gstFR1", "gstFC1", "gstR1", "gstPanel1", true);
    }
  @Override
  protected Widget createContents(int start, int count, List<T> list) {
    int limit = list.size();
    int cells = padToFullPage() ? Math.max(count, limit) : limit;
    Grid grid = new Grid((int) Math.ceil(cells / (float) _cols), Math.min(_cols, cells));
    grid.setStyleName("Grid");
    grid.setCellPadding(0);
    grid.setCellSpacing(0);
    grid.setWidth("100%");

    for (int ii = 0; ii < limit; ii++) {
      int row = (ii / _cols), col = (ii % _cols);
      T item = ii >= list.size() ? null : list.get(ii);
      Widget widget = createWidget(item);
      if (widget != null) {
        grid.setWidget(row, col, widget);
      }
      formatCell(grid.getCellFormatter(), row, col, limit);
      formatCell(grid.getCellFormatter(), row, col, item);
    }

    return grid;
  }
  public WorkitemDefinitionEditor(RuleAsset a, int visibleLines) {
    asset = a;
    data = (RuleContentText) asset.getContent();
    if (data.content == null) {
      data.content = "Empty!";
    }

    Grid layout = new Grid(1, 2);

    WorkitemDefinitionElementsBrowser browser =
        new WorkitemDefinitionElementsBrowser(
            new WorkitemDefinitionElementSelectedListener() {

              public void onElementSelected(String elementName, String pasteValue) {
                insertText(pasteValue, true);
              }
            });

    layout.setWidget(0, 0, browser);
    text = new TextArea();
    text.setWidth("100%");
    text.setVisibleLines((visibleLines == -1) ? 25 : visibleLines);
    text.setText(data.content);
    text.getElement().setAttribute("spellcheck", "false"); // NON-NLS

    text.setStyleName("default-text-Area"); // NON-NLS

    text.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            data.content = text.getText();
            makeDirty();
          }
        });

    text.addKeyDownHandler(
        new KeyDownHandler() {

          public void onKeyDown(KeyDownEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_TAB) {
              event.preventDefault();
              event.stopPropagation();
              int pos = text.getCursorPos();
              insertText("\t", false);
              text.setCursorPos(pos + 1);
              text.cancelKey();
              text.setFocus(true);
            }
          }
        });

    layout.setWidget(0, 1, text);

    layout.getColumnFormatter().setWidth(0, "10%");
    layout.getColumnFormatter().setWidth(1, "90%");
    layout
        .getCellFormatter()
        .setAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_TOP);
    layout
        .getCellFormatter()
        .setAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_TOP);
    layout.setWidth("95%");

    initWidget(layout);
  }
  public ResizableDialogBox(
      final String headerText,
      String okText,
      String cancelText,
      final Widget content,
      final boolean modal) {
    this.content = content;
    boundaryPanel =
        new AbsolutePanel() {
          public void onBrowserEvent(Event event) {
            super.onBrowserEvent(event);
            if (!modal && event.getTypeInt() == Event.ONCLICK) {
              hide();
            }
          }
        };
    boundaryPanel.setSize(
        "100%",
        Window.getClientHeight() + Window.getScrollTop() + "px"); // $NON-NLS-1$ //$NON-NLS-2$
    boundaryPanel.setVisible(true);
    RootPanel.get().add(boundaryPanel, 0, 0);
    boundaryPanel.sinkEvents(Event.ONCLICK);
    boundaryPanel
        .getElement()
        .getStyle()
        .setProperty("cursor", "wait"); // $NON-NLS-1$ //$NON-NLS-2$

    // initialize window controller which provides drag and resize windows
    WindowController windowController = new WindowController(boundaryPanel);

    // content wrapper
    Button ok = new Button(okText);
    ok.setStylePrimaryName("pentaho-button");
    ok.getElement().setAttribute("id", "okButton"); // $NON-NLS-1$ //$NON-NLS-2$
    ok.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            if (validatorCallback == null
                || (validatorCallback != null && validatorCallback.validate())) {
              try {
                if (callback != null) {
                  callback.okPressed();
                }
              } catch (Throwable dontCare) {
              }
              hide();
            }
          }
        });
    final HorizontalPanel dialogButtonPanel = new HorizontalPanel();
    dialogButtonPanel.setSpacing(2);
    dialogButtonPanel.add(ok);
    if (cancelText != null) {
      Button cancel = new Button(cancelText);
      cancel.setStylePrimaryName("pentaho-button");
      cancel.getElement().setAttribute("id", "cancelButton"); // $NON-NLS-1$ //$NON-NLS-2$
      cancel.addClickHandler(
          new ClickHandler() {

            public void onClick(ClickEvent event) {
              try {
                if (callback != null) {
                  callback.cancelPressed();
                }
              } catch (Throwable dontCare) {
              }
              hide();
            }
          });
      dialogButtonPanel.add(cancel);
    }
    HorizontalPanel dialogButtonPanelWrapper = new HorizontalPanel();
    if (okText != null && cancelText != null) {
      dialogButtonPanelWrapper.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    } else {
      dialogButtonPanelWrapper.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    }
    dialogButtonPanelWrapper.setStyleName("dialogButtonPanel"); // $NON-NLS-1$
    dialogButtonPanelWrapper.setWidth("100%"); // $NON-NLS-1$
    dialogButtonPanelWrapper.add(dialogButtonPanel);

    Grid dialogContent = new Grid(2, 1);
    dialogContent.setCellPadding(0);
    dialogContent.setCellSpacing(0);
    dialogContent.getCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_TOP);
    dialogContent
        .getCellFormatter()
        .setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_LEFT);
    // add content
    dialogContent.setWidget(0, 0, content);
    dialogContent.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP);
    // add button panel
    dialogContent.setWidget(1, 0, dialogButtonPanelWrapper);
    dialogContent.getCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_BOTTOM);
    dialogContent.setWidth("100%"); // $NON-NLS-1$
    dialogContent.setHeight("100%"); // $NON-NLS-1$

    windowPanel = new WindowPanel(windowController, headerText, dialogContent, true);
  }