Package org.zkoss.ganttz.data

Examples of org.zkoss.ganttz.data.Task


                    toAdd, false);
        }
    }

    public void addTasks(Position position, Collection<? extends Task> newTasks) {
        Task root = tasksTreeModel.getRoot();
        if (position.isAppendToTop()) {
            fillModel(root, tasksTreeModel.getChildCount(root), newTasks, false);
        } else if (position.isAtTop()) {
            fillModel(root,
                    position.getInsertionPosition(), newTasks, false);
View Full Code Here


    private final class TaskBeanRenderer implements TreeitemRenderer {
        private Map<TaskContainer, IExpandListener> expandListeners = new HashMap<TaskContainer, IExpandListener>();

        public void render(final Treeitem item, Object data) throws Exception {
            Task task = (Task) data;
            item.setOpen(isOpened(task));
            if (task instanceof TaskContainer) {
                final TaskContainer container = (TaskContainer) task;
                IExpandListener expandListener = new IExpandListener() {

                    @Override
                    public void expandStateChanged(boolean isNowExpanded) {
                        item.setOpen(isNowExpanded);
                    }
                };
                expandListeners.put(container, expandListener);
                container.addExpandListener(expandListener);

            }
            LeftTasksTreeRow leftTasksTreeRow = LeftTasksTreeRow.create(
                    disabilityConfiguration, task, new TreeNavigator(
                            tasksTreeModel, task), planner);
            if (task.isContainer()) {
                expandWhenOpened((TaskContainer) task, item);
            }
            Component row;
            if (disabilityConfiguration.isTreeEditable()) {
                row = Executions.getCurrent().createComponents(
View Full Code Here

                    task);
        }

        @Override
        public LeftTasksTreeRow getAboveRow() {
            Task parent = getParent(pathToNode);
            int lastPosition = pathToNode[pathToNode.length - 1];
            if (lastPosition != 0) {
                return getChild(parent, lastPosition - 1);
            } else if (tasksTreeModel.getRoot() != parent) {
                return getDetailFor(parent);
View Full Code Here

            }
            return null;
        }

        private LeftTasksTreeRow getChild(Task parent, int position) {
            Task child = tasksTreeModel.getChild(parent, position);
            return getDetailFor(child);
        }
View Full Code Here

            return null;
        }

        public List<ChildAndParent> group(Task origin, List<Task> parents) {
            ArrayList<ChildAndParent> result = new ArrayList<ChildAndParent>();
            Task child = origin;
            Task parent;
            ListIterator<Task> listIterator = parents.listIterator();
            while (listIterator.hasNext()) {
                parent = listIterator.next();
                result.add(new ChildAndParent(child, parent));
                child = parent;
View Full Code Here

        private boolean isExpanded() {
            return task.isContainer() && task.isExpanded();
        }

        private Task getParent(int[] path) {
            Task current = tasksTreeModel.getRoot();
            for (int i = 0; i < path.length - 1; i++) {
                current = tasksTreeModel.getChild(current, path[i]);
            }
            return current;
        }
View Full Code Here

    public void redrawDependency() {
        response("redrawDependency" + getId(), new AuInvoke(this, "draw"));
    }

    public boolean contains(Task task) {
        Task sourceTask = getSource().getTask();
        Task destinationTask = getDestination().getTask();
        return task.equals(sourceTask) || task.equals(destinationTask);
    }
View Full Code Here

    public DependencyType getDependencyType() {
        return type;
    }

    public boolean hasSameSourceAndDestination(Dependency dependency) {
        Task sourceTask = source.getTask();
        Task destinationTask = destination.getTask();
        return sourceTask.equals(dependency.getSource())
                && destinationTask.equals(dependency.getDestination());
    }
View Full Code Here

    private Task buildAndRegister(Position position,
            List<DomainDependency<T>> accumulatedDependencies, T data) {
        accumulatedDependencies.addAll(adapter.getOutcomingDependencies(data));
        accumulatedDependencies.addAll(adapter.getIncomingDependencies(data));

        final Task result = build(data);

        if (!navigator.isLeaf(data)) {
            TaskContainer container = (TaskContainer) result;
            int i = 0;
            for (T child : navigator.getChildren(data)) {
                container.add(buildAndRegister(position.down(container, i),
                        accumulatedDependencies, child));
                i++;
            }
        } else if (navigator.isMilestone(data)) {
            Milestone milestone = (Milestone) result;
            milestone.setOwner(position.getParent());
        }

        result.setShowingReportedHours(planner.showReportedHoursRightNow());
        result.setShowingMoneyCostBar(planner.showMoneyCostBarRightNow());
        result.setShowingAdvances(planner.showAdvancesRightNow());

        mapper.register(position, result, data);
        return result;
    }
View Full Code Here

    public void add(Position position, Collection<? extends T> domainObjects) {
        List<DomainDependency<T>> totalDependencies = new ArrayList<DomainDependency<T>>();
        List<Task> tasksCreated = new ArrayList<Task>();
        for (T object : domainObjects) {
            Task task = buildAndRegister(position, totalDependencies, object);
            tasksCreated.add(task);
        }
        updateTimeTracker(tasksCreated);
        if (position.isAppendToTop() || position.isAtTop()) {
            this.diagramGraph.addTopLevel(tasksCreated);
View Full Code Here

TOP

Related Classes of org.zkoss.ganttz.data.Task

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.