Package com.projity.pm.graphic.model.cache

Examples of com.projity.pm.graphic.model.cache.GraphicNode


  protected CellFormat format=new CellFormat();
  public DefaultCellStyle(){
   
  }
  public CellFormat getCellFormat(Object object) {
    GraphicNode node=(GraphicNode)object;
//    CellFormat format=new CellFormat();
    format.reset();
    format.setBold(node.isSummary());
    format.setItalic(node.isAssignment());
    format.setCompositeIcon(node.isSummary()||node.isValidLazyParent());
    if (node.getSubprojectLevel()>0) format.setBackground(node.getSubprojectLevel()%2==0?"MULTIPROJET0":"MULTIPROJET1");
    if (node.isGroup()){
      if (node.getLevel()==1) format.setBackground("TAN");
      else format.setBackground("LINEN");
    }
    return format;
  }
View Full Code Here


  public ResourceCellStyle(){
   
  }
  public CellFormat getCellFormat(Object object) {
    CellFormat format=super.getCellFormat(object);
    GraphicNode node=(GraphicNode)object;
    Object impl=node.getNode().getImpl();
    if (impl instanceof ResourceImpl) {
      if (((ResourceImpl)impl).getAssignments().size()>0) // make assigned resources have a special color
        format.setBackground("PALE_GREEN");
    }
View Full Code Here

  protected CellFormat format=new CellFormat();
  public AssignmentCellStyle(){
   
  }
  public CellFormat getCellFormat(Object object) {
    GraphicNode node=(GraphicNode)object;
    //CellFormat format=new CellFormat();   
    format.reset();
    format.setBold(node.isSummary());
    format.setItalic(node.isAssignment());
    format.setCompositeIcon(node.isSummary()||node.isValidLazyParent());
    if (node.isGroup()){
      if (node.getLevel()==1) format.setBackground("TAN");
      else format.setBackground("LINEN");
    }
    else format.setBackground("NORMAL_YELLOW");
    return format;
  }
View Full Code Here

    protected int beforeLinkState=0;
    public void mouseDragged(MouseEvent e){
      if (isReadOnly()) return;
      if (!SwingUtilities.isLeftMouseButton(e)) return;
      if (selected instanceof GraphicNode){
        GraphicNode node=(GraphicNode)selected;
        boolean sw=switchOnLinkCreation(e.getX(),e.getY());
        if (state!=LINK_CREATION&&sw){
          drawBarShadow(lastShadowX,lastLinkShadowY,true);
          beforeLinkState=state;
          state=LINK_CREATION;
          selectCursor();

          sourceNode=(GraphicNode)selected;
          drawLinkSelectionBarShadow(sourceNode);

          setLinkOrigin();
        }
        else if (state==LINK_CREATION&&!sw&&allowLinkSelectionToMove()){
          drawLinkShadow(lastLinkShadowX,lastLinkShadowY,true);
          drawBarShadow(lastShadowX,lastLinkShadowY,true);
          state=beforeLinkState;
          selectCursor();

          sourceNode=null;

        }
      }
      if (state==LINK_CREATION){
        GraphZone zone=ui.getNodeAt(e.getX(),e.getY());
      GraphicNode newDestinationNode=zone==null?null:(GraphicNode)zone.getObject();
      drawLinkSelectionBarShadow(destinationNode);
        drawLinkShadow(lastLinkShadowX,lastLinkShadowY,true);
        scrollToVisible(e.getX(),e.getY());
      drawLinkShadow(e.getX(),e.getY(),true);
      if (newDestinationNode!=null && newDestinationNode.isLinkable() && sourceNode != newDestinationNode){
        destinationNode=newDestinationNode;
        drawLinkSelectionBarShadow(destinationNode);
      }else destinationNode=null;
      }else if (isMove()){
        drawBarShadow(lastShadowX,lastShadowY,true);
View Full Code Here

      //System.out.println("Shallow update");
      if (nodes==null) updateShapes();
      else updateShapes(nodes.listIterator());
    }
    public void updateShapes(ListIterator nodeIterator){
      GraphicNode node;
    for (ListIterator i=nodeIterator;i.hasNext();){
      node=(GraphicNode)i.next();
      if (!node.isVoid()) updateShape(node);
    }
    }
View Full Code Here

  }
 
  protected int updateBounds(Point2D origin,Rectangle2D ref){//cache in current version isn't a tree
    double x=origin.getX()+ref.getWidth()/2;
    double y=origin.getY()+ref.getHeight()/2;
    GraphicNode node,previous=null;
    int maxLevel=0;
    for (ListIterator i=cache.getIterator();i.hasNext();){
      node=(GraphicNode)i.next();
      if (node.getLevel()>maxLevel) maxLevel=node.getLevel();
      if (previous!=null&&node.getLevel()<=previous.getLevel()){
        setShape(previous,ref,x,y+(previous.getLevel()-1)*(ref.getMaxY()));
        x+=ref.getMaxX();
      }
      previous=node;
    }
 
View Full Code Here

  protected void updateBounds(int level,Point2D origin,Rectangle2D ref){//cache in current version isn't a tree
    double y=origin.getY()+ref.getHeight()/2+ref.getMaxY()*(level-1);
    Point2D childCenter,center;
    double x0,x1;
    GraphicNode node,child;
    boolean hasChild;
    for (ListIterator i=cache.getIterator();i.hasNext();){
      node=(GraphicNode)i.next();
      if (node.getLevel()==level){
        x0=-1;
        x1=-1;
        hasChild=false;
        while (i.hasNext()){
          child=(GraphicNode)i.next();
View Full Code Here

        if (preserveHierarchy){
          localList=new ArrayList();
          parents=new Stack();
        }else localList=list;

        GraphicNode gnode,previous=null;
        Object current;
        for (Iterator i=list.iterator();i.hasNext();){
            gnode=(GraphicNode)i.next();
            gnode.setFiltered(false);
            if (!gnode.isVoid()){
              current=(composition==null)?gnode.getNode():composition.evaluate(gnode.getNode());
              alreadyExcluded=false;
               if (hiddenFilter!=null){
                   if(!hiddenFilter.evaluate(current)){
                      if (!gnode.isSummary() || !preserveHierarchy){
                        i.remove();
                        continue;
                      }
                      if (gnode.isSummary()&&preserveHierarchy) gnode.setFiltered(true);
                      alreadyExcluded=true;
                  }
              }
               if (userFilter!=null&&!alreadyExcluded){
                   if(!userFilter.evaluate(current)){
                     if (!gnode.isSummary() || !preserveHierarchy){
                       i.remove();
                       continue;
                     }
                      if (gnode.isSummary()&&preserveHierarchy) gnode.setFiltered(true);
                  }
               }
            }
             if (preserveHierarchy){
               //contruct a temporary tree for sorting and grouping
//               if (parents==null||previous==null){
//                 System.out.println("null");
//               }
               if (gnode.getLevel()==1){
                 localList.add(gnode);
                 parents.clear();
               }else{
                   if (previous.getLevel()<gnode.getLevel()){
                     parents.push(previous);
                   }else if (previous.getLevel()>=gnode.getLevel()){
                     while (parents.size()>=gnode.getLevel()) parents.pop();
                   }
                   ((GraphicNode)parents.peek()).getChildren().add(gnode);
               }
               previous=gnode;
             }
View Full Code Here

  private boolean filterEmptySummaries(List list,boolean filterVoids){
    boolean containsNonSummaries=false;
    boolean containsVoids=false;
    for (Iterator i=list.iterator();i.hasNext();){
      GraphicNode gnode=(GraphicNode)i.next();
      if (gnode.isVoid()){
        containsVoids=true;
        continue;
      }
      if (!gnode.isSummary()||(gnode.getChildren().size()>0 && filterEmptySummaries(gnode.getChildren(),true))) containsNonSummaries=true;
      else i.remove();
    }
    if (!containsNonSummaries&&(!containsVoids || filterVoids)) list.clear();
    return containsNonSummaries;
  }
View Full Code Here

 

 
  public List searchJustModifiedNodes(){
    LinkedList gnodes=new LinkedList();
    GraphicNode gnode;
    Object impl;
    for (Iterator i=getCache().getIterator();i.hasNext();){
      gnode=(GraphicNode)i.next();
      impl=gnode.getNode().getImpl();
      if (impl instanceof Task){
        if (((Task)impl).isJustModified()) gnodes.add(gnode);
      }else if (impl instanceof Assignment){ //assignment
        if (((Task)getCache().getModel().getParent(gnode.getNode()).getImpl()).isJustModified()) gnodes.add(gnode);
      }
    }
    return gnodes;
  }
View Full Code Here

TOP

Related Classes of com.projity.pm.graphic.model.cache.GraphicNode

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.