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(" ", 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);
    }
  }
Ejemplo n.º 2
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;
  }
Ejemplo n.º 3
0
  protected Table createList() {
    // customerService =  ProcessEngines.getDefaultProcessEngine().getCustomerService();
    // customerService.newUser("hebele");
    Table table = new Table();

    table.addStyleName(ExplorerLayout.STYLE_PROCESS_DEFINITION_LIST);
    // table.addGeneratedColumn("icon", new ThemeImageColumnGenerator(Images.REPORT_22));
    table.setColumnWidth("icon", 18);

    // table.addContainerProperty("name", String.class, null);
    table.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);

    // Set non-editable, selectable and full-size
    table.setEditable(false);
    table.setImmediate(true);
    table.setSelectable(true);
    table.setNullSelectionAllowed(false);
    table.setSortDisabled(true);
    table.setSizeFull();

    return table;
  }
  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);
    }
  }
Ejemplo n.º 5
0
  public TradeTab() {
    HorizontalSplitPanel mainPanel = new HorizontalSplitPanel();
    mainPanel.setHeight("100%");

    VerticalLayout leftPanel = new VerticalLayout();
    leftPanel.setMargin(true);
    leftPanel.setSpacing(true);
    leftPanel.setHeight("100%");

    itemContainer.addContainerProperty("auction", AuctionService.class, null);
    itemContainer.addContainerProperty("id", String.class, null);
    itemContainer.addContainerProperty("description", String.class, null);
    itemContainer.addContainerProperty("startingPrice", Long.class, null);
    itemContainer.addContainerProperty("item", AuctionItem.class, null);

    itemTable.addStyleName("h1");
    //		itemTable.addStyleName("noheader");
    itemTable.setSelectable(true);
    itemTable.setImmediate(true);
    itemTable.setVisibleColumns(new String[] {"description", "startingPrice"});
    itemTable.setColumnHeaders(new String[] {"Description", "Starting Price"});
    itemTable.setSizeFull();

    itemTable.addListener(
        new Property.ValueChangeListener() {
          public void valueChange(ValueChangeEvent event) {
            Application application = getApplication();
            if (application instanceof UriFragmentService)
              ((UriFragmentService) application).setUriFragment(getCurrentUriFragment(), false);

            Object itemId = itemTable.getValue();
            AuctionItem item =
                itemId != null
                    ? (AuctionItem) itemTable.getContainerProperty(itemId, "item").getValue()
                    : null;
            for (Iterator<Component> iter = dynamicLayout.getComponentIterator();
                iter.hasNext(); ) {
              Component component = iter.next();
              if (component instanceof SelectionListener<?>) {
                ((SelectionListener<AuctionItem>) component).selectionChanged(item);
              }
            }
          }
        });

    leftPanel.addComponent(itemTable);
    leftPanel.setExpandRatio(itemTable, 1f);

    // Button panel
    VerticalLayout buttonBarLayout = new VerticalLayout();
    buttonBar = new DynamicContainer(buttonBarLayout);
    buttonBar.setWidth("100%");
    leftPanel.addComponent(buttonBar);

    // Progress Indicator (hidden)
    ProgressIndicator progress = new ProgressIndicator(ProgressIndicator.SIZE_UNDEFINED);
    progress.addStyleName("hidden");
    progress.setPollingInterval(POLL_INTERVAL);
    leftPanel.addComponent(progress);
    leftPanel.setExpandRatio(progress, 0f);

    mainPanel.addComponent(leftPanel);
    mainPanel.addComponent(container);

    Table table = new Table();
    table.setSizeFull();

    setCompositionRoot(mainPanel);
    setCaption("Trade");
    setSizeFull();
  }
Ejemplo n.º 6
0
  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;
  }