Package net.sourceforge.ganttproject.task

Examples of net.sourceforge.ganttproject.task.Task


                    DefaultMutableTreeNode father = gt2.getFatherNode(cdmtn[i]);
                    int index = father.getIndex((TreeNode) cdmtn[i]);

                    index--;

                    Task task = (Task) cdmtn[i].getUserObject();

                    if (index >= 0)
                    {
                      DefaultMutableTreeNode [] child = new DefaultMutableTreeNode[cdmtn[i].getChildCount()];

                      if(task.getExpand())
                      {
                        for(int j=0; j<cdmtn[i].getChildCount(); j++)
                        {
                          child[j] = (DefaultMutableTreeNode)cdmtn[i].getChildAt(j);
                        }

                        for(int j=0; j<child.length; j++)
                        {
                          child[j].removeFromParent();
                          treeModel.nodesWereRemoved(cdmtn[i],
                              new int[] { 0 },
                              new Object[] { child });
                        }
                      }

                      cdmtn[i].removeFromParent();
                        treeModel.nodesWereRemoved(father,
                                        new int[] { index + 1 },
                                        new Object[] { cdmtn });

                        father.insert(cdmtn[i], index);
                        treeModel.nodesWereInserted(father, new int[] {index});

                        if(task.getExpand())
                        {
                          for(int j=0; j<child.length; j++)
                          {
                            cdmtn[i].insert(child[j], j);
                            treeModel.nodesWereInserted(cdmtn[i], new int[] {j});
View Full Code Here


                {
                    DefaultMutableTreeNode father = gt2.getFatherNode(cdmtn[i]);
                    int index = father.getIndex((TreeNode) cdmtn[i]);
                    index++;

                    Task task = (Task) cdmtn[i].getUserObject();

                    // New position
                    if ((index < father.getChildCount()))
                    {
                      DefaultMutableTreeNode [] child = new DefaultMutableTreeNode[cdmtn[i].getChildCount()];

                      if(task.getExpand())
                      {
                        for(int j=0; j<cdmtn[i].getChildCount(); j++)
                        {
                          child[j] = (DefaultMutableTreeNode)cdmtn[i].getChildAt(j);
                        }

                        for(int j=0; j<child.length; j++)
                        {
                          child[j].removeFromParent();
                          treeModel.nodesWereRemoved(cdmtn[i],
                              new int[] { 0 },
                              new Object[] { child });
                        }
                      }

                      cdmtn[i].removeFromParent();
                        treeModel.nodesWereRemoved(father,
                                        new int[] { index - 1 },
                                        new Object[] { cdmtn });

                        father.insert(cdmtn[i], index);
                        treeModel.nodesWereInserted(father, new int[] {index});

                        if(task.getExpand())
                        {
                          for(int j=0; j<child.length; j++)
                          {
                            cdmtn[i].insert(child[j], j);
                            treeModel.nodesWereInserted(cdmtn[i], new int[] {j});
View Full Code Here

  /** Write all tasks. */
    private void writeTasks(OutputStreamWriter out) throws IOException {
      writeTaskHeaders(out);
        List/*<String>*/ customFields = myProject.getCustomColumnsStorage().getCustomColumnsNames();
        for (int i = 0; i < myTasks.length; i++) {
            Task task = myTasks[i];
            // ID
            if (csvOptions.bExportTaskID) {
                writeCell(out, "" + task.getTaskID());
            }
            // Name
            if (csvOptions.bExportTaskName) {
                writeTextCell(out, getName(task));
            }
            // Start Date
            if (csvOptions.bExportTaskStartDate) {
                writeCell(out, task.getStart().toString());
            }
            // End Date
            if (csvOptions.bExportTaskEndDate) {
                writeCell(out, task.getEnd().toString());
            }
            // Duration
            if (csvOptions.bExportTaskDuration) {
                writeCell(out, ""+task.getDuration().getLength());
            }
            // Percent complete
            if (csvOptions.bExportTaskPercent) {
                writeCell(out, "" + task.getCompletionPercentage());
            }
            // Web Link
            if (csvOptions.bExportTaskWebLink) {
                writeTextCell(out, getWebLink((GanttTask) task));
            }
            // associated resources
            if (csvOptions.bExportTaskResources) {
              writeTextCell(out, getAssignments(task));
            }
            // Notes
            if (csvOptions.bExportTaskNotes) {
              writeTextCell(out, task.getNotes());
            }
            CustomColumnsValues customValues = task.getCustomValues();
            for (int j=0; j<customFields.size(); j++) {
              Object nextCustomFieldValue = customValues.getValue(String.valueOf(customFields.get(j)));
              writeCell(out, String.valueOf(nextCustomFieldValue));
            }
            out.write("\n");
View Full Code Here

  /** set the maximum size for all strings. */
    void getMaxSize() {
        List/*<String>*/ customFields = myProject.getCustomColumnsStorage().getCustomColumnsNames();
        iMaxSize = 0;
        for (int i = 0; i < myTasks.length; i++) {
            Task task = myTasks[i];

            if (csvOptions.bExportTaskID) {
                String s = "" + task.getTaskID();
                if (s.length() > iMaxSize)
                    iMaxSize = s.length();
            }

            if (csvOptions.bExportTaskName) {
                String s = "" + getName(task);
                if (s.length() > iMaxSize)
                    iMaxSize = s.length();
            }

            if (csvOptions.bExportTaskStartDate) {
                String s = "" + task.getStart();
                if (s.length() > iMaxSize)
                    iMaxSize = s.length();
            }

            if (csvOptions.bExportTaskEndDate) {
                String s = "" + task.getEnd();
                if (s.length() > iMaxSize)
                    iMaxSize = s.length();
            }

            if (csvOptions.bExportTaskDuration) {
                String s = "" + task.getDuration().getLength();
                if (s.length() > iMaxSize)
                    iMaxSize = s.length();
            }

            if (csvOptions.bExportTaskPercent) {
                String s = "" + task.getCompletionPercentage();
                if (s.length() > iMaxSize)
                    iMaxSize = s.length();
            }

            if (csvOptions.bExportTaskWebLink) {
                String s = "" + getWebLink((GanttTask) task);
                if (s.length() > iMaxSize)
                    iMaxSize = s.length();
            }

            if (csvOptions.bExportTaskResources) {
                String s = "" + getAssignments(task);
                if (s.length() > iMaxSize)
                    iMaxSize = s.length();
            }

            if (csvOptions.bExportTaskNotes) {
                String s = "" + task.getNotes();
                if (s.length() > iMaxSize)
                    iMaxSize = s.length();
            }

            CustomColumnsValues customValues = task.getCustomValues();
            for (int j=0; j<customFields.size(); j++) {
              Object nextCustomFieldValue = customValues.getValue(String.valueOf(customFields.get(j)));
              String nextValueAsString = String.valueOf(nextCustomFieldValue);
              if (nextValueAsString.length() > iMaxSize) {
                iMaxSize = nextValueAsString.length();
View Full Code Here

        startElement("tasks", attrs, handler);

        startElement("taskproperties", handler);
        writeTaskProperties(handler, project.getCustomColumnsStorage());
        endElement("taskproperties", handler);
        Task rootTask = project.getTaskManager().getTaskHierarchy().getRootTask();
        Task[] tasks = project.getTaskManager().getTaskHierarchy().getNestedTasks(rootTask);
        for (int i=0; i<tasks.length; i++) {
            writeTask(handler, (GanttTask) tasks[i], project.getCustomColumnsStorage());
        }
        endElement("tasks", handler);
View Full Code Here

            indent = indent.substring(0, indent.length() - 4);
            if ("description".equals(qName)) {
                myProjectInfo._sDescription = getCorrectString(myCharacterBuffer
                        .toString());
            } else if ("notes".equals(qName)) {
                Task currentTask = myTaskManager.getTask(getContext()
                        .getTaskID());
                currentTask.setNotes(getCorrectString(myCharacterBuffer
                        .toString()));
            }
        }
View Full Code Here

                    if (e.getSource() != bNewTask && e.getClickCount() == 1)
                        tree.stopEditing();
                    if (e.getButton() == MouseEvent.BUTTON1
                            && !(e.getSource() instanceof JTable)
                            && !(e.getSource() instanceof AbstractButton)) {
                        Task taskUnderPointer = area.new MouseSupport()
                                .findTaskUnderMousePointer(e.getX(), e.getY());
                        if (taskUnderPointer == null) {
                            tree.selectTreeRow(-1);
                        }
                    }
View Full Code Here

                public void run() {
                    ArrayList fathers = new ArrayList();
                    tree.stopEditing();
                    for (int i = 0; i < cdmtn.length; i++) {
                        if (cdmtn[i] != null && cdmtn[i] instanceof TaskNode) {
                            Task ttask = (Task) (cdmtn[i].getUserObject());

                            getTaskManager().deleteTask(ttask);
                            ttask.delete();
                            DefaultMutableTreeNode father = tree
                                    .getFatherNode(ttask);
                            tree.removeCurrentNode(cdmtn[i]);
                            if (father != null) {
                                GanttTask taskFather = (GanttTask) father
View Full Code Here

        Task[] nestedTasks = facade.getNestedTasks(task);
        if (nestedTasks.length > 0) {
            int completedDays = 0;
            long plannedDays = 0;
            for (int i = 0; i < nestedTasks.length; i++) {
                Task next = nestedTasks[i];
                long nextDuration = next.getDuration().getLength();
                completedDays += nextDuration * next.getCompletionPercentage();
                plannedDays += nextDuration;
            }
            int completionPercentage = (int) (completedDays / plannedDays);
            task.setCompletionPercentage(completionPercentage);
        }
View Full Code Here

    public Result getBounds(Collection/* <Task> */tasks) {
        Date lowerBound = null;
        Date upperBound = null;
        for (Iterator it = tasks.iterator(); it.hasNext();) {
            Task next = (Task) it.next();
            Date start = next.getStart().getTime();
            Date end = next.getEnd().getTime();
            if (lowerBound == null || lowerBound.after(start)) {
                lowerBound = start;
            }
            if (upperBound == null || upperBound.before(end)) {
                upperBound = end;
View Full Code Here

TOP

Related Classes of net.sourceforge.ganttproject.task.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.