Exemple #1
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);
    }
  @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 Grid buildDoubleList(WorkingSetConfigData wsData) {
    Grid grid = new Grid(2, 3);

    availableFacts.setVisibleItemCount(10);
    selectedFacts.setVisibleItemCount(10);

    Grid btnsPanel = new Grid(2, 1);

    btnsPanel.setWidget(
        0,
        0,
        new Button(
            ">",
            new ClickHandler() {
              public void onClick(ClickEvent sender) {
                moveSelected(availableFacts, selectedFacts);
              }
            }));

    btnsPanel.setWidget(
        1,
        0,
        new Button(
            "&lt;",
            new ClickHandler() {
              public void onClick(ClickEvent sender) {
                moveSelected(selectedFacts, availableFacts);
              }
            }));

    grid.setWidget(0, 0, new SmallLabel("Available")); // TODO i18n
    grid.setWidget(0, 1, new SmallLabel(""));
    grid.setWidget(0, 2, new SmallLabel("Selected")); // TODO i18n
    grid.setWidget(1, 0, availableFacts);
    grid.setWidget(1, 1, btnsPanel);
    grid.setWidget(1, 2, selectedFacts);

    grid.getColumnFormatter().setWidth(0, "45%");
    grid.getColumnFormatter().setWidth(0, "10%");
    grid.getColumnFormatter().setWidth(0, "45%");
    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);
  }
  private Grid buildDoubleList() {
    Grid grid = new Grid(2, 5);

    availableWorkspacesListBox = new ListBox();
    availableWorkspacesListBox.setVisibleItemCount(10);
    availableWorkspacesListBox.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent arg0) {
            String selectedWorkspaceName =
                availableWorkspacesListBox.getItemText(
                    availableWorkspacesListBox.getSelectedIndex());
            refreshModuleList(selectedWorkspaceName);
          }
        });
    // availableWorkspaces.setWidth( "30%" );

    refreshWorkspaceList();

    try {
      availableModulesListBox.setVisibleItemCount(10);
      selectedModulesListBox.setVisibleItemCount(10);

      Grid btnsPanel = new Grid(2, 1);

      btnsPanel.setWidget(
          0,
          0,
          new Button(
              ">",
              new ClickHandler() {

                public void onClick(ClickEvent sender) {
                  copySelected(availableModulesListBox, selectedModulesListBox);
                }
              }));

      btnsPanel.setWidget(
          1,
          0,
          new Button(
              "&lt;",
              new ClickHandler() {

                public void onClick(ClickEvent sender) {
                  copySelected(selectedModulesListBox, availableModulesListBox);
                }
              }));

      grid.setWidget(0, 0, new SmallLabel(constants.Workspaces()));
      grid.setWidget(0, 2, new SmallLabel("Workspace: Available Modules"));
      grid.setWidget(0, 3, new SmallLabel(""));
      grid.setWidget(0, 4, new SmallLabel("Workspace: Selected Modules"));
      grid.setWidget(1, 0, availableWorkspacesListBox);
      grid.setWidget(1, 2, availableModulesListBox);
      grid.setWidget(1, 3, btnsPanel);
      grid.setWidget(1, 4, selectedModulesListBox);

      grid.getColumnFormatter().setWidth(0, "25%");
      grid.getColumnFormatter().setWidth(1, "10%");
      grid.getColumnFormatter().setWidth(2, "25%");
      grid.getColumnFormatter().setWidth(3, "15%");
      grid.getColumnFormatter().setWidth(4, "25%");
      return grid;
    } finally {
      // sce.setFilteringFacts( filteringFact );
    }
  }
  private void updateRecords() {
    records.clear();

    if (displayFields.isEmpty()) {
      records.setWidget(new HTML(""));
      return;
    }

    List<StructureHolder> holders = oneToMany.getSelected();
    if (holders.isEmpty()) {
      records.setWidget(new HTML(""));
      return;
    }

    List<String> descs = holders.get(0).getStructure().extractDescriptions();

    Grid grid = new Grid(holders.size() + 1, displayFields.size());
    grid.setCellSpacing(0);
    grid.setCellPadding(8);
    grid.addStyleName("page_assessment_classScheme_grid");

    int row = 0;
    int column = 0;
    for (Integer value : displayFields) {
      try {
        grid.setHTML(
            row,
            column,
            "<span class=\"page_assessment_classScheme_grid_th\">" + descs.get(value) + "</span>");
      } catch (IndexOutOfBoundsException e) {
        grid.setHTML(row, column, "<span class=\"page_assessment_classScheme_grid_th\">-</span>");
      } finally {
        column++;
      }
    }

    row++;

    for (StructureHolder holder : holders) {
      final ArrayList<String> raw = new ArrayList<String>(), pretty = new ArrayList<String>();

      final Structure<Object> structure = holder.getStructure();

      final Map<String, String> map = new LinkedHashMap<String, String>();

      for (Object obj : structure.getClassificationInfo()) {
        ClassificationInfo info = (ClassificationInfo) obj;
        map.put(info.getDescription(), info.getData());
        raw.add(info.getData());
      }

      try {
        structure.getDisplayableData(raw, pretty, 0);
      } catch (Exception e) {
        continue;
      }

      column = 0;
      for (Integer value : displayFields) {
        try {
          grid.setHTML(
              row,
              column,
              "<span class=\"page_assessment_classScheme_content\">"
                  + pretty.get(value)
                  + "</span>");
        } catch (IndexOutOfBoundsException e) {
          grid.setHTML(row, column, "<span class=\"page_assessment_classScheme_content\">-</span>");
        } finally {
          column++;
        }
      }

      row++;
    }

    for (int i = 0; i < grid.getColumnCount(); i++) grid.getColumnFormatter().setWidth(i, "150px");

    records.setWidget(grid);
  }