Ejemplo n.º 1
0
  public void showDate(Date dateToShow) {
    this.date = dateToShow;
    updateBeginAndEnd();

    lists.clear();
    selectionManager.clear();

    FlexTable table = new FlexTable();
    table.setWidth("100%");
    table.setCellPadding(2);
    table.getColumnFormatter().setWidth(0, "25px");
    table.getColumnFormatter().setWidth(1, "40px");
    table.getColumnFormatter().setWidth(2, "30px");
    table.getColumnFormatter().setWidth(3, "40px");

    // table.setBorderWidth(1);
    int row = 0;
    Date d = begin;
    int month = 0;
    int week = 0;
    while (d.compareTo(end) <= 0) {
      int w = d.getWeek();
      if (w != week) {
        week = w;
        Widget weekWidget = Gwt.createDiv("DayListWidget-week", String.valueOf(week));
        table.setWidget(row, 0, weekWidget);
      }
      int m = d.getMonth();
      if (m != month) {
        month = m;
        Widget monthWidget = Gwt.createDiv("DayListWidget-month", Gwt.getMonthShort(month));
        table.setWidget(row, 1, monthWidget);
      }
      table.setWidget(row, 2, Gwt.createDiv("DayListWidget-date", Gwt.formatDay(d.toJavaDate())));
      table.setWidget(
          row, 3, Gwt.createDiv("DayListWidget-date", Gwt.formatWeekdayShort(d.toJavaDate())));
      table.setWidget(row, 4, createDayContent(d));

      formatRow(table, row);
      d = d.nextDay();
      row++;
    }

    Widget downloadLink =
        ScrumGwt.createPdfLink(
            "Download as PDF", "calendar", "from", begin.toString(), "to", end.toString());
    wrapper.setWidget(Gwt.createFlowPanel(table, Gwt.createSpacer(1, 10), downloadLink));
  }
Ejemplo n.º 2
0
  /**
   * Initializes the table so that it contains enough rows for a full page of emails. Also creates
   * the images that will be used as 'read' flags.
   */
  private void initTable() {
    // Initialize the header.
    header.getColumnFormatter().setWidth(0, "128px");
    header.getColumnFormatter().setWidth(1, "192px");
    header.getColumnFormatter().setWidth(3, "256px");

    header.setText(0, 0, "Sender");
    header.setText(0, 1, "Email");
    header.setText(0, 2, "Subject");
    header.setWidget(0, 3, navBar);
    header.getCellFormatter().setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_RIGHT);

    // Initialize the table.
    table.getColumnFormatter().setWidth(0, "128px");
    table.getColumnFormatter().setWidth(1, "192px");
  }
Ejemplo n.º 3
0
 public FlexTable createTable() {
   if (!currentRow.cells.isEmpty()) nextRow();
   FlexTable table = new FlexTable();
   table.setStyleName(styleName);
   table.setCellSpacing(cellSpacing);
   table.setCellPadding(cellPadding);
   if (centered) table.getElement().setAttribute("align", "center");
   String widthAsString = width == null ? "" : width;
   table.setWidth(widthAsString);
   table.getElement().setAttribute("width", widthAsString);
   if (columnWidths != null) {
     ColumnFormatter columnFormatter = table.getColumnFormatter();
     for (int i = 0; i < columnWidths.length; i++) {
       columnFormatter.setWidth(i, columnWidths[i]);
     }
   }
   int rowIndex = 0;
   for (Row row : rows) {
     int colIndex = 0;
     for (Cell cell : row.cells) {
       table.setWidget(rowIndex, colIndex, cell.widget);
       if (cell.colspan > 1)
         table.getFlexCellFormatter().setColSpan(rowIndex, colIndex, cell.colspan);
       if (cell.align != null) {
         table.getCellFormatter().setHorizontalAlignment(rowIndex, colIndex, cell.align);
       }
       colIndex += cell.colspan;
     }
     rowIndex++;
   }
   return table;
 }
Ejemplo n.º 4
0
  private void initTable() {
    // Initialize the table.
    table.getColumnFormatter().setWidth(1, "10em");
    table.addClickHandler(this);

    fetchActions();
  }
Ejemplo n.º 5
0
  public WeaponsView() {
    DecoratorPanel contentTableDecorator = new DecoratorPanel();
    initWidget(contentTableDecorator);
    contentTableDecorator.setWidth("100%");
    contentTableDecorator.setWidth("15em");

    contentTable = new FlexTable();
    contentTable.setWidth("100%");
    contentTable.getCellFormatter().addStyleName(0, 0, "contacts-ListContainer");
    contentTable.getCellFormatter().setWidth(0, 0, "100%");
    contentTable.getFlexCellFormatter().setVerticalAlignment(0, 0, DockPanel.ALIGN_TOP);

    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setBorderWidth(0);
    hPanel.setSpacing(0);
    hPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
    addButton = new Button("增加");
    hPanel.add(addButton);
    deleteButton = new Button("删除");
    hPanel.add(deleteButton);
    contentTable.getCellFormatter().addStyleName(0, 0, "contacts-ListMenu");
    contentTable.setWidget(0, 0, hPanel);

    contactsTable = new FlexTable();
    contactsTable.setCellSpacing(0);
    contactsTable.setCellPadding(0);
    contactsTable.setWidth("100%");
    contactsTable.addStyleName("contacts-ListContents");
    contactsTable.getColumnFormatter().setWidth(0, "15px");
    contentTable.setWidget(1, 0, contactsTable);

    contentTableDecorator.add(contentTable);
  }
Ejemplo n.º 6
0
    public Widget getTable(TermMoveObject tmObj) {
      if (!tmObj.isTermListEmpty()) {
        HashMap<String, ArrayList<TermObject>> termList = tmObj.getTermList();
        HashMap<String, TermRelationshipObject> termRelList = tmObj.getTermRelList();

        ArrayList<String> termlanglist = new ArrayList<String>(termList.keySet());
        ArrayList<String> sortedlanglist = new ArrayList<String>();
        for (LanguageCode langCode : MainApp.languageCode) {
          String lang = langCode.getLanguageCode().toLowerCase();

          if (termlanglist.contains(lang)) {
            termlanglist.remove(lang);
            if (MainApp.userPreference.isHideNonselectedlanguages()) {
              if (!MainApp.userSelectedLanguage.contains(lang)) {
                lang = "";
              }
            }
            if (!lang.equals("")) sortedlanglist.add(lang);
          }
        }
        sortedlanglist.addAll(termlanglist);

        FlexTable table = new FlexTable();
        table.setWidget(0, 0, new HTML(constants.conceptLanguage()));
        table.setWidget(0, 1, new HTML("&nbsp;"));

        table.getColumnFormatter().setWidth(1, "80%");
        int i = 1;
        for (String language : sortedlanglist) {
          table.setWidget(
              i, 0, new HTML(getFullnameofLanguage(language) + " (" + language.toString() + ")"));
          ArrayList<TermObject> list = (ArrayList<TermObject>) termList.get(language);
          table.setWidget(i, 1, getTermTable(list, termRelList));
          i++;
        }

        VerticalPanel panel = new VerticalPanel();
        String str =
            "This action will move following terms in different languages and remove all their current relationships with other terms if exists. Please click browse button to select the new concept and click OK button to move or Cancel button to cancel the task?";
        HTML msg = new HTML(str);
        HorizontalPanel msghp = new HorizontalPanel();
        msghp.setStyleName("language-message");
        msghp.add(msg);
        msghp.setSpacing(10);
        panel.add(msg);
        panel.add(getConceptBrowseButton());
        panel.add(
            GridStyle.setTableConceptDetailStyleTop(
                table, "gstFR1", "gstFC1", "gstR1", "gstPanel1", true));
        panel.setWidth("100%");
        return panel;

      } else {
        Label sayNo = new Label(constants.conceptNoTerm());
        return sayNo;
      }
    }
Ejemplo n.º 7
0
  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++;
    }
  }
Ejemplo n.º 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");
  }
  public TournamentPoolPanel() {
    super("Pooler");

    poolCounts = new int[3];
    lblPoolCountTotal = new Label();
    lblPoolCount2 = new Label();
    lblPoolCount3 = new Label();
    lblPoolCount4 = new Label();

    poolGrid = new FlexTable();

    poolGrid.setText(0, 0, "Poolstorlek");
    lbPoolSize = new ListBox();
    lbPoolSize.addItem("2", "2");
    lbPoolSize.addItem("3", "3");
    lbPoolSize.setSelectedIndex(1);
    lbPoolSize.addChangeListener(
        new ChangeListener() {

          public void onChange(Widget sender) {
            updateControls();
          }
        });
    poolGrid.setWidget(0, 1, lbPoolSize);
    poolGrid.getFlexCellFormatter().setColSpan(0, 1, 3);

    poolGrid.setText(1, 0, "Vid udda deltagare");
    FlowPanel prefersLargerPanel = new FlowPanel();
    rbPreferLarger = new RadioButton("rePreferringLarger", "Föredrar större pooler");
    rbPreferLarger.setChecked(true);
    rbPreferSmaller = new RadioButton("rePreferringLarger", "Föredrar mindre pooler");
    prefersLargerPanel.add(rbPreferLarger);
    prefersLargerPanel.add(rbPreferSmaller);
    poolGrid.setWidget(1, 1, prefersLargerPanel);
    poolGrid.getFlexCellFormatter().setColSpan(1, 1, 3);

    poolGrid.setText(2, 0, "Antal pooler");
    poolGrid.getFlexCellFormatter().setColSpan(2, 0, 4);

    poolGrid.setText(3, 0, "Totalt");
    poolGrid.setText(3, 1, "2-man");
    poolGrid.setText(3, 2, "3-man");
    poolGrid.setText(3, 3, "4-man");
    poolGrid.setWidget(4, 0, lblPoolCountTotal);
    poolGrid.setWidget(4, 1, lblPoolCount2);
    poolGrid.setWidget(4, 2, lblPoolCount3);
    poolGrid.setWidget(4, 3, lblPoolCount4);

    for (int i = 0; i < 3; ++i) {
      poolGrid.getColumnFormatter().setWidth(i, "25%");
    }

    add(poolGrid);
  }
Ejemplo n.º 10
0
  private VerticalPanel createSearchPanel() {
    VerticalPanel searchPanel = new VerticalPanel();
    searchPanel.setStyleName("pannel-Border");
    searchPanel.setWidth("100%");

    searchTable.getColumnFormatter().setWidth(0, "150em");
    searchTable.setWidget(0, 0, new Label("Model url"));
    searchTable.setWidget(0, 1, modelText);
    modelText.setWidth("400");

    searchTable.setWidget(1, 1, createButtonPanel());
    searchPanel.add(searchTable);

    return searchPanel;
  }
Ejemplo n.º 11
0
  @Override
  public final Updatable update() {
    log.debug("update()");

    table = null;
    wrapper = null;
    rows = null;
    columns = new ArrayList<AColumn>();

    table = new FlexTable();
    table.getElement().setId(getId() + "_table");
    table.setStyleName("goon-ObjectTable");

    wrapper = new BuilderPanel();
    if (isCardStyle()) wrapper.setStyleCard();
    wrapper.setId(getId());
    // wrapper.setSpacing(0);
    if (getColorForMarker() != null) wrapper.addColorMarker(getColorForMarker());
    init(wrapper);
    wrapper.add(table);
    initWrapperAfterTable(wrapper);

    for (AColumn column : columns) {
      column.formatColumn(table.getColumnFormatter());
    }

    onTableAdded(wrapper, table);

    reverseSort = isReverseSort();
    try {
      onUpdate();
    } catch (Exception ex) {
      throw new RuntimeException(Str.getSimpleName(getClass()) + ".onUpdate() failed", ex);
    }

    asWidgetWrapper.clear();
    asWidgetWrapper.add(wrapper);

    return this;
  }
  protected void performAction(final PublisherActions action) {

    String heading = "Ready To Publish?";
    String confirmation = "The following stories will be published";

    switch (action) {
      case KILL:
        heading = "Spike Stories";
        confirmation = "The following stories will be killed";

        break;
      case PUBLISH:
        break;
      case RETURN:
        heading = "Return Stories";
        confirmation = "The following stories will be returned for further editing";
        break;
    }

    final String actionName =
        action == PublisherActions.KILL
            ? "Spike Stories"
            : action == PublisherActions.PUBLISH
                ? "Publish Stories"
                : action == PublisherActions.RETURN ? "Return Stories" : "";

    if (!stories.isEmpty()) {
      HTMLPanel panel = new HTMLPanel(confirmation);
      panel.add(new InlineLabel());
      FlexTable table = new FlexTable();

      int i = 0;
      for (StorySummary dto : stories) {
        int j = 0;
        table.setWidget(i, j++, new HTMLPanel((i + 1) + ""));
        table.setWidget(i, j++, new HTMLPanel("#" + dto.getId()));
        table.setWidget(
            i,
            j++,
            new HTMLPanel(
                dto.getCatchword() + " - " + (dto.getHeadline() == null ? "" : dto.getHeadline())));
        ++i;
      }
      table.getColumnFormatter().setWidth(0, "15px");
      table.getColumnFormatter().setWidth(1, "40px");

      panel.add(table);

      AppManager.showPopUp(
          heading,
          panel,
          new OptionControl() {

            @Override
            public void onSelect(String name) {
              if (name.equals(actionName)) {
                performAction(action, stories);
                hide();
              } else {
                hide();
              }
            }
          },
          actionName,
          "Cancel");
    }
  }
Ejemplo n.º 13
0
  private void initData(ConceptTermObject ctObj) {
    clearPanel();
    attachNewImgButton();
    if (!ctObj.isEmpty()) {
      HashMap<String, ArrayList<TermObject>> termList = ctObj.getTermList();

      ArrayList<String> termlanglist = new ArrayList<String>(termList.keySet());
      ArrayList<String> sortedlanglist = new ArrayList<String>();
      for (LanguageCode langCode : MainApp.languageCode) {
        String lang = langCode.getLanguageCode().toLowerCase();

        if (termlanglist.contains(lang)) {
          termlanglist.remove(lang);
          if (MainApp.userPreference.isHideNonselectedlanguages()) {
            if (!MainApp.userSelectedLanguage.contains(lang)) {
              lang = "";
            }
          }
          if (!lang.equals("")) sortedlanglist.add(lang);
        }
      }
      sortedlanglist.addAll(termlanglist);

      FlexTable table = new FlexTable();
      table.setWidget(0, 0, new HTML(constants.conceptLanguage()));
      table.setWidget(0, 1, new HTML(constants.conceptTerm()));

      table.getColumnFormatter().setWidth(1, "80%");
      int i = 1;
      int count = 0;
      for (String language : sortedlanglist) {
        table.setWidget(
            i, 0, new HTML(getFullnameofLanguage(language) + " (" + language.toString() + ")"));
        ArrayList<TermObject> list = (ArrayList<TermObject>) termList.get(language);
        table.setWidget(i, 1, getTermTable(list));
        i++;
        count += list.size();
      }
      if (conceptObject.getBelongsToModule() == ConceptObject.CONCEPTMODULE)
        conceptDetailPanel
            .tabPanel
            .getTabBar()
            .setTabHTML(
                ConceptTab.TERM.getTabIndex(),
                Convert.replaceSpace(
                        (count) > 1 ? constants.conceptTerms() : constants.conceptTerm())
                    + "&nbsp;("
                    + (count)
                    + ")");
      if (conceptObject.getBelongsToModule() == ConceptObject.CLASSIFICATIONMODULE)
        classificationDetailPanel
            .tab2Panel
            .getTabBar()
            .setTabHTML(
                ConceptTab.TERM.getTabIndex(),
                Convert.replaceSpace(
                        (count) > 1 ? constants.conceptTerms() : constants.conceptTerm())
                    + "&nbsp;("
                    + (count)
                    + ")");
      conceptRootPanel.add(
          GridStyle.setTableConceptDetailStyleTop(
              table, "gstFR1", "gstFC1", "gstR1", "gstPanel1", true));
    } else {
      Label sayNo = new Label(constants.conceptNoTerm());
      if (conceptObject.getBelongsToModule() == ConceptObject.CONCEPTMODULE)
        conceptDetailPanel
            .tabPanel
            .getTabBar()
            .setTabHTML(
                ConceptTab.TERM.getTabIndex(),
                Convert.replaceSpace(constants.conceptTerm()) + "&nbsp;(0)");
      if (conceptObject.getBelongsToModule() == ConceptObject.CLASSIFICATIONMODULE)
        classificationDetailPanel
            .tab2Panel
            .getTabBar()
            .setTabHTML(
                ConceptTab.TERM.getTabIndex(),
                Convert.replaceSpace(constants.conceptTerm()) + "&nbsp;(0)");
      conceptRootPanel.add(sayNo);
      conceptRootPanel.setCellHorizontalAlignment(sayNo, HasHorizontalAlignment.ALIGN_CENTER);
    }
  }
Ejemplo n.º 14
0
  /** {@inheritDoc} */
  @SuppressWarnings("unchecked")
  public void setMappings(List<DefinitionMapping> mappings) {
    table.removeAllRows();
    definitionsPanels.clear();
    includeCheckBoxes.clear();
    targetWidgets.clear();
    definitions.clear();

    setupTableHeaders(includeTargetColumn);

    table.getColumnFormatter().setWidth(DEFINITION_COLUMN, "100%");
    // table.getColumnFormatter().setWidth(ARROW_COLUMN, "70px");

    if (mappings.isEmpty()) {
      Label noAttributesLabel = new Label("No attributes or links");
      table.setWidget(1, 0, noAttributesLabel);
      table.getFlexCellFormatter().setColSpan(1, 0, includeTargetColumn ? 3 : 4);
      table.getFlexCellFormatter().setStyleName(1, 0, style.emptyCell());

    } else {
      FlexCellFormatter cellFormatter = table.getFlexCellFormatter();
      for (DefinitionMapping mapping : mappings) {

        final int row = table.getRowCount();
        UIDefinition definition = mapping.getDefinition();
        definitions.add(definition);

        DefinitionPanel definitionPanel = new DefinitionPanel();
        definitionPanel.setDefinition(definition);
        definitionPanel.setEnabled(mapping.isMapped());

        definitionsPanels.add(definitionPanel);
        table.setWidget(row, DEFINITION_COLUMN, definitionPanel);
        cellFormatter.setVerticalAlignment(
            row, DEFINITION_COLUMN, HasVerticalAlignment.ALIGN_MIDDLE);

        final SimpleCheckBox includeCheckBox = new SimpleCheckBox();
        includeCheckBox.setStyleName(
            CommonResources.INSTANCE.css().simpleCheckbox() + " " + style.checkbox());
        includeCheckBox.addClickHandler(
            new ClickHandler() {

              @Override
              public void onClick(ClickEvent event) {
                setInclude(row, includeCheckBox.getValue());
              }
            });

        includeCheckBox.setValue(mapping.isMapped());
        table.setWidget(row, INCLUDE_COLUMN, includeCheckBox);
        cellFormatter.setVerticalAlignment(row, INCLUDE_COLUMN, HasVerticalAlignment.ALIGN_MIDDLE);
        includeCheckBoxes.add(includeCheckBox);

        Widget targetWidget = widgetProvider.getTargetWidget((T) mapping.getTarget());

        if (targetWidget != null) {

          Image arrow = new Image(Resources.INSTANCE.arrow());
          arrow.setStyleName(style.arrow());
          table.setWidget(row, ARROW_COLUMN, arrow);
          cellFormatter.setVerticalAlignment(row, ARROW_COLUMN, HasVerticalAlignment.ALIGN_MIDDLE);
          // table.getCellFormatter().setWidth(row, ARROW_COLUMN, "60px");
          table.getCellFormatter().setHeight(row, ARROW_COLUMN, "40px");

          widgetProvider.include(targetWidget, mapping.isMapped());

          table.setWidget(row, TARGET_COLUMN, targetWidget);
          cellFormatter.setVerticalAlignment(row, TARGET_COLUMN, HasVerticalAlignment.ALIGN_MIDDLE);
          targetWidgets.add(targetWidget);
        }
      }
    }
  }
Ejemplo n.º 15
0
  @Override
  protected void initCenterPanel() {

    FlexTable flexTable = new FlexTable();

    flexTable.getColumnFormatter().setWidth(0, "60px");
    flexTable.getColumnFormatter().setWidth(1, "160px");
    flexTable.getColumnFormatter().setWidth(2, "700px");

    backButton = new Button();
    backButton.addStyleName(Utils.sandboxStyle.appBackButton());
    backButton.getElement().getStyle().setHeight(180, Unit.PX);
    setBackButton(backButton);

    flexTable.setWidget(0, 0, backButton);
    flexTable.getFlexCellFormatter().setRowSpan(0, 0, 2);
    flexTable.getFlexCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP);

    projectTitleLabel = new Label();
    projectTitleLabel.addStyleName(Utils.sandboxStyle.contentTitleLabel());
    projectTitleLabel.getElement().getStyle().setPaddingBottom(15, Unit.PX);

    flexTable.setWidget(0, 1, projectTitleLabel);
    flexTable.getFlexCellFormatter().setColSpan(0, 1, 2);
    flexTable.getFlexCellFormatter().setHeight(0, 1, "51px");

    VerticalPanel iconAndButtons = new VerticalPanel();
    iconAndButtons.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);

    applicationImage = new Image();
    iconAndButtons.add(applicationImage);

    VerticalPanel buttonsPanel = new VerticalPanel();
    buttonsPanel.getElement().getStyle().setPaddingTop(30, Unit.PX);
    buttonsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    buttonsPanel.setWidth("100%");

    getSourceButton = new Button(Utils.constants.getSourceCode());
    getSourceButton.setSize("128px", "32px");
    getSourceButton.getElement().getStyle().setPaddingTop(0, Unit.PX);
    getSourceButton.getElement().getStyle().setPaddingBottom(0, Unit.PX);
    getSourceButton.getElement().getStyle().setFontWeight(FontWeight.BOLD);
    getBinaryButton = new Button(Utils.constants.getBinary());
    getBinaryButton.setSize("128px", "32px");
    getBinaryButton.getElement().getStyle().setPaddingTop(0, Unit.PX);
    getBinaryButton.getElement().getStyle().setPaddingBottom(0, Unit.PX);
    getBinaryButton.getElement().getStyle().setFontWeight(FontWeight.BOLD);

    buttonsPanel.add(getSourceButton);
    SimplePanel spacingPanel = new SimplePanel();
    spacingPanel.setHeight("10px");
    buttonsPanel.add(spacingPanel);
    buttonsPanel.add(getBinaryButton);

    iconAndButtons.add(buttonsPanel);

    flexTable.setWidget(1, 0, iconAndButtons);
    flexTable.getFlexCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_TOP);

    FlexTable appDetailsPanel = new FlexTable();
    appDetailsPanel.getColumnFormatter().setWidth(0, "90px");
    appDetailsPanel.getColumnFormatter().setWidth(1, "610px");

    descriptionLabel = new Label();
    descriptionLabel.addStyleName(Utils.sandboxStyle.descriptionLabel());
    appDetailsPanel.setWidget(0, 0, descriptionLabel);
    appDetailsPanel.getFlexCellFormatter().setColSpan(0, 0, 2);

    Label platformLabel = new Label(Utils.constants.platform());
    platformLabel.addStyleName(Utils.sandboxStyle.contentLabel());
    appDetailsPanel.setWidget(1, 0, platformLabel);
    appDetailsPanel.getFlexCellFormatter().getElement(1, 0).getStyle().setPaddingTop(15, Unit.PX);
    appDetailsPanel
        .getFlexCellFormatter()
        .setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_MIDDLE);

    targetPlatformPanel = new HorizontalPanel();
    appDetailsPanel.setWidget(1, 1, targetPlatformPanel);
    appDetailsPanel.getFlexCellFormatter().getElement(1, 1).getStyle().setPaddingTop(15, Unit.PX);
    appDetailsPanel
        .getFlexCellFormatter()
        .setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_MIDDLE);

    Label featuresLabel = new Label(Utils.constants.features());
    featuresLabel.addStyleName(Utils.sandboxStyle.contentLabel());
    appDetailsPanel.setWidget(2, 0, featuresLabel);
    appDetailsPanel.getFlexCellFormatter().getElement(2, 0).getStyle().setPaddingTop(10, Unit.PX);
    appDetailsPanel
        .getFlexCellFormatter()
        .setVerticalAlignment(2, 0, HasVerticalAlignment.ALIGN_MIDDLE);

    featuresPanel = new HorizontalPanel();
    appDetailsPanel.setWidget(2, 1, featuresPanel);
    appDetailsPanel.getFlexCellFormatter().getElement(2, 1).getStyle().setPaddingTop(10, Unit.PX);
    appDetailsPanel
        .getFlexCellFormatter()
        .setVerticalAlignment(2, 1, HasVerticalAlignment.ALIGN_MIDDLE);

    projectDetailsPanel = new HTML();
    projectDetailsPanel.addStyleName(Utils.sandboxStyle.projectDetails());
    projectDetailsPanel.getElement().getStyle().setPaddingTop(15, Unit.PX);

    appDetailsPanel.setWidget(3, 0, projectDetailsPanel);
    appDetailsPanel.getFlexCellFormatter().setColSpan(3, 0, 2);

    flexTable.setWidget(1, 1, appDetailsPanel);
    flexTable.getFlexCellFormatter().setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_TOP);

    detailsPanel.add(flexTable);
  }
  /** 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);
    }
  }
Ejemplo n.º 17
0
  private void initLayout() {

    table = new FlexTable();
    table.setWidth("100%");

    HTML conceptLab = new HTML(constants.exportConcept());
    HTML exportLab = new HTML(constants.exportFormat());
    HTML schemeLab = new HTML(constants.exportScheme());
    HTML dateLab = new HTML(constants.exportDate());
    HTML termCodeLab = new HTML(constants.exportTermCode());

    conceptLab.setWordWrap(false);
    exportLab.setWordWrap(false);
    schemeLab.setWordWrap(false);
    dateLab.setWordWrap(false);
    termCodeLab.setWordWrap(false);

    table.setWidget(0, 0, schemeLab);
    table.setWidget(0, 1, getScheme());
    table.setWidget(1, 0, conceptLab);
    table.setWidget(1, 1, getConcept());
    table.setWidget(2, 0, exportLab);
    table.setWidget(2, 1, getExportFormat());
    // table.setWidget(3, 0, termCodeLab);
    // table.setWidget(3, 1, getTermCode());
    // table.setWidget(4, 0, dateLab);
    // table.setWidget(4, 1, getDatePanel());

    table.getColumnFormatter().setWidth(0, "15%");
    table.getColumnFormatter().setWidth(1, "75%");

    final VerticalPanel exportOption = new VerticalPanel();
    exportOption.setSize("100%", "100%");
    exportOption.add(GridStyle.setTableRowStyle(table, "#F4F4F4", "#E8E8E8", 3));

    final Button export = new Button(constants.exportButton());
    final CheckBox chkZip = new CheckBox(constants.exportUseZip());

    HorizontalPanel bottombar = new HorizontalPanel();
    bottombar.setSpacing(5);
    bottombar.add(chkZip);
    bottombar.add(export);
    bottombar.setSize("100%", "100%");
    bottombar.setStyleName("bottombar");
    bottombar.setCellHorizontalAlignment(chkZip, HasHorizontalAlignment.ALIGN_LEFT);
    bottombar.setCellHorizontalAlignment(export, HasHorizontalAlignment.ALIGN_RIGHT);
    bottombar.setCellVerticalAlignment(export, HasVerticalAlignment.ALIGN_MIDDLE);

    // ButtonbarWidget bottomBarPanel = new ButtonbarWidget(null, bottombar);

    /*ld.setSize("100%", "100%");
    spacer.setSize("100%", "100%");
    spacer.setCellHorizontalAlignment(ld, HasHorizontalAlignment.ALIGN_CENTER);
    spacer.setCellVerticalAlignment(ld, HasVerticalAlignment.ALIGN_MIDDLE);

     Window.addResizeHandler(new ResizeHandler()
        {
        	public void onResize(ResizeEvent event) {
        		spacer.setSize("100%", "100%");
    		}
    	});*/

    VerticalPanel optionPanel = new VerticalPanel();
    optionPanel.setSize("100%", "100%");
    optionPanel.setStyleName("borderbar");
    optionPanel.add(exportOption);
    // optionPanel.add(spacer);
    optionPanel.add(bottombar);
    // optionPanel.setCellHeight(spacer, "100%");
    optionPanel.setCellVerticalAlignment(exportOption, HasVerticalAlignment.ALIGN_TOP);
    optionPanel.setCellVerticalAlignment(bottombar, HasVerticalAlignment.ALIGN_BOTTOM);

    HorizontalPanel langPanel = new HorizontalPanel();
    /*Image img = new Image("images/map-grey.gif");
    final Label lang = new Label(constants.exportSelectLang());
    lang.setSize("150", "100%");
    lang.setStyleName("displayexportLang");
    lang.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    lang.addClickHandler(new ClickHandler() {
    	public void onClick(ClickEvent event) {
    		if(selectLanguage == null || !selectLanguage.isLoaded)
    			selectLanguage = new SelectLanguage();
    		selectLanguage.show();
    	}
    });

    langPanel.setSize("10%", "100%");
    langPanel.add(img);
    langPanel.add(new HTML("&nbsp;"));
    langPanel.add(lang);
    langPanel.add(new HTML("&nbsp;"));
    langPanel.add(new HTML("&nbsp;"));
    langPanel.setCellWidth(lang, "100%");
    langPanel.setCellHeight(lang, "100%");
    langPanel.setCellVerticalAlignment(img, HasVerticalAlignment.ALIGN_MIDDLE);
    langPanel.setCellVerticalAlignment(lang, HasVerticalAlignment.ALIGN_MIDDLE);
    langPanel.setCellHorizontalAlignment(lang, HasHorizontalAlignment.ALIGN_RIGHT);
    langPanel.setSpacing(1);*/

    VerticalPanel tempmainPanel = new VerticalPanel();
    tempmainPanel.setSpacing(10);
    tempmainPanel.add(optionPanel);

    BodyPanel mainPanel = new BodyPanel(constants.exportTitle(), tempmainPanel, langPanel);

    mainBodypanel.setSize("100%", "100%");
    mainBodypanel.add(mainPanel);
    mainBodypanel.setCellHorizontalAlignment(mainPanel, HasHorizontalAlignment.ALIGN_CENTER);
    mainBodypanel.setCellVerticalAlignment(mainPanel, HasVerticalAlignment.ALIGN_TOP);
    mainBodypanel.setCellWidth(mainPanel, "100%");
    mainBodypanel.setCellHeight(mainPanel, "100%");

    panel.clear();
    panel.setSize("100%", "100%");
    panel.add(mainBodypanel);
    panel.add(loadingDialog);
    panel.setCellHorizontalAlignment(mainPanel, HasHorizontalAlignment.ALIGN_CENTER);
    panel.setCellVerticalAlignment(mainPanel, HasVerticalAlignment.ALIGN_TOP);
    showLoading(false);

    // =================

    export.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            if (!format.getValue((format.getSelectedIndex())).equals("")
                && !format.getValue(format.getSelectedIndex()).equals("--None--")) {
              exp.setFormat(format.getValue(format.getSelectedIndex()));
            } else {
              exp.setFormat(null);
            }
            String expformat = exp.getFormat();
            if (expformat == null || expformat.equals("")) {
              Window.alert(constants.exportSelectFormat());
            } else if (exp.getStartDate() != null || exp.getEndDate() != null) {
              if (exp.getStartDate() == null || exp.getEndDate() == null) {
                Window.alert(constants.exportSelectDateRange());
              }
            } else {
              showLoading(true);
              exp.setExpLanguage(userSelectedLanguage);
              exp.setTermCode(termCodeBox.getValue().equals("") ? null : termCodeBox.getValue());

              AsyncCallback<String> callback =
                  new AsyncCallback<String>() {
                    public void onSuccess(String key) {
                      String formattype = format.getValue(format.getSelectedIndex());

                      String filename =
                          "export_"
                              + formattype.toLowerCase()
                              + "_"
                              + DateTimeFormat.getFormat("ddMMyyyyhhmmss").format(new Date());

                      if (formattype.equals(ExportFormat.SKOS)
                          || formattype.equals(ExportFormat.SKOSXL)) filename += ".rdf";
                      else if (formattype.equals(ExportFormat.TBX)) filename += ".tbx";
                      else if (formattype.equals(ExportFormat.OWL_SIMPLE_FORMAT))
                        filename += ".owl";
                      else if (formattype.equals(ExportFormat.OWL_COMPLETE_FORMAT))
                        filename += ".owl";
                      else if (formattype.equals(ExportFormat.RDBMS_SQL_FORMAT)) filename += ".sql";

                      Window.open(
                          GWT.getHostPageBaseURL()
                              + "downloadExportData?filename="
                              + filename
                              + "&key="
                              + key
                              + "&size="
                              + ConfigConstants.ZIPSIZE
                              + "&forcezip="
                              + chkZip.getValue(),
                          "_download",
                          "");
                      showLoading(false);
                    }

                    public void onFailure(Throwable caught) {
                      showLoading(false);
                      ExceptionManager.showException(caught, constants.exportDataFail());
                    }
                  };
              Service.exportService.export(exp, MainApp.userId, 74, MainApp.userOntology, callback);
            }
          }
        });
  }
  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%");
  }