Search in sources :

Example 71 with Component

use of com.vaadin.ui.Component in project Activiti by Activiti.

the class AdminRunningInstancesPanel method addTaskItem.

protected void addTaskItem(HistoricTaskInstance task, Table taskTable) {
    Item item = taskTable.addItem(task.getId());
    if (task.getEndTime() != null) {
        item.getItemProperty("finished").setValue(new Embedded(null, Images.TASK_FINISHED_22));
    } else {
        item.getItemProperty("finished").setValue(new Embedded(null, Images.TASK_22));
    }
    item.getItemProperty("name").setValue(task.getName());
    item.getItemProperty("priority").setValue(task.getPriority());
    item.getItemProperty("startDate").setValue(new PrettyTimeLabel(task.getStartTime(), true));
    item.getItemProperty("endDate").setValue(new PrettyTimeLabel(task.getEndTime(), true));
    if (task.getDueDate() != null) {
        Label dueDateLabel = new PrettyTimeLabel(task.getEndTime(), i18nManager.getMessage(Messages.TASK_NOT_FINISHED_YET), true);
        item.getItemProperty("dueDate").setValue(dueDateLabel);
    }
    if (task.getAssignee() != null) {
        Component taskAssigneeComponent = getTaskAssigneeComponent(task.getAssignee());
        if (taskAssigneeComponent != null) {
            item.getItemProperty("assignee").setValue(taskAssigneeComponent);
        }
    }
}
Also used : Item(com.vaadin.data.Item) Label(com.vaadin.ui.Label) PrettyTimeLabel(org.activiti.explorer.ui.custom.PrettyTimeLabel) Embedded(com.vaadin.ui.Embedded) PrettyTimeLabel(org.activiti.explorer.ui.custom.PrettyTimeLabel) Component(com.vaadin.ui.Component)

Example 72 with Component

use of com.vaadin.ui.Component in project cuba by cuba-platform.

the class CubaTabSheet method silentCloseTabAndSelectPrevious.

public void silentCloseTabAndSelectPrevious(Component tab) {
    while (openedComponents.removeElement(tab)) {
        openedComponents.removeElement(tab);
    }
    if ((!openedComponents.empty()) && (selected.equals(tab))) {
        Component c = openedComponents.pop();
        while (!components.contains(c) && !openedComponents.isEmpty()) {
            c = openedComponents.pop();
        }
        setSelectedTab(c);
    }
}
Also used : Component(com.vaadin.ui.Component)

Example 73 with Component

use of com.vaadin.ui.Component in project cuba by cuba-platform.

the class CubaTreeTable method iterator.

@Override
public Iterator<Component> iterator() {
    List<Component> additionalConnectors = null;
    CubaTreeTableState tableState = getState(false);
    if (tableState.presentations != null) {
        additionalConnectors = new LinkedList<>();
        additionalConnectors.add((Component) tableState.presentations);
    }
    if (tableState.contextMenu != null) {
        if (additionalConnectors == null) {
            additionalConnectors = new LinkedList<>();
        }
        additionalConnectors.add((Component) tableState.contextMenu);
    }
    if (tableState.customPopup != null) {
        if (additionalConnectors == null) {
            additionalConnectors = new LinkedList<>();
        }
        additionalConnectors.add((Component) tableState.customPopup);
    }
    if (additionalConnectors == null) {
        return super.iterator();
    } else if (visibleComponents != null) {
        return Iterables.concat(visibleComponents, additionalConnectors).iterator();
    } else {
        return additionalConnectors.iterator();
    }
}
Also used : CubaTreeTableState(com.haulmont.cuba.web.toolkit.ui.client.treetable.CubaTreeTableState) AbstractComponent(com.vaadin.ui.AbstractComponent) Component(com.vaadin.ui.Component)

Example 74 with Component

use of com.vaadin.ui.Component in project cuba by cuba-platform.

the class CubaWidgetsTree method refreshRenderedComponents.

protected void refreshRenderedComponents() {
    detachGeneratedComponents();
    nodeWidgets.clear();
    itemIds.clear();
    if (widgetBuilder != null) {
        // Iterates through hierarchical tree using a stack of iterators
        final Stack<Iterator<?>> iteratorStack = new Stack<>();
        Collection<?> ids = rootItemIds();
        if (ids != null) {
            iteratorStack.push(ids.iterator());
        }
        while (!iteratorStack.isEmpty()) {
            // Gets the iterator for current tree level
            final Iterator<?> i = iteratorStack.peek();
            // If the level is finished, back to previous tree level
            if (!i.hasNext()) {
                // Removes used iterator from the stack
                iteratorStack.pop();
            } else {
                final Object itemId = i.next();
                itemIds.add(itemId);
                Component c = widgetBuilder.buildWidget(this, itemId, areChildrenAllowed(itemId));
                c.setParent(this);
                c.markAsDirty();
                nodeWidgets.add(c);
                if (hasChildren(itemId) && areChildrenAllowed(itemId)) {
                    iteratorStack.push(getChildren(itemId).iterator());
                }
            }
        }
    }
}
Also used : Component(com.vaadin.ui.Component)

Example 75 with Component

use of com.vaadin.ui.Component in project cuba by cuba-platform.

the class ComponentRenderer method generateData.

@Override
public void generateData(Object itemId, Item item, JsonObject jsonRow) {
    JsonObject jsonData = jsonRow.getObject("d");
    for (String key : jsonData.keys()) {
        if (getColumn(key).getRenderer() == this) {
            if (jsonData.get(key) != Json.createNull()) {
                Component current = lookupComponent(jsonData, key);
                trackComponent(itemId, current);
            }
        }
    }
}
Also used : JsonObject(elemental.json.JsonObject) Component(com.vaadin.ui.Component)

Aggregations

Component (com.vaadin.ui.Component)146 LayoutBoundTransferable (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.events.LayoutBoundTransferable)23 VerticalDropLocation (com.vaadin.shared.ui.dd.VerticalDropLocation)13 ComponentContainer (com.vaadin.ui.ComponentContainer)12 SingleComponentContainer (com.vaadin.ui.SingleComponentContainer)12 WebAbstractComponent (com.haulmont.cuba.web.gui.components.WebAbstractComponent)11 HorizontalLayout (com.vaadin.ui.HorizontalLayout)11 VerticalLayout (com.vaadin.ui.VerticalLayout)11 Button (com.vaadin.ui.Button)9 Window (com.haulmont.cuba.gui.components.Window)8 Label (com.vaadin.ui.Label)8 Test (org.junit.Test)8 WebWindow (com.haulmont.cuba.web.gui.WebWindow)7 AbstractOrderedLayout (com.vaadin.ui.AbstractOrderedLayout)6 CssLayout (com.vaadin.ui.CssLayout)6 List (java.util.List)6 com.haulmont.cuba.gui.components (com.haulmont.cuba.gui.components)5 CubaUI (com.haulmont.cuba.web.widgets.CubaUI)5 DDAbsoluteLayout (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDAbsoluteLayout)5 Item (com.vaadin.data.Item)5