Examples of GanttTask


Examples of net.sourceforge.ganttproject.GanttTask

        // todo REMOVE TASK FROM TASKHIERARCHY
        // fireTaskRemoved(tasktoRemove,myTaskContainment.getContainer(tasktoRemove));
    }

    public GanttTask createTask() {
        GanttTask result = createTask(-1);
        return result;
    }
View Full Code Here

Examples of net.sourceforge.ganttproject.GanttTask

     * (non-Javadoc)
     *
     * @see net.sourceforge.ganttproject.task.TaskManager#createTask(int)
     */
    public GanttTask createTask(int taskID) {
        GanttTask result = new GanttTask("", new GanttCalendar(), 1, this,
                taskID);
        if (result.getTaskID() >= getMaxID()) {
            setMaxID(result.getTaskID() + 1);
        }
        // result.setTaskID(taskID);
        // getTaskHierarchy().move(result, getRootTask());
        // result.move(getRootTask());
        fireTaskAdded(result);
View Full Code Here

Examples of org.projectforge.gantt.GanttTask

    updateOpenStatus();
  }

  protected void addDescendantNodes(GanttTreeTableNode parent)
  {
    final GanttTask parentObj = parent.getGanttObject();
    if (parentObj.getChildren() != null) {
      for (final GanttTask childNode : parentObj.getChildren()) {
        final GanttTreeTableNode child = new GanttTreeTableNode(parent, childNode);
        addTreeTableNode(child);
        addDescendantNodes(child);
      }
    }
View Full Code Here

Examples of org.projectforge.gantt.GanttTask

    for (int i = 0; i < NUMBER_OF_REJECT_SAVE_COLS; i++) {
      rejectSaveColumnVisible[i] = false;
    }
    if (treeList != null) {
      for (final GanttTreeTableNode node : treeList) {
        final GanttTask ganttObject = node.getGanttObject();
        final TaskDO task = taskTree.getTaskById((Integer) ganttObject.getId());
        if (task != null) {
          int col = 0;
          if (rejectSaveColumnVisible[col] == false && isTitleModified(ganttObject, task) == true) {
            rejectSaveColumnVisible[col] = true;
          }
          if (rejectSaveColumnVisible[++col] == false && isStartDateModified(ganttObject, task) == true) {
            rejectSaveColumnVisible[col] = true;
          }
          if (rejectSaveColumnVisible[++col] == false && isDurationModified(ganttObject, task) == true) {
            rejectSaveColumnVisible[col] = true;
          }
          if (rejectSaveColumnVisible[++col] == false && isEndDateModified(ganttObject, task) == true) {
            rejectSaveColumnVisible[col] = true;
          }
          if (rejectSaveColumnVisible[++col] == false && isProgressModified(ganttObject, task) == true) {
            rejectSaveColumnVisible[col] = true;
          }
          if (rejectSaveColumnVisible[++col] == false && isPredecessorModified(ganttObject, task) == true) {
            rejectSaveColumnVisible[col] = true;
          }
          if (rejectSaveColumnVisible[++col] == false && isPredecessorOffsetModified(ganttObject, task) == true) {
            rejectSaveColumnVisible[col] = true;
          }
          if (rejectSaveColumnVisible[++col] == false && isRelationTypeModified(ganttObject, task) == true) {
            rejectSaveColumnVisible[col] = true;
          }
          if (rejectSaveColumnVisible[++col] == false && isTypeModified(ganttObject, task) == true) {
            rejectSaveColumnVisible[col] = true;
          }
        }
      }
    }
    for (int i = 0; i < NUMBER_OF_REJECT_SAVE_COLS; i++) {
      rejectSaveColHeads[i].setVisible(rejectSaveColumnVisible[i]);
    }
    createTreeRows();
    final Iterator<Item<GanttTreeTableNode>> it = refreshingView.getItems();
    while (it.hasNext() == true) {
      final Item<GanttTreeTableNode> row = it.next();
      final GanttTask ganttObject = row.getModelObject().getGanttObject();
      boolean visible = true;
      if (form.getSettings().isShowOnlyVisibles() == true) {
        final GanttTaskImpl root = (GanttTaskImpl) ganttChartData.getRootObject();
        GanttTask current = ganttObject;
        int i = 10;
        while (current != null && current != root) {
          if (i-- < 0) {
            break; // Endless loop protection.
          }
          if (current.isVisible() == false) {
            visible = false;
            break;
          }
          current = root.findParent(current.getId());
        }
      }
      row.setVisible(visible);
      if (visible == true) {
        final TaskDO task = taskTree.getTaskById((Integer) ganttObject.getId());
View Full Code Here

Examples of org.projectforge.gantt.GanttTask

      @Override
      protected void populateItem(final Item<GanttTreeTableNode> item)
      {
        final GanttTreeTableNode node = item.getModelObject();
        final GanttTask ganttObject = node.getGanttObject();
        final TaskDO task = taskDao.getTaskTree().getTaskById((Integer) ganttObject.getId());
        if (item.getIndex() % 2 == 0) {
          item.add(AttributeModifier.replace("class", "even"));
        } else {
          item.add(AttributeModifier.replace("class", "odd"));
        }
        final Label formattedLabel = new Label(ListSelectActionPanel.LABEL_ID, new Model<String>() {
          @Override
          public String getObject()
          {
            if (NumberHelper.greaterZero((Integer) ganttObject.getId()) == true) {
              return ganttObject.getTitle();
            } else {
              return "*" + ganttObject.getTitle() + "*";
            }
          };
        }) {
          @Override
          protected void onBeforeRender()
          {
            final boolean clipboarded = clipboard != null && clipboard.getId() == ganttObject.getId();
            if (clipboarded == true) {
              add(AttributeModifier.replace("style", "font-weight: bold; color:red;"));
            } else {
              final Behavior behavior = WicketUtils.getAttributeModifier(this, "style");
              if (behavior != null) {
                this.remove(behavior);
              }
            }
            super.onBeforeRender();
          }
        };

        final TreeIconsActionPanel< ? extends TreeTableNode> treeIconsActionPanel = new TreeIconsActionPanel<GanttTreeTableNode>("tree",
            new Model<GanttTreeTableNode>(node), formattedLabel, getTreeTable());
        treeIconsActionPanel.setUseAjaxAtDefault(false).setUseSubmitLinkImages(true);
        addColumn(item, treeIconsActionPanel, null);
        treeIconsActionPanel.init(GanttChartEditTreeTablePanel.this, node);
        treeIconsActionPanel.add(AttributeModifier.append("style", new Model<String>("white-space: nowrap;")));
        treeIconsActionPanel.setUseAjaxAtDefault(false);
        {
          final WebMarkupContainer dropDownMenu = new WebMarkupContainer("dropDownMenu");
          addColumn(item, dropDownMenu, "white-space: nowrap; width: 32px;");
          dropDownMenu.add(new PresizedImage("cogImage", WebConstants.IMAGE_COG));
          dropDownMenu.add(new PresizedImage("arrowDownImage", WebConstants.IMAGE_ARROW_DOWN));
          final RepeatingView menuRepeater = new RepeatingView("menuEntriesRepeater");
          dropDownMenu.add(menuRepeater);
          menuRepeater.add(new ContextMenuEntry(menuRepeater.newChildId(), "mark") {
            @Override
            void onSubmit()
            {
              if (clipboard != null && clipboard == node.getGanttObject()) {
                clipboard = null;
              } else {
                clipboard = node.getGanttObject();
              }
            };
          });
          menuRepeater.add(new ContextMenuEntry(menuRepeater.newChildId(), "gantt.predecessor.paste") {
            @Override
            public boolean isVisible()
            {
              return clipboard != null && clipboard != ganttObject;
            }

            @Override
            void onSubmit()
            {
              ganttObject.setPredecessor(clipboard);
            };
          }.addTooltip(new Model<String>() {
            @Override
            public String getObject()
            {
              return getString("paste") + ": " + (clipboard != null ? clipboard.getTitle() : "-");
            }
          }));
          menuRepeater.add(new ContextMenuEntry(menuRepeater.newChildId(), "gantt.contextMenu.newSubActivity") {
            @Override
            void onSubmit()
            {
              final GanttTaskImpl root = (GanttTaskImpl) ganttChartData.getRootObject();
              final Integer nextId = root.getNextId();
              ganttObject.addChild(new GanttTaskImpl(nextId).setVisible(true).setTitle(getString("untitled")));
              final Set<Serializable> openNodes = getOpenNodes();
              openNodes.add(ganttObject.getId());
              refreshTreeTable();
              setOpenNodes(openNodes);
              form.getParentPage().refresh();
            };
          });
          menuRepeater.add(new ContextMenuEntry(menuRepeater.newChildId(), new Model<String>() {
            @Override
            public String getObject()
            {
              if (clipboard == ganttObject) {
                return PFUserContext.getLocalizedString("gantt.action.moveToTop");
              } else {
                return PFUserContext.getLocalizedString("gantt.action.move");
              }
            };
          }) {
            @Override
            public boolean isVisible()
            {
              if (clipboard == null) {
                return false;
              }
              if (clipboard != ganttObject) {
                return true;
              }
              final GanttTaskImpl root = (GanttTaskImpl) ganttChartData.getRootObject();
              final GanttTask parent = root.findParent(ganttObject.getId());
              return (root != parent);
            }

            @Override
            void onSubmit()
            {
              if (clipboard == null) {
                return;
              }
              final GanttTaskImpl root = (GanttTaskImpl) ganttChartData.getRootObject();
              final GanttTask parent = root.findParent(clipboard.getId());
              final TaskDO task = taskDao.getTaskTree().getTaskById((Integer) clipboard.getId());
              parent.removeChild(clipboard);
              if (clipboard == ganttObject) {
                // Move to top level:
                root.addChild(ganttObject);
                final TaskDO rootTask = form.getData().getTask();
                if (rootTask != null && task != null) {
                  task.setParentTask(rootTask);
                  taskDao.update(task);
                }
              } else {
                // Move as a child of this Gantt activity:
                ganttObject.addChild(clipboard);
                final TaskDO parentTask = taskDao.getTaskTree().getTaskById((Integer) ganttObject.getId());
                if (parentTask != null && task != null) {
                  task.setParentTask(parentTask);
                  taskDao.update(task);
                }
                getOpenNodes().add(ganttObject.getId());
              }
              final Set<Serializable> openNodes = getOpenNodes();
              refreshTreeTable();
              setOpenNodes(openNodes);
              form.getParentPage().refresh();
            };

            @Override
            protected void onBeforeRender()
            {
              if (clipboard != null) {
                final TaskDO task = taskDao.getTaskTree().getTaskById((Integer) clipboard.getId());
                if (task != null && onClick == null) {
                  // Question for safety before moving a task.
                  setOnClick("if (!showMoveTaskQuestionDialog()) return;");
                }
              }
              super.onBeforeRender();
            }
          });
          menuRepeater.add(new ContextMenuEntry(menuRepeater.newChildId(), "delete") {
            @Override
            public boolean isVisible()
            {
              return task == null;
            }

            @Override
            void onSubmit()
            {
              final GanttTaskImpl root = (GanttTaskImpl) ganttChartData.getRootObject();
              final GanttTask parent = root.findParent(ganttObject.getId());
              parent.removeChild(ganttObject);
              final Set<Serializable> openNodes = getOpenNodes();
              refreshTreeTable();
              setOpenNodes(openNodes);
              form.getParentPage().refresh();
            };
          }.setOnClick("if (!showDeleteQuestionDialog()) return;"));
          menuRepeater.add(new ContextMenuEntry(menuRepeater.newChildId(), "gantt.contextMenu.saveAsTask") {
            @Override
            public boolean isVisible()
            {
              return task == null;
            }

            @Override
            void onSubmit()
            {
              final GanttTaskImpl root = (GanttTaskImpl) ganttChartData.getRootObject();
              final GanttTask parent = root.findParent(ganttObject.getId());
              final TaskDO parentTask = taskDao.getTaskTree().getTaskById((Integer) parent.getId());
              if (parentTask == null) {
                throw new UserException("gantt.error.parentObjectIsNotAPFTask");
              }
              TaskDO task = taskDao.getTaskTree().getTaskById((Integer) ganttObject.getId());
              if (task != null) {
                // Oups, Gantt object is already a ProjectForge task.
                return;
              }
              task = Task2GanttTaskConverter.convertToTask(ganttObject);
              task.setParentTask(parentTask);
              final GanttTask predecessor = ganttObject.getPredecessor();
              if (predecessor != null) {
                final TaskDO predecessorTask = taskDao.getTaskTree().getTaskById((Integer) predecessor.getId());
                if (predecessorTask != null) {
                  task.setGanttPredecessor(predecessorTask);
                }
              }
              final Set<Serializable> openNodes = getOpenNodes();
View Full Code Here

Examples of org.projectforge.gantt.GanttTask

  private void addPredecessorColumns(final Item<GanttTreeTableNode> item, final GanttTreeTableNode node, final GanttTask ganttObject,
      final TaskDO task)
  {
    final WebMarkupContainer panel = new WebMarkupContainer("predecessor");
    addColumn(item, panel, "white-space: nowrap;");
    final GanttTask predecessor = ganttObject.getPredecessor();
    final TaskDO predecessorTask = predecessor != null ? taskDao.getTaskTree().getTaskById((Integer) predecessor.getId()) : null;
    final Label asStringLabel = new Label("asString", new Model<String>() {
      @Override
      public String getObject()
      {
        final GanttTask predecessor = ganttObject.getPredecessor();
        return predecessor != null ? predecessor.getTitle() : "";
      };
    });
    panel.add(asStringLabel);
    final String taskSelectProperty = "predecessorId:" + ganttObject.getId();
    final IconLinkPanel selectSubmitLink = new IconLinkPanel("select", IconType.TASK, new SubmitLink(IconLinkPanel.LINK_ID) {
View Full Code Here

Examples of org.projectforge.gantt.GanttTask

  }

  public void select(final String property, final Object selectedValue)
  {
    if (property.startsWith("startDate:") == true) {
      final GanttTask obj = getIndexedGanttObject(property);
      if (obj == null) {
        log.error("GanttObject not found: + " + property);
      } else {
        final Date date = (Date) selectedValue;
        obj.setStartDate(date);
        markStartDateModelAsChanged(obj.getId());
      }
    } else if (property.startsWith("endDate:") == true) {
      final GanttTask obj = getIndexedGanttObject(property);
      if (obj == null) {
        log.error("GanttObject not found: + " + property);
      } else {
        final Date date = (Date) selectedValue;
        obj.setEndDate(date);
        markEndDateModelAsChanged(obj.getId());
      }
    } else if (property.startsWith("predecessorId") == true) {
      final GanttTask obj = getIndexedGanttObject(property);
      if (obj == null) {
        log.error("GanttObject not found: + " + property);
      } else {
        final Integer intValue = (Integer) selectedValue;
        GanttTask predecessor = findById(intValue);
        if (predecessor != null) {
          obj.setPredecessor(predecessor);
        } else {
          // OK, maybe an external reference (meaning a reference to a task outside the current Gantt object tree.
          final TaskDO task = taskDao.getTaskTree().getTaskById(intValue);
View Full Code Here

Examples of org.projectforge.gantt.GanttTask

  private GanttTask findById(final Serializable id)
  {
    if (id == null || ganttChartData == null) {
      return null;
    }
    final GanttTask root = ganttChartData.getRootObject();
    if (root == null) {
      return null;
    }
    return root.findById(id);
  }
View Full Code Here

Examples of org.projectforge.gantt.GanttTask

  }

  private GanttTask getIndexedGanttObject(final String property)
  {
    final Integer id = NumberHelper.parseInteger(property.substring(property.indexOf(':') + 1));
    final GanttTask obj = ganttChartData.getRootObject().findById(id);
    if (obj == null) {
      log.error("Oups, can't find Gantt object with hash id: " + id);
    }
    return obj;
  }
View Full Code Here

Examples of org.projectforge.gantt.GanttTask

  protected void refresh()
  {
    if (ganttChartData == null && getData().getTaskId() != null) {
      ganttChartData = getBaseDao().readGanttObjects(getData());
      final GanttTask rootObject = ganttChartData.getRootObject();
      if (rootObject != null && CollectionUtils.isNotEmpty(rootObject.getChildren()) == true && isNew() == true) {
        // For new charts set all children on level one as visible.
        for (final GanttTask child : rootObject.getChildren()) {
          child.setVisible(true);
        }
      }
    }
    form.ganttChartEditTreeTablePanel.setGanttChartData(ganttChartData).refresh();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.