コード例 #1
0
  public GridLayout getGridView(String[] headerTable) {

    List reportData = report.dataReport();
    if (reportData.isEmpty()) {
      return new GridLayout();
    }

    GridLayout grid = new GridLayout(1, 2 * reportData.size());

    Iterator iterator = reportData.iterator();
    while (iterator.hasNext()) {
      Object[] row = (Object[]) iterator.next();

      for (int i = 0; i < row.length - 1; i++) {
        grid.addComponent(new Label(row[i].toString()));
      }

      Table table = fillTable(headerTable, (List) row[row.length - 1]);
      table.setWidth("100%");
      grid.addComponent(table);
      grid.setComponentAlignment(
          table, new Alignment(Bits.ALIGNMENT_VERTICAL_CENTER | Bits.ALIGNMENT_HORIZONTAL_CENTER));
    }

    return grid;
  }
コード例 #2
0
  @AutoGenerated
  private VerticalLayout buildVerticalLayout_2() {
    // common part: create layout
    verticalLayout_2 = new VerticalLayout();
    verticalLayout_2.setImmediate(false);
    verticalLayout_2.setWidth("-1px");
    verticalLayout_2.setHeight("-1px");
    verticalLayout_2.setMargin(false);

    // label_1
    label_1 = new Label();
    label_1.setStyleName("h1");
    label_1.setImmediate(false);
    label_1.setWidth("-1px");
    label_1.setHeight("-1px");
    label_1.setValue("Filtro de Busqueda de Usuarios");
    verticalLayout_2.addComponent(label_1);

    // horizontalLayout_3
    horizontalLayout_3 = buildHorizontalLayout_3();
    verticalLayout_2.addComponent(horizontalLayout_3);

    // tblUsuarios
    tblUsuarios = new Table();
    tblUsuarios.setImmediate(false);
    tblUsuarios.setWidth("650px");
    tblUsuarios.setHeight("430px");
    verticalLayout_2.addComponent(tblUsuarios);

    return verticalLayout_2;
  }
コード例 #3
0
  @AutoGenerated
  private AbsoluteLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new AbsoluteLayout();
    mainLayout.setImmediate(false);
    mainLayout.setWidth("400px");
    mainLayout.setHeight("300px");

    // top-level component properties
    setWidth("400px");
    setHeight("300px");

    // btn_editar
    btn_editar = new Button();
    btn_editar.setCaption("Editar");
    btn_editar.setImmediate(true);
    btn_editar.setWidth("280px");
    btn_editar.setHeight("-1px");
    mainLayout.addComponent(btn_editar, "top:234.0px;left:60.0px;");

    // tableMaterias
    tableMaterias = new Table();
    tableMaterias.setImmediate(false);
    tableMaterias.setWidth("100.0%");
    tableMaterias.setHeight("200px");
    mainLayout.addComponent(tableMaterias, "top:20.0px;right:60.0px;left:60.0px;");

    return mainLayout;
  }
コード例 #4
0
 private void AddressList() {
   contactList.setContainerDataSource(addressBookData);
   contactList.setVisibleColumns(visibleCols);
   contactList.setSelectable(true);
   contactList.setImmediate(true);
   contactList.setWidth("380px");
   contactList.setHeight("190px");
 }
コード例 #5
0
  /**
   * Build content 'evaluation process' of tab 3.
   *
   * @return content of third tab
   */
  private Layout buildTab3Content() {
    VerticalLayout tab3Content = new VerticalLayout();
    tab3Content.setSpacing(true);
    tab3Content.setMargin(true);
    tab3Content.setSizeFull();

    Label instructions =
        new Label(
            "<b>Instructions:</b> <i>Please select and click a sentence below in order to process the evaluation.</i>",
            Label.CONTENT_XHTML);
    tab3Content.addComponent(instructions);

    this.tableEvaluation = new Table("Evaluation process:");
    tableEvaluation.setHeight("150px");
    tableEvaluation.setWidth("100%");
    tableEvaluation.setImmediate(true);
    tableEvaluation.setSelectable(true);
    tableEvaluation.setMultiSelect(false);
    tableEvaluation.setSortDisabled(false);
    tableEvaluation.addContainerProperty("ID", Integer.class, null);
    tableEvaluation.addContainerProperty("Sentence", String.class, null);
    tableEvaluation.addContainerProperty("Precision", Double.class, null);
    tableEvaluation.addContainerProperty("Recall", Double.class, null);
    tableEvaluation.addContainerProperty("F-Score", Double.class, null);
    tab3Content.addComponent(tableEvaluation);

    this.buttonNext2 = new Button("Next");
    buttonNext2.setImmediate(true);
    buttonNext2.setDescription("Get the next sentence in table");
    tab3Content.addComponent(buttonNext2);

    this.textAreaEvalSentence = new TextArea("Sentence:");
    textAreaEvalSentence.setImmediate(false);
    textAreaEvalSentence.setReadOnly(true);
    textAreaEvalSentence.setRows(3);
    textAreaEvalSentence.setWidth("100%");
    tab3Content.addComponent(textAreaEvalSentence);

    HorizontalLayout hlay1 = new HorizontalLayout();
    this.listSelectGoldstandard = new ListSelect("Goldstandard:");
    listSelectGoldstandard.setImmediate(true);
    listSelectGoldstandard.setHeight("120px");
    listSelectGoldstandard.setWidth("100%");
    listSelectGoldstandard.setNullSelectionAllowed(false);
    this.listSelectFramework = new ListSelect("Framework:");
    listSelectFramework.setImmediate(true);
    listSelectFramework.setHeight("120px");
    listSelectFramework.setWidth("100%");
    listSelectFramework.setNullSelectionAllowed(false);
    hlay1.setSpacing(true);
    hlay1.setMargin(false);
    hlay1.setWidth("100%");
    hlay1.addComponent(listSelectGoldstandard);
    hlay1.addComponent(listSelectFramework);
    tab3Content.addComponent(hlay1);

    return tab3Content;
  }
コード例 #6
0
  protected void addVariables() {
    Label header = new Label(i18nManager.getMessage(Messages.PROCESS_INSTANCE_HEADER_VARIABLES));
    header.addStyleName(ExplorerLayout.STYLE_H3);
    header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
    header.addStyleName(ExplorerLayout.STYLE_NO_LINE);
    panelLayout.addComponent(header);

    panelLayout.addComponent(new Label("&nbsp;", Label.CONTENT_XHTML));

    // variable sorting is done in-memory (which is ok, since normally there aren't that many vars)
    Map<String, Object> variables =
        new TreeMap<String, Object>(runtimeService.getVariables(processInstance.getId()));

    if (variables.size() > 0) {

      Table variablesTable = new Table();
      variablesTable.setWidth(60, UNITS_PERCENTAGE);
      variablesTable.addStyleName(ExplorerLayout.STYLE_PROCESS_INSTANCE_TASK_LIST);

      variablesTable.addContainerProperty(
          "name",
          String.class,
          null,
          i18nManager.getMessage(Messages.PROCESS_INSTANCE_VARIABLE_NAME),
          null,
          Table.ALIGN_LEFT);
      variablesTable.addContainerProperty(
          "value",
          String.class,
          null,
          i18nManager.getMessage(Messages.PROCESS_INSTANCE_VARIABLE_VALUE),
          null,
          Table.ALIGN_LEFT);

      for (String variable : variables.keySet()) {
        Item variableItem = variablesTable.addItem(variable);
        variableItem.getItemProperty("name").setValue(variable);

        // Get string value to show
        String theValue = variableRendererManager.getStringRepresentation(variables.get(variable));
        variableItem.getItemProperty("value").setValue(theValue);
      }

      variablesTable.setPageLength(variables.size());
      panelLayout.addComponent(variablesTable);
    } else {
      Label noVariablesLabel =
          new Label(i18nManager.getMessage(Messages.PROCESS_INSTANCE_NO_VARIABLES));
      panelLayout.addComponent(noVariablesLabel);
    }
  }
コード例 #7
0
  @SuppressWarnings("deprecation")
  private Table getFractionTable(Map<Integer, ProteinBean> proteinFractionAvgList) {
    Table table = new Table();
    table.setStyleName(Reindeer.TABLE_STRONG + " " + Reindeer.TABLE_BORDERLESS);
    table.setHeight("150px");
    table.setWidth("100%");
    table.setSelectable(true);
    table.setColumnReorderingAllowed(true);
    table.setColumnCollapsingAllowed(true);
    table.setImmediate(true); // react at once when something is selected
    table.addContainerProperty(
        "Fraction Index",
        Integer.class,
        null,
        "Fraction Index",
        null,
        com.vaadin.ui.Table.ALIGN_CENTER);
    table.addContainerProperty(
        "# Peptides ", Integer.class, null, "# Peptides ", null, com.vaadin.ui.Table.ALIGN_CENTER);
    table.addContainerProperty(
        "# Spectra ", Integer.class, null, "# Spectra", null, com.vaadin.ui.Table.ALIGN_CENTER);
    table.addContainerProperty(
        "Average Precursor Intensity",
        Double.class,
        null,
        "Average Precursor Intensity",
        null,
        com.vaadin.ui.Table.ALIGN_CENTER);
    /* Add a few items in the table. */
    int x = 0;
    for (int index : proteinFractionAvgList.keySet()) {
      ProteinBean pb = proteinFractionAvgList.get(index);
      table.addItem(
          new Object[] {
            new Integer(index),
            pb.getNumberOfPeptidePerFraction(),
            pb.getNumberOfSpectraPerFraction(),
            pb.getAveragePrecursorIntensityPerFraction()
          },
          new Integer(x + 1));
      x++;
    }
    for (Object propertyId : table.getSortableContainerPropertyIds()) {
      table.setColumnExpandRatio(propertyId.toString(), 1.0f);
    }

    return table;
  }
コード例 #8
0
  @AutoGenerated
  private AbsoluteLayout buildAbsLTabla() {
    // common part: create layout
    absLTabla = new AbsoluteLayout();
    absLTabla.setImmediate(false);
    absLTabla.setWidth("100.0%");
    absLTabla.setHeight("265px");

    // tblAvance
    tblAvance = new Table();
    tblAvance.setCaption("* Dar doble click sobre un elemento para modificarlo");
    tblAvance.setImmediate(false);
    tblAvance.setWidth("425px");
    tblAvance.setHeight("225px");
    absLTabla.addComponent(tblAvance, "top:28.0px;left:10.0px;");

    return absLTabla;
  }
コード例 #9
0
  @AutoGenerated
  private VerticalLayout buildVerticalLayout_1() {
    // common part: create layout
    verticalLayout_1 = new VerticalLayout();
    verticalLayout_1.setImmediate(false);
    verticalLayout_1.setWidth("100.0%");
    verticalLayout_1.setHeight("100.0%");
    verticalLayout_1.setMargin(false);

    // gameResultTable
    gameResultTable = new Table();
    gameResultTable.setImmediate(false);
    gameResultTable.setWidth("100.0%");
    gameResultTable.setHeight("100.0%");
    verticalLayout_1.addComponent(gameResultTable);
    verticalLayout_1.setExpandRatio(gameResultTable, 1.0f);

    return verticalLayout_1;
  }
コード例 #10
0
  public WindowTimtheobomon() {

    setCaption("Tìm theo bộ môn "); // Constants.USER_CAPTION) ;

    HorizontalLayout mainLayout = new HorizontalLayout();
    mainLayout.setImmediate(false);
    mainLayout.setWidth(Constants.WIDTH_MAX, Sizeable.UNITS_PIXELS);
    mainLayout.setMargin(false);
    mainLayout.setSpacing(true);

    mainLayout.addComponent(new leftSide());
    rContent = new VerticalLayout();
    rContent.setWidth("100%");

    mainLayout.addComponent(rContent);
    mainLayout.setExpandRatio(rContent, 1.0f);

    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setStyleName("bl-mainContent");
    v.addComponent(mainLayout);
    v.setComponentAlignment(mainLayout, Alignment.MIDDLE_CENTER);

    addComponent(new topLogin());
    addComponent(new topPanel());
    addComponent(new mainMenu());
    addComponent(v);
    addComponent(new bottom());

    // --------------------bl
    Label title = new Label("<center><h1>Tìm theo bộ môn<h1></center>", Label.CONTENT_XHTML);

    final BeanItemContainer<ResearchingBean> beans =
        new BeanItemContainer<ResearchingBean>(ResearchingBean.class);

    Table table = new Table("Tìm kiếm", beans);

    table.setWidth("100%");
    table.setPageLength(10);

    rContent.addComponent(title);
    rContent.addComponent(table);
  }
コード例 #11
0
  public TableChangingDatasource() {
    final VerticalLayout main = new VerticalLayout();

    main.addComponent(new Label("Table should look sane after data source changes"));

    t = new Table();

    t.setWidth("500px");
    t.setHeight("300px");

    ta[0] = TestForTablesInitialColumnWidthLogicRendering.getTestTable(3, 0);
    ta[1] = TestForTablesInitialColumnWidthLogicRendering.getTestTable(3, 7);
    ta[2] = TestForTablesInitialColumnWidthLogicRendering.getTestTable(3, 5);
    ta[3] = TestForTablesInitialColumnWidthLogicRendering.getTestTable(3, 1);

    main.addComponent(t);
    main.addComponent(new Button("switch DS", this));

    setCompositionRoot(main);
  }
コード例 #12
0
  public Table buildTable(TimingsTableDataHolder holder) {
    Table table = new Table();
    table.setWidth("100%");
    table.setPageLength(0);
    table.addStyleName("pq");
    table.setSortEnabled(false);
    table.setFooterVisible(true);
    table.setColumnCollapsingAllowed(true);
    table.setColumnCollapsible(columnNames[0], false);
    table.setColumnCollapsible(columnNames[1], false);
    table.setColumnCollapsible(columnNames[3], false);

    table.setColumnAlignment(columnNames[0], Table.Align.LEFT);
    for (String name : columnNames) {
      table.addContainerProperty(name, String.class, null);
      table.setColumnExpandRatio(name, 2);
    }
    fillTable(table, holder.getTotal(), holder.getRows());

    return table;
  }
コード例 #13
0
  @AutoGenerated
  private VerticalLayout buildPnlPrincipal() {
    // common part: create layout
    pnlPrincipal = new VerticalLayout();
    pnlPrincipal.setImmediate(false);
    pnlPrincipal.setWidth("-1px");
    pnlPrincipal.setHeight("-1px");
    pnlPrincipal.setMargin(false);
    pnlPrincipal.setSpacing(true);

    // lytFormulario1
    lytFormulario1 = buildLytFormulario1();
    pnlPrincipal.addComponent(lytFormulario1);

    // lytFormulario2
    lytFormulario2 = buildLytFormulario2();
    pnlPrincipal.addComponent(lytFormulario2);

    // lytFormulario3
    lytFormulario3 = buildLytFormulario3();
    pnlPrincipal.addComponent(lytFormulario3);

    // btnGuardar
    btnGuardar = new Button();
    btnGuardar.setCaption("Agregar");
    btnGuardar.setImmediate(true);
    btnGuardar.setWidth("-1px");
    btnGuardar.setHeight("-1px");
    pnlPrincipal.addComponent(btnGuardar);
    pnlPrincipal.setComponentAlignment(btnGuardar, new Alignment(20));

    // tblNotificacion
    tblNotificacion = new Table();
    tblNotificacion.setImmediate(false);
    tblNotificacion.setWidth("940px");
    tblNotificacion.setHeight("200px");
    pnlPrincipal.addComponent(tblNotificacion);

    return pnlPrincipal;
  }
コード例 #14
0
  @AutoGenerated
  private VerticalLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new VerticalLayout();
    mainLayout.setImmediate(false);
    mainLayout.setWidth("-1px");
    mainLayout.setHeight("-1px");
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);

    // top-level component properties
    setWidth("-1px");
    setHeight("-1px");

    // horizontalLayout_1
    horizontalLayout_1 = buildHorizontalLayout_1();
    mainLayout.addComponent(horizontalLayout_1);

    // tableFunction
    tableFunction = new Table();
    tableFunction.setCaption("Select A Function");
    tableFunction.setImmediate(false);
    tableFunction.setWidth("100.0%");
    tableFunction.setHeight("-1px");
    tableFunction.setInvalidAllowed(false);
    tableFunction.setRequired(true);
    mainLayout.addComponent(tableFunction);
    mainLayout.setExpandRatio(tableFunction, 1.0f);

    // buttonSelect
    buttonSelect = new Button();
    buttonSelect.setCaption("Select and Continue");
    buttonSelect.setImmediate(true);
    buttonSelect.setWidth("-1px");
    buttonSelect.setHeight("-1px");
    mainLayout.addComponent(buttonSelect);
    mainLayout.setComponentAlignment(buttonSelect, new Alignment(48));

    return mainLayout;
  }
コード例 #15
0
  public void initUI() {
    try {
      setModal(true);
      VerticalLayout layout = (VerticalLayout) this.getContent();
      layout.setMargin(true);
      layout.setSpacing(true);
      layout.setStyleName(Reindeer.LAYOUT_WHITE);

      processesComboBox =
          new ComboBox(
              ProcessbaseApplication.getCurrent().getPbMessages().getString("processToCategory"));
      processesComboBox.setFilteringMode(Filtering.FILTERINGMODE_CONTAINS);
      //            processesComboBox.setItemCaptionPropertyId("name");
      processesComboBox.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_EXPLICIT);
      processesComboBox.setWidth("100%");

      bar.setWidth("100%");
      bar.addComponent(processesComboBox);
      bar.setExpandRatio(processesComboBox, 1);

      addBtn =
          new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnAdd"), this);
      bar.addComponent(addBtn);
      bar.setComponentAlignment(addBtn, Alignment.BOTTOM_RIGHT);

      layout.addComponent(bar);
      layout.addComponent(table);

      deleteBtn =
          new Button(
              ProcessbaseApplication.getCurrent().getPbMessages().getString("btnDelete"), this);
      deleteBtn.setDescription(
          ProcessbaseApplication.getCurrent().getPbMessages().getString("deleteCategory"));
      cancelBtn =
          new Button(
              ProcessbaseApplication.getCurrent().getPbMessages().getString("btnCancel"), this);
      saveBtn =
          new Button(
              ProcessbaseApplication.getCurrent().getPbMessages().getString("btnSave"), this);
      buttons.addButton(deleteBtn);
      buttons.setComponentAlignment(deleteBtn, Alignment.MIDDLE_RIGHT);
      buttons.addButton(saveBtn);
      buttons.setComponentAlignment(saveBtn, Alignment.MIDDLE_RIGHT);
      buttons.setExpandRatio(saveBtn, 1);
      buttons.addButton(cancelBtn);
      buttons.setComponentAlignment(cancelBtn, Alignment.MIDDLE_RIGHT);
      buttons.setMargin(false);
      buttons.setHeight("30px");
      buttons.setWidth("100%");
      addComponent(buttons);
      setWidth("70%");
      //            setHeight("70%");
      setResizable(false);

      table.addContainerProperty(
          "name",
          String.class,
          null,
          ProcessbaseApplication.getCurrent().getPbMessages().getString("tableCaptionProcessName"),
          null,
          null);
      table.setColumnExpandRatio("name", 1);
      table.addContainerProperty(
          "version",
          String.class,
          null,
          ProcessbaseApplication.getCurrent().getPbMessages().getString("tableCaptionVersion"),
          null,
          null);
      table.setColumnWidth("version", 50);
      table.addContainerProperty(
          "deployedBy",
          String.class,
          null,
          ProcessbaseApplication.getCurrent().getPbMessages().getString("tableCaptionDeployedBy"),
          null,
          null);
      table.addContainerProperty(
          "actions",
          TableLinkButton.class,
          null,
          ProcessbaseApplication.getCurrent().getPbMessages().getString("tableCaptionActions"),
          null,
          null);
      table.setColumnWidth("actions", 50);
      table.setSelectable(false);
      table.setImmediate(true);
      table.setWidth("100%");
      table.setPageLength(10);
      refreshTable();
    } catch (Exception ex) {
      ex.printStackTrace();
      showError(ex.getMessage());
    }
  }
コード例 #16
0
  protected void addTasks() {
    Label header = new Label(i18nManager.getMessage(Messages.PROCESS_INSTANCE_HEADER_TASKS));
    header.addStyleName(ExplorerLayout.STYLE_H3);
    header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
    header.addStyleName(ExplorerLayout.STYLE_NO_LINE);
    panelLayout.addComponent(header);

    panelLayout.addComponent(new Label("&nbsp;", Label.CONTENT_XHTML));

    Table taskTable = new Table();
    taskTable.addStyleName(ExplorerLayout.STYLE_PROCESS_INSTANCE_TASK_LIST);
    taskTable.setWidth(100, UNITS_PERCENTAGE);

    // Fetch all tasks
    List<HistoricTaskInstance> tasks =
        historyService
            .createHistoricTaskInstanceQuery()
            .processInstanceId(processInstance.getId())
            .orderByHistoricTaskInstanceEndTime()
            .desc()
            .orderByHistoricTaskInstanceStartTime()
            .desc()
            .list();

    if (tasks.size() > 0) {

      // Finished icon
      taskTable.addContainerProperty(
          "finished", Component.class, null, "", null, Table.ALIGN_CENTER);
      taskTable.setColumnWidth("finished", 22);

      taskTable.addContainerProperty(
          "name",
          String.class,
          null,
          i18nManager.getMessage(Messages.TASK_NAME),
          null,
          Table.ALIGN_LEFT);
      taskTable.addContainerProperty(
          "priority",
          Integer.class,
          null,
          i18nManager.getMessage(Messages.TASK_PRIORITY),
          null,
          Table.ALIGN_LEFT);
      taskTable.addContainerProperty(
          "assignee",
          Component.class,
          null,
          i18nManager.getMessage(Messages.TASK_ASSIGNEE),
          null,
          Table.ALIGN_LEFT);
      taskTable.addContainerProperty(
          "dueDate",
          Component.class,
          null,
          i18nManager.getMessage(Messages.TASK_DUEDATE),
          null,
          Table.ALIGN_LEFT);
      taskTable.addContainerProperty(
          "startDate",
          Component.class,
          null,
          i18nManager.getMessage(Messages.TASK_CREATE_TIME),
          null,
          Table.ALIGN_LEFT);
      taskTable.addContainerProperty(
          "endDate",
          Component.class,
          null,
          i18nManager.getMessage(Messages.TASK_COMPLETE_TIME),
          null,
          Table.ALIGN_LEFT);

      panelLayout.addComponent(taskTable);
      panelLayout.setExpandRatio(taskTable, 1.0f);

      for (HistoricTaskInstance task : tasks) {
        addTaskItem(task, taskTable);
      }

      taskTable.setPageLength(taskTable.size());
    } else {
      // No tasks
      Label noTaskLabel = new Label(i18nManager.getMessage(Messages.PROCESS_INSTANCE_NO_TASKS));
      panelLayout.addComponent(noTaskLabel);
    }
  }
コード例 #17
0
  public AttachedDocumentsSubWindow(
      Window subWindow,
      BeanItem<AttachedDocumentObject> beanItem,
      boolean readonly,
      boolean isNewAttach,
      WebApplicationContext context) {
    this.context = context;
    this.subWindow = subWindow;
    this.beanItem = beanItem;
    this.readonly = readonly;

    setCaption(FactoryI18nManager.getI18nManager().getMessage(Messages.COMMON_ABM_TAB_DOCUMENTS));
    setModal(true);
    setHeight("68%");
    setWidth("40%");
    center();
    setStyleName("pagingButtonBar");

    documentsForm = new AttachedDocumentsForm();
    documentsForm.setFormFieldFactory(new AttachedDocumentsFormFieldFactory());

    fileTable = new Table();
    fileTable.setWidth("500");
    fileTable.setHeight("180");
    fileTable.setSelectable(true);
    fileTable.setImmediate(true);
    fileTable.addContainerProperty(
        FactoryI18nManager.getI18nManager()
            .getMessage(Messages.ATTACHED_DOCUMENT_OBJECT_FILE_TABLE_HEADER_NAME),
        String.class,
        null);
    fileTable.addContainerProperty(
        FactoryI18nManager.getI18nManager()
            .getMessage(Messages.ATTACHED_DOCUMENT_OBJECT_FILE_TABLE_HEADER_SIZE),
        String.class,
        null);
    fileTable.addListener((ValueChangeListener) this);

    footerTable = new HorizontalLayout();
    footerTable.setVisible(true);
    setIconsAndDescriptionButton();

    footerTable.addComponent(buttonNew);
    footerTable.addComponent(buttonDelete);
    footerTable.addComponent(buttonModify);
    footerTable.addComponent(buttonDownload);
    footerTable.addComponent(buttonLookUp);

    verticalLayout.setMargin(true);
    verticalLayout.addComponent(documentsForm);
    verticalLayout.addComponent(new Label("Archivos:"));
    verticalLayout.addComponent(fileTable);
    verticalLayout.addComponent(footerTable);

    horizontalLayout.addComponent(buttonAdd);
    horizontalLayout.setComponentAlignment(buttonAdd, Alignment.BOTTOM_CENTER);
    horizontalLayout.addComponent(buttonCancel);
    horizontalLayout.setComponentAlignment(buttonCancel, Alignment.BOTTOM_CENTER);

    verticalLayout.addComponent(horizontalLayout);
    verticalLayout.setComponentAlignment(horizontalLayout, Alignment.BOTTOM_CENTER);

    setContent(verticalLayout);

    initializeForm();
    initializeTable();

    setComponentsState(isNewAttach);

    setClosable(readonly);
  }
コード例 #18
0
ファイル: GriddemoApplication.java プロジェクト: p4elkin/Grid
  @Override
  public void init() {
    Window mainWindow = new Window("GridDemo");
    mainWindow.getContent().setSizeFull();
    ((VerticalLayout) mainWindow.getContent()).setSpacing(true);
    Indexed c = getTestContainer();
    final Table table = new Table();
    table.setImmediate(true);
    table.setSizeUndefined();
    table.setHeight("100%");
    table.setWidth("100%");
    table.setContainerDataSource(c);
    table.setCacheRate(0.5d);

    table.setNullSelectionAllowed(false);
    final Grid grid = new Grid(c);
    grid.setWidth("100%");
    grid.setHeight("100%");

    mainWindow.addComponent(grid);
    grid.getBody().setCelEditingEnabled(true);
    grid.setColumnWidth("p1", 200);
    grid.setImmediate(true);
    grid.setColumnAlignment("p1", Align.RIGHT);
    grid.setColumnAlignment("p2", Align.CENTER);
    grid.getHeader()
        .setHeaderFactory(
            new HeaderComponentFactory() {
              @Override
              public Component createComponent(final Grid grid, final Object propertyId) {
                final TextField l = new TextField("<b>" + propertyId + "<\b>");
                l.setImmediate(true);
                l.setWidth("100%");
                l.addListener(
                    new ValueChangeListener() {
                      @Override
                      public void valueChange(ValueChangeEvent event) {
                        ((Filterable) grid.getContainerDataSource())
                            .addContainerFilter(
                                new Filter() {

                                  @Override
                                  public boolean passesFilter(Object itemId, Item item)
                                      throws UnsupportedOperationException {
                                    return item.getItemProperty(propertyId)
                                        .getValue()
                                        .toString()
                                        .contains(l.getValue().toString());
                                  }

                                  @Override
                                  public boolean appliesToProperty(Object id) {
                                    return id.equals(propertyId);
                                  }
                                });
                      }
                    });
                return l;
              }
            });
    table.setEditable(true);
    // mainWindow.addComponent(table);
    setMainWindow(mainWindow);
    setTheme("griddemotheme");
  }
コード例 #19
0
ファイル: LinkEvalUi.java プロジェクト: AKSW/linkeval
  private Panel allLinksDetails() {
    // positioning indices
    // final int leftStart=10,topStart=10, space=100;
    // create the panel that will hold all components
    Panel linksDetails = new Panel("Links Details");
    // set panel's properties
    linksDetails.setWidth("100%");
    linksDetails.setHeight("100%");

    // Create absolute layout specifying its properties
    final AbsoluteLayout layout = new AbsoluteLayout();
    // set layout's properties
    layout.setSizeFull();

    // Create components Objects and specify their properties
    Button btnLoad = new Button("Load task");
    // final Table tblSourceDestination = new Table("Source and Destination URIs");
    tblSourceDestination.setSelectable(true);
    tblSourceDestination.setWidth("90%");
    // fill the Source and Destination URIs table
    SQLContainer container = connectToDB("root", "mofo", userName);
    Notification.show("Welcome " + userName + " you loaded task Nr.: " + task);
    Compare.Equal suburbFilter = new Compare.Equal("taskId", Integer.valueOf(task));
    container.addContainerFilter(suburbFilter);
    // Fill the main (tblSourceDestination) table with resources
    tblSourceDestination.setContainerDataSource(container);
    tblSourceDestinationparam = tblSourceDestination;

    // add component to the layout specifying its position on the layout
    int tableWidth = (int) tblSourceDestination.getWidth();
    layout.addComponent(btnLoad, "left:1500px; top: 10px;");
    layout.addComponent(tblSourceDestination, "left: 10px; top: 20px;");

    linksDetails.setContent(layout);
    // Add EventHandlers for some of the components

    btnLoad.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            // lStartTime= System.currentTimeMillis();

            try {
              Object rowId = tblSourceDestination.getValue();
              Property sourceProperty =
                  tblSourceDestination.getContainerProperty(rowId, "sourceURI");
              Property destinationProperty =
                  tblSourceDestination.getContainerProperty(rowId, "destinationURI");

              source.setValue(sourceProperty.toString());
              destination.setValue(destinationProperty.toString());
              tblSourcePropertiesParam.removeAllItems();
              tblDestinationPropertiesParam.removeAllItems();

              Notification loadURI = new Notification("");
              loadURI.show("Links' URIs are successfully loaded ");
            } catch (Exception e) {
              Notification error = new Notification("Error");
              error.show("You did not select an item in the links table");
            }
          }
        });

    tblSourceDestination.addItemClickListener(
        new ItemClickEvent.ItemClickListener() {

          @Override
          public void itemClick(ItemClickEvent event) {
            /*lStartTime= System.currentTimeMillis();

            try
            {
            	Object rowId =tblSourceDestination.getValue();
                Property sourceProperty=tblSourceDestination.getContainerProperty(rowId,"sourceURI");
                Property destinationProperty=tblSourceDestination.getContainerProperty(rowId,"destinationURI");

                source.setValue(sourceProperty.toString());
                destination.setValue(destinationProperty.toString());
                tblSourcePropertiesParam.removeAllItems();
                tblDestinationPropertiesParam.removeAllItems();


                Notification loadURI= new Notification("");
                loadURI.show("Links' URIs are successfully loaded ");
            }
            catch(Exception e)
            {
            	Notification error= new Notification("Error");
            	error.show("You did not select an item in the links table");
            }*/
          }
        });

    return linksDetails;
  }
コード例 #20
0
  public WindowManagerTeacher() {

    setCaption("quan ly bo mon "); // Constants.USER_CAPTION) ;

    mainLayout = new HorizontalLayout();
    mainLayout.setImmediate(false);
    mainLayout.setWidth(Constants.WIDTH_MAX, Sizeable.UNITS_PIXELS);
    mainLayout.setMargin(false);
    mainLayout.setSpacing(true);

    mainLayout.addComponent(new leftSide());

    rContentList = new VerticalLayout();
    rContentList.setWidth("100%");
    mainLayout.addComponent(rContentList);
    mainLayout.setExpandRatio(rContentList, 1.0f);

    rContentModify = new rightContentAddNewTeacher(1);
    rContentModify.setWidth("100%");

    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setStyleName("bl-mainContent");
    v.addComponent(mainLayout);
    v.setComponentAlignment(mainLayout, Alignment.MIDDLE_CENTER);

    addComponent(new topLogin());
    addComponent(new topPanel());
    addComponent(new mainMenu());
    addComponent(v);
    addComponent(new bottom());

    // --------------------bl
    Label title = new Label("<center><h1>Danh sách giang vien<h1></center>", Label.CONTENT_XHTML);

    table = new Table();
    table.setWidth("100%");
    table.setPageLength(20);

    rContentList.addComponent(title);
    rContentList.addComponent(table);

    Connection conn = null;
    Statement stmt = null;

    try {
      JDBCConnectionPool pool =
          new SimpleJDBCConnectionPool(
              JDBC_DRIVER,
              DB_URL + QlgiangvienApplication.DB_DBNAME,
              QlgiangvienApplication.DB_USER,
              QlgiangvienApplication.DB_PASS);

      String mysql = "SELECT * from GiangVien";

      TableQuery query = new TableQuery("GiangVien", pool);
      query.setVersionColumn("OPTLOCK");

      SQLContainer container = new SQLContainer(query);
      container.setAutoCommit(true);
      //          container.re
      table.setContainerDataSource(container);

      //           FreeformQuery query = new FreeformQuery(mysql, pool, "MaGV") ;

      //           container = new SQLContainer(query);

      //           table.setContainerDataSource(container) ;

      table.addGeneratedColumn(
          "Chinh Sua",
          new Table.ColumnGenerator() {
            public Component generateCell(Table source, Object itemId, Object columnId) {
              final Item item = table.getItem(itemId);

              Button btnModify =
                  new Button(
                      "Chinh Sua",
                      new Button.ClickListener() {
                        @Override
                        public void buttonClick(ClickEvent event) {

                          //              				rContentList.setVisible(false);
                          //              				rContentModify.setVisible(true);
                          System.out.println(item.toString());
                          rContentModify.setUpdateData(
                              item.getItemProperty("MaGV").getValue().toString());
                          mainLayout.removeComponent(rContentList);
                          mainLayout.addComponent(rContentModify);
                          mainLayout.setExpandRatio(rContentModify, 1.0f);
                        }
                      });

              return btnModify;
            }
          });
      confirmDelete();
      table.addGeneratedColumn(
          "Xoa",
          new Table.ColumnGenerator() {
            public Component generateCell(Table source, Object itemId, Object columnId) {

              //            	   Item item = table.getItem(itemId);

              Button btnModify =
                  new Button(
                      "Xoa",
                      new Button.ClickListener() {
                        @Override
                        public void buttonClick(ClickEvent event) {

                          if (subwindow.getParent() == null) {

                            getWindow().addWindow(subwindow);
                          }
                        }
                      });

              return btnModify;
            }
          });

    } catch (Exception e) {
      System.out.println("in right COntent: " + e.toString());
    }
  } // end of container
コード例 #21
0
ファイル: PropertiesEditor.java プロジェクト: ecki/jabylon
  protected Component createMainArea() {
    layout = new VerticalLayout();

    layout.setSpacing(true);
    layout.setMargin(true);
    layout.setSizeFull();

    HorizontalLayout filterLine = new HorizontalLayout();

    TextField filterBox = new TextField();
    filterBox.addStyleName(JabylonStyle.SEARCH_FIELD.getCSSName());
    filterBox.addListener(
        new TextChangeListener() {

          @Override
          public void textChange(TextChangeEvent event) {
            propertyFilter.setFilterText(event.getText());
            propertyPairContainer.addContainerFilter(propertyFilter);
          }
        });
    filterBox.setInputPrompt(
        Messages.getString("PropertiesEditor_FILTER_INPUT_PROMPT")); // $NON-NLS-1$
    filterLine.addComponent(filterBox);

    final CheckBox untranslatedBox =
        new CheckBox(
            Messages.getString(
                "PropertiesEditor_SHOW_ONLY_UNTRANSLATED_BUTTON_CAPTION")); //$NON-NLS-1$
    untranslatedBox.addListener(
        new ClickListener() {

          @Override
          public void buttonClick(ClickEvent event) {
            propertyPairContainer.removeContainerFilter(untranslatedFilter);
            if (untranslatedBox.getValue().equals(Boolean.TRUE))
              propertyPairContainer.addContainerFilter(untranslatedFilter);
          }
        });
    untranslatedBox.setImmediate(true);
    filterLine.addComponent(untranslatedBox);

    layout.addComponent(filterLine);
    layout.setExpandRatio(filterLine, 0);

    table = new Table();
    table.addStyleName(JabylonStyle.TABLE_STRIPED.getCSSName());
    table.setSizeFull();
    target = descriptor.loadProperties();
    source = descriptor.getMaster().loadProperties();

    propertyPairContainer = new PropertyPairContainer(source, target);
    table.setContainerDataSource(propertyPairContainer);
    table.setVisibleColumns(
        propertyPairContainer.getContainerPropertyIds().subList(0, 2).toArray());
    table.setWidth(100, Table.UNITS_PERCENTAGE);
    table.addGeneratedColumn(
        Messages.getString("PropertiesEditor_PROBLEMS_COLUMN_HEADER"),
        new ColumnGenerator() { //$NON-NLS-1$

          @Override
          public Object generateCell(Table source, Object itemId, Object columnId) {

            if (reviews.containsKey(itemId)) {
              Embedded embedded = new Embedded("", ImageConstants.IMAGE_ERROR); // $NON-NLS-1$

              Review review = reviews.get((String) itemId).iterator().next();
              // TODO: this can't be the right way to refresh?
              if (review.cdoInvalid()) {
                reviews.remove(itemId, review); // the review is
                // no
                // longer valid
                embedded.setIcon(ImageConstants.IMAGE_OK);
                embedded.setDescription(""); // $NON-NLS-1$
              } else {
                embedded.setDescription(review.getMessage());
              }

              return embedded;
            } else return new Embedded("", ImageConstants.IMAGE_OK); // $NON-NLS-1$
          }
        });

    table.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_EXPLICIT);

    table.setColumnHeaders(
        new String[] {
          Messages.getString("PropertiesEditor_ORIGINAL_COLUMN_HEADER"),
          Messages.getString("PropertiesEditor_TRANSLATED_COLUMN_HEADER"),
          Messages.getString("PropertiesEditor_PROBLEMS_COLUMN_HEADER")
        }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    table.setColumnExpandRatio(propertyPairContainer.getContainerPropertyIds().get(0), 1.0f);
    table.setColumnExpandRatio(propertyPairContainer.getContainerPropertyIds().get(1), 1.0f);
    table.setColumnExpandRatio(
        Messages.getString("PropertiesEditor_PROBLEMS_COLUMN_HEADER"), 0.0f); // $NON-NLS-1$

    table.setEditable(false);
    table.setWriteThrough(false);

    table.setSelectable(true);
    table.setMultiSelect(false);
    table.setImmediate(true); // react at once when something is selected
    table.addListener(this);

    layout.addComponent(table);

    layout.setExpandRatio(table, 2);
    createEditorArea();
    return layout;
  }
コード例 #22
0
ファイル: LinkEvalUi.java プロジェクト: AKSW/linkeval
  private Panel designMainPanel() {
    // positioning indices
    final int leftStart = 450, topStart = 10, space = 100;
    // create the panel that will hold all components

    Panel pnlURIsProperties = new Panel("URI Display");

    pnlURIsProperties.setWidth("100%");
    pnlURIsProperties.setHeight("100%");

    // Create absolute layout specifying its properties
    final AbsoluteLayout layout = new AbsoluteLayout();
    layout.setWidth("100%");
    layout.setHeight("100%");
    layout.setSizeFull();

    // Create components Objects and specify their properties

    Button btnCorrect = new Button("Correct");
    Button btnIncorrect = new Button("Incorrect");
    Button btnUnsure = new Button("Unsure");
    Button btnGetProperties = new Button("Get properties");

    final NativeSelect cmbSourceEndpoint = new NativeSelect("Source Endpoint");
    final NativeSelect cmbDestinationEndpoint = new NativeSelect("Destination Endpoint");
    final ListSelect lstSuggestedProperties = new ListSelect("Lookup Properties");
    // to load properties of loaded resources automatically
    final CheckBox chkAutomaticPropertiesLoad =
        new CheckBox("Automatic Properties loading (next time)");
    chkAutomaticPropertiesLoad.setValue(false);

    cmbSourceEndpoint.setNullSelectionAllowed(false);
    cmbDestinationEndpoint.setNullSelectionAllowed(false);

    lstSuggestedProperties.setRows(4);
    lstSuggestedProperties.setNullSelectionAllowed(false);

    source = new Label("Source URI");
    destination = new Label("Destination URI");

    final Table tblSourcePropertiesMapping = new Table("Source Properties");
    final Table tblDestinationPropertiesMapping = new Table("Destination Properties");
    tblSourcePropertiesParam = tblSourcePropertiesMapping;
    tblDestinationPropertiesParam = tblDestinationPropertiesMapping;

    tblSourcePropertiesMapping.setWidth("50%");
    tblDestinationPropertiesMapping.setWidth("100%");
    tblSourcePropertiesMapping.setSelectable(true);
    tblDestinationPropertiesMapping.setSelectable(true);
    /* Define the names and data types of columns.
     * The "default value" parameter is meaningless here. */
    tblSourcePropertiesMapping.addContainerProperty("Property", String.class, null);
    tblSourcePropertiesMapping.addContainerProperty("Value", String.class, null);

    tblDestinationPropertiesMapping.addContainerProperty("Property", String.class, null);
    tblDestinationPropertiesMapping.addContainerProperty("Value", String.class, null);
    tblDestinationPropertiesMapping.setMultiSelect(true);
    /// get data for comboboxes
    SQLContainer cmbContainer = connectToDB("root", "mofo", "Endpoints");
    // fill endpoints
    cmbSourceEndpoint.setContainerDataSource(cmbContainer);
    cmbDestinationEndpoint.setContainerDataSource(cmbContainer);

    cmbSourceEndpoint.setValue(cmbSourceEndpoint.getItemIds().iterator().next());
    cmbDestinationEndpoint.setValue(cmbDestinationEndpoint.getItemIds().iterator().next());

    SQLContainer lstContainer = getSuggestedProperties("root", "mofo");
    int lstSize = lstContainer.size();
    int i = 0;
    for (Object cityItemId : lstContainer.getItemIds()) {
      lstSuggestedProperties.addItem(i);
      String g = lstContainer.getItem(cityItemId).getItemProperty("property").getValue().toString();
      lstSuggestedProperties.setItemCaption(i, g);
      i++;
    }
    lstSuggestedProperties.setValue(lstSuggestedProperties.getItemIds().iterator().next());

    btnCorrect.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            try {
              Object rowId = tblSourceDestinationparam.getValue();
              Item myitem = tblSourceDestinationparam.getItem(tblSourceDestinationparam.getValue());
              lEndTime = System.currentTimeMillis();
              long lEllapsedTime = lEndTime - lStartTime;
              tblSourceDestinationparam.setEditable(true);
              tblSourceDestinationparam.getContainerProperty(rowId, "decision").setValue("Correct");
              tblSourceDestinationparam
                  .getContainerProperty(rowId, "time")
                  .setValue(String.valueOf(lEllapsedTime));

              tblSourceDestinationparam.setEditable(false);
              SQLContainer c = (SQLContainer) tblSourceDestinationparam.getContainerDataSource();
              try {
                c.commit();
              } catch (UnsupportedOperationException | SQLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }
              int maxindex = tblSourceDestination.size();
              SQLContainer s = (SQLContainer) tblSourceDestination.getContainerDataSource();
              // Item x=s.getItem(tblSourceDestination.getValue());
              if (!(tblSourceDestination.getValue().equals(tblSourceDestination.lastItemId()))) {
                int index = s.indexOfId(tblSourceDestination.getValue());
                index++;
                tblSourceDestination.setValue(s.getIdByIndex(index));
                try {
                  Object rowId2 = tblSourceDestination.getValue();
                  Property sourceProperty =
                      tblSourceDestination.getContainerProperty(rowId2, "sourceURI");
                  Property destinationProperty =
                      tblSourceDestination.getContainerProperty(rowId2, "destinationURI");

                  source.setValue(sourceProperty.toString());
                  destination.setValue(destinationProperty.toString());
                  tblSourcePropertiesParam.removeAllItems();
                  tblDestinationPropertiesParam.removeAllItems();

                  Notification loadURI = new Notification("");
                  loadURI.show("Links' URIs are successfully loaded ");
                  if (chkAutomaticPropertiesLoad.getValue()) // the automatic buton i schecked
                  {
                    // load the properties automatically
                    String sourceEndpoint = "", destinationEndpoint = "";
                    sourceEndpoint = cmbSourceEndpoint.getItemCaption(cmbSourceEndpoint.getValue());
                    destinationEndpoint =
                        cmbDestinationEndpoint.getItemCaption(cmbDestinationEndpoint.getValue());
                    try {
                      String sparqlQuery = source.getValue();
                      getURIProperties(sparqlQuery, sourceEndpoint, tblSourcePropertiesMapping);
                      sparqlQuery = destination.getValue();
                      getURIProperties(
                          sparqlQuery, destinationEndpoint, tblDestinationPropertiesMapping);
                    } catch (Exception e) {
                      Notification.show("ERROR");
                    }
                    lStartTime = System.currentTimeMillis();
                    // start time for next one
                  }
                } catch (Exception e) {
                  Notification error = new Notification("Error");
                  error.show("You did not select an item in the links table");
                }
              }
            } catch (Exception e) {
              Notification.show(e.getMessage());
            }

            ///////////////////////////////////

          }
        });
    btnIncorrect.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            try {
              Object rowId = tblSourceDestinationparam.getValue();
              Item myitem = tblSourceDestinationparam.getItem(tblSourceDestinationparam.getValue());
              lEndTime = System.currentTimeMillis();
              long lEllapsedTime = lEndTime - lStartTime;
              tblSourceDestinationparam.setEditable(true);
              tblSourceDestinationparam
                  .getContainerProperty(rowId, "decision")
                  .setValue("Incorrect");
              tblSourceDestinationparam
                  .getContainerProperty(rowId, "time")
                  .setValue(String.valueOf(lEllapsedTime));
              tblSourceDestinationparam.setEditable(false);
              SQLContainer c = (SQLContainer) tblSourceDestinationparam.getContainerDataSource();
              try {
                c.commit();
              } catch (UnsupportedOperationException | SQLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }
              int maxindex = tblSourceDestination.size();
              SQLContainer s = (SQLContainer) tblSourceDestination.getContainerDataSource();
              // Item x=s.getItem(tblSourceDestination.getValue());
              if (!(tblSourceDestination.getValue().equals(tblSourceDestination.lastItemId()))) {
                int index = s.indexOfId(tblSourceDestination.getValue());
                index++;
                tblSourceDestination.setValue(s.getIdByIndex(index));
                try {
                  Object rowId2 = tblSourceDestination.getValue();
                  Property sourceProperty =
                      tblSourceDestination.getContainerProperty(rowId2, "sourceURI");
                  Property destinationProperty =
                      tblSourceDestination.getContainerProperty(rowId2, "destinationURI");

                  source.setValue(sourceProperty.toString());
                  destination.setValue(destinationProperty.toString());
                  tblSourcePropertiesParam.removeAllItems();
                  tblDestinationPropertiesParam.removeAllItems();

                  Notification loadURI = new Notification("");
                  loadURI.show("Links' URIs are successfully loaded ");

                  if (chkAutomaticPropertiesLoad.getValue()) // the automatic buton i schecked
                  {
                    // load the properties automatically
                    String sourceEndpoint = "", destinationEndpoint = "";
                    sourceEndpoint = cmbSourceEndpoint.getItemCaption(cmbSourceEndpoint.getValue());
                    destinationEndpoint =
                        cmbDestinationEndpoint.getItemCaption(cmbDestinationEndpoint.getValue());
                    try {
                      String sparqlQuery = source.getValue();
                      getURIProperties(sparqlQuery, sourceEndpoint, tblSourcePropertiesMapping);
                      sparqlQuery = destination.getValue();
                      getURIProperties(
                          sparqlQuery, destinationEndpoint, tblDestinationPropertiesMapping);
                    } catch (Exception e) {
                      Notification.show("ERROR Not Properties queried");
                    }
                    lStartTime = System.currentTimeMillis();
                    // start time for next one
                  }
                } catch (Exception e) {
                  Notification error = new Notification("Error");
                  error.show("You did not select an item in the links table");
                }
              }
            } catch (Exception e) {
              Notification.show(e.getMessage());
            }
            ///////////////////////////////////

          }
        });
    btnUnsure.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            try {
              Object rowId = tblSourceDestinationparam.getValue();
              Item myitem = tblSourceDestinationparam.getItem(tblSourceDestinationparam.getValue());
              lEndTime = System.currentTimeMillis();
              float lEllapsedTime = lEndTime - lStartTime;
              String elapsedTime = String.valueOf(lEllapsedTime);
              tblSourceDestinationparam.setEditable(true);
              tblSourceDestinationparam.getContainerProperty(rowId, "decision").setValue("Unsure");
              tblSourceDestinationparam.getContainerProperty(rowId, "time").setValue(elapsedTime);
              tblSourceDestinationparam.setEditable(false);
              SQLContainer c = (SQLContainer) tblSourceDestinationparam.getContainerDataSource();
              try {
                c.commit();
              } catch (UnsupportedOperationException | SQLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }

              // int selectedId=Integer.parseInt(tblSourceDestination.getValue().toString());
              int maxindex = tblSourceDestination.size();
              SQLContainer s = (SQLContainer) tblSourceDestination.getContainerDataSource();
              // Item x=s.getItem(tblSourceDestination.getValue());
              if (!(tblSourceDestination.getValue().equals(tblSourceDestination.lastItemId()))) {
                int index = s.indexOfId(tblSourceDestination.getValue());
                index++;
                tblSourceDestination.setValue(s.getIdByIndex(index));
                try {
                  Object rowId2 = tblSourceDestination.getValue();
                  Property sourceProperty =
                      tblSourceDestination.getContainerProperty(rowId2, "sourceURI");
                  Property destinationProperty =
                      tblSourceDestination.getContainerProperty(rowId2, "destinationURI");

                  source.setValue(sourceProperty.toString());
                  destination.setValue(destinationProperty.toString());
                  tblSourcePropertiesParam.removeAllItems();
                  tblDestinationPropertiesParam.removeAllItems();

                  Notification loadURI = new Notification("");
                  loadURI.show("Links' URIs are successfully loaded ");
                  if (chkAutomaticPropertiesLoad.getValue()) // the automatic buton i schecked
                  {
                    // load the properties automatically
                    String sourceEndpoint = "", destinationEndpoint = "";
                    sourceEndpoint = cmbSourceEndpoint.getItemCaption(cmbSourceEndpoint.getValue());
                    destinationEndpoint =
                        cmbDestinationEndpoint.getItemCaption(cmbDestinationEndpoint.getValue());
                    try {
                      String sparqlQuery = source.getValue();
                      getURIProperties(sparqlQuery, sourceEndpoint, tblSourcePropertiesMapping);
                      sparqlQuery = destination.getValue();
                      getURIProperties(
                          sparqlQuery, destinationEndpoint, tblDestinationPropertiesMapping);
                    } catch (Exception e) {
                      Notification.show("ERROR Not Properties queried");
                    }
                    lStartTime = System.currentTimeMillis();
                    // start time for next one
                  }
                } catch (Exception e) {
                  Notification error = new Notification("Error");
                  error.show("You did not select an item in the links table");
                }
              }
            } catch (Exception e) {
              Notification.show(e.getMessage());
            }
          }
        });
    btnGetProperties.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            String sourceEndpoint = "", destinationEndpoint = "";
            sourceEndpoint = cmbSourceEndpoint.getItemCaption(cmbSourceEndpoint.getValue());
            destinationEndpoint =
                cmbDestinationEndpoint.getItemCaption(cmbDestinationEndpoint.getValue());
            lStartTime = System.currentTimeMillis();

            try {
              String sparqlQuery = source.getValue();
              getURIProperties(sparqlQuery, sourceEndpoint, tblSourcePropertiesMapping);
              sparqlQuery = destination.getValue();
              getURIProperties(sparqlQuery, destinationEndpoint, tblDestinationPropertiesMapping);
            } catch (Exception e) {
              Notification.show(
                  "ERROR while sparqling the endpoint for resources' properties (Are they selected/loaded ?)");
            }
            // cachingForTriples(tblSourceDestination, sourceEndpoint);
          }
        });

    lstSuggestedProperties.addValueChangeListener(
        new ValueChangeListener() {
          @Override
          public void valueChange(final ValueChangeEvent event) {
            final String valueString = String.valueOf(event.getProperty().getValue());
            // Notification.show(valueString);
            List<Object> Ids = new ArrayList<Object>();
            Object first = null;
            for (Iterator i = tblSourcePropertiesMapping.getItemIds().iterator(); i.hasNext(); ) {
              // Get the current item identifier, which is an integer.
              first = i.next();
              int iid = (Integer) first;
              String other =
                  tblSourcePropertiesMapping.getItem(iid).getItemProperty("Property").toString();
              // Notification.show(other);
              if (other.equals(valueString)) // if(other.equals(property))
              {
                Ids.add(iid);
                break;
              }
            }
            tblSourcePropertiesMapping.setImmediate(true);
            tblSourcePropertiesMapping.setValue(Ids);
            tblDestinationPropertiesMapping.setCurrentPageFirstItemId(first);
          }
        });

    tblSourcePropertiesMapping.addItemClickListener(
        new ItemClickEvent.ItemClickListener() {

          @Override
          public void itemClick(ItemClickEvent event) {
            String property =
                tblSourcePropertiesMapping
                    .getContainerProperty(event.getItemId(), event.getPropertyId())
                    .toString();
            List<String> res = getRelatedProperties(property);

            if (res == null) {
              Notification.show("No related Properties");
              return;
            }
            boolean Found = false;
            List<Object> Ids = new ArrayList<Object>();
            Object first = null;
            int x = 0;
            for (String relatedProperty : res) {
              for (Iterator i = tblDestinationPropertiesMapping.getItemIds().iterator();
                  i.hasNext(); ) {
                // Get the current item identifier, which is an integer.
                Object theId = i.next();
                int iid = (Integer) theId;
                String other =
                    tblDestinationPropertiesMapping
                        .getItem(iid)
                        .getItemProperty(event.getPropertyId())
                        .toString();

                if (other.equals(relatedProperty)) // if(other.equals(property))
                {
                  Ids.add(iid);
                  if (x == 0) {
                    first = theId;
                    x = 1;
                  }
                  Found = true;
                }
              }
            }
            if (!Found)
              Notification.show(
                  "Related property is not Found in destination table try manual search");
            else {
              Notification.show("Found in destination table");
              tblDestinationPropertiesMapping.setValue(Ids);
              tblDestinationPropertiesMapping.setCurrentPageFirstItemId(first);
            }
          }
        });
    // add component to the layout specifying its position on the layout

    layout.addComponent(btnCorrect, "left: " + leftStart + "px; top: " + (topStart + 450) + "px;");
    layout.addComponent(
        btnIncorrect, "left: " + (leftStart + space) + "px; top: " + (topStart + 450) + "px;");
    layout.addComponent(
        btnUnsure, "left: " + (leftStart + 2 * space) + "px; top: " + (topStart + 450) + "px;");
    layout.addComponent(
        btnGetProperties,
        "left: " + (leftStart + 3 * space + 50) + "px; top: " + (topStart + 450) + "px;");
    layout.addComponent(
        chkAutomaticPropertiesLoad,
        "left: " + (leftStart + 3 * space + 250) + "px; top: " + (topStart + 450) + "px;");

    /*layout.addComponent(sourceURI,"left: "+(leftStart-space/2)+"px; top: "+(topStart+space/2)+"px;");
    layout.addComponent(destinationURI,"left: "+(leftStart+2*space)+"px; top: "+(topStart+space/2)+"px;");*/

    layout.addComponent(source, "left: 30px; top: " + (topStart + space / 2) + "px;");
    layout.addComponent(
        destination,
        "left: " + (leftStart + 3 * space + 200) + "px; top: " + (topStart + space / 2) + "px;");

    layout.addComponent(cmbSourceEndpoint, "left: 50px; top: " + (topStart + 20) + "px;");
    layout.addComponent(
        cmbDestinationEndpoint,
        "left: " + (leftStart + 3 * space + 200) + "px; top: " + (topStart + 20) + "px;");
    layout.addComponent(
        lstSuggestedProperties,
        "left: " + (leftStart + 100) + "px; top: " + (topStart + 20) + "px;");

    layout.addComponent(
        tblSourcePropertiesMapping, "left: 10px; top: " + (topStart + space) + "px;");
    layout.addComponent(
        tblDestinationPropertiesMapping,
        "left: " + (leftStart + 3 * space + 200) + "px; top: " + (topStart + space) + "px;");

    pnlURIsProperties.setContent(layout);

    return pnlURIsProperties;
  }
コード例 #23
0
  @Override
  public void execute() {
    List<ChangeRecord> historyList = view.getUi().getStockService().findChanges(good);
    Window subWindow = new Window();
    subWindow.setModal(true);
    subWindow.setHeight("650px");
    subWindow.setWidth("700px");
    subWindow.setClosable(true);
    view.getUi().addWindow(subWindow);

    final Button pdfButton = new Button(bundle.getString("pdf.export"));
    pdfButton.setIcon(new ThemeResource("img/pdf.png"));
    pdfButton.setWidth("150");
    StreamResource pdfStream = getPDFStream(view.getUi().getStockService().findChanges(good));
    pdfStream.setMIMEType("application/pdf");
    FileDownloader pdfDownloader = new FileDownloader(pdfStream);
    pdfDownloader.extend(pdfButton);

    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.addComponent(pdfButton);

    for (ChangeRecord record : historyList) {
      for (ChangeRecord.PropertyChange p : record.getChangeList()) {
        p.setName(bundle.getString(p.getName()));
      }
      Panel panel = new Panel();
      BeanItemContainer<ChangeRecord.PropertyChange> container =
          new BeanItemContainer<>(ChangeRecord.PropertyChange.class, record.getChangeList());
      Table table = new Table();
      table.setContainerDataSource(container);
      table.setVisibleColumns("name", "oldValue", "newValue");
      table.setColumnHeaders(
          bundle.getString("history.property"),
          bundle.getString("history.old"),
          bundle.getString("history.new"));
      table.setColumnExpandRatio("name", 0.33f);
      table.setColumnExpandRatio("oldValue", 0.33f);
      table.setColumnExpandRatio("newValue", 0.33f);
      table.setPageLength(0);
      table.setWidth("100%");

      VerticalLayout panelLayout = new VerticalLayout();
      panelLayout.addComponent(
          new Label(
              "<b>"
                  + new SimpleDateFormat("dd-MM-YYYY HH:mm").format(record.getDate())
                  + ": "
                  + record.getUser().getName()
                  + " "
                  + record.getUser().getSurname()
                  + "</b><br/>",
              ContentMode.HTML));
      panelLayout.addComponent(table);
      panel.setContent(panelLayout);
      layout.addComponent(panel);
    }

    subWindow.setContent(layout);
  }