Package com.projity.pm.graphic.timescale

Examples of com.projity.pm.graphic.timescale.CoordinatesConverter


    this.graphicManager = parentFrame;
    this.menuManager = graphicManager.getMenuManager();
    filterToolBarManager = Environment.isNewLook() ? FilterToolBarManager.create(menuManager) : graphicManager.getFilterToolBarManager();

    this.project = project;
    coord = new CoordinatesConverter(project);

    project.addObjectListener(this); // for project name changes
    getGraphicManager().getPreferences().addObjectListener(this);

    project.getObjectSelectionEventManager().addListener(this);
View Full Code Here


    if (printSettings!=null) fieldArray=printSettings.getFieldArray();
    init(project,NodeModelCacheFactory.getInstance().createFilteredCache((ReferenceNodeModelCache)refCache,"OfflineGantt",null),fieldArray,null,-1,true);
  }
  public void init(Project project, NodeModelCache cache,SpreadSheetFieldArray fieldArray,List<Integer> colWidth,int scale,boolean printGantt) {
    this.project=project;
    coord = new CoordinatesConverter(project);
    if (scale!=-1) coord.getTimescaleManager().setCurrentScaleIndex(scale);
    params=new SpreadSheetParamsImpl(fieldArray,colWidth,printGantt);
    int rowHeight=project.getRowHeight(new TreeSet<Integer>());
    params.setRowHeight(rowHeight);
View Full Code Here

    GraphicNode node=(GraphicNode)graph.getModel().getCache().getElementAt(row);
    double y0=getBarY(row)+node.getGanttShapeOffset();//row*rowHeight+config.getGanttBarYOffset();
    double h=node.getGanttShapeHeight();
    double delta=config.getSelectionSquare();
    if (y<y0/*-delta*/||y>y0/*+delta*/+h) return null;
    CoordinatesConverter coord=getCoord();
    double t=coord.toTime(x);
    double deltat=coord.toDuration(delta);
    if  (node.contains(t,deltat,deltat,coord)==null) return null;
    double progessH=config.getGanttProgressBarHeight();
    GraphZone zone=new GraphZone();
    zone.setObject(node);
    if (y>=y0+h/2-progessH/2&&y<y0+h/2+progessH/2) zone.setZoneId(PROGRESS_BAR_ZONE_ID);
View Full Code Here

    this.setToolTipText(Messages.getString("Text.rightClickForOptions"));

  }

  public void cleanUp() {
    CoordinatesConverter c = getCoord();
      if (c!= null) {
        c.removeTimeScaleListener(this);
          c.removeTimeScaleListener((GanttModel)model);
      }
      super.cleanUp();
  }
View Full Code Here

     public CoordinatesConverter getCoord() {
        return ((GanttModel)model).getCoord();
    }
     public void setCoord(CoordinatesConverter coord) {
       CoordinatesConverter modelCoord=getCoord();
        if (modelCoord!=null)
          modelCoord.removeTimeScaleListener(this);
    coord.addTimeScaleListener(this);
    ((GanttModel)model).setCoord(coord);
     }
View Full Code Here

    return 0;
  }


  public void scrollToTask(HasStartAndEnd interval,boolean automatic){
    CoordinatesConverter coord=getCoord();
    double start=coord.toX(interval.getStart());
    double end=coord.toX(interval.getEnd());
    Rectangle visible=getVisibleRect();
    if (automatic&&(
        (start>=visible.x&&start<=visible.x+visible.width)||
        (end>=visible.x&&end<=visible.x+visible.width)||
        (start<visible.x&&end>visible.x+visible.width)))
View Full Code Here

    }


    protected Shape getBarShadowBounds(double x,double y){
    double deltaX=x-x0;
    CoordinatesConverter coord=getCoord();
    GraphicNode node=(GraphicNode)selected;
    Rectangle2D bounds;
    double xStart=coord.toX((selectedIntervalNumber==0&&state==BAR_MOVE)?node.getStart():selectedInterval.getStart());
    if (state==PROGRESS_BAR_MOVE){
      double completedX=coord.toX(node.getCompleted());//CoordinatesConverter.adaptSmallBarEndX(xStart,coord.toX(node.getCompleted()),config);
      bounds=new Rectangle2D.Double(xStart,((GanttUI)ui).getBarY(node.getRow())+node.getGanttShapeOffset()+(node.getGanttShapeHeight()-config.getGanttProgressBarHeight())/2,completedX-xStart+deltaX,config.getGanttProgressBarHeight());
    }else{
      double xEnd=(selectedIntervalNumber==0&&state==BAR_MOVE)?CoordinatesConverter.adaptSmallBarEndX(coord.toX(node.getStart()),coord.toX(node.getEnd()),node,config):coord.toX(selectedInterval.getEnd());
      double w=xEnd-xStart;
      switch (state) {
      case BAR_MOVE:
        bounds=new Rectangle2D.Double(xStart+deltaX,((GanttUI)ui).getBarY(node.getRow())+node.getGanttShapeOffset(),w,node.getGanttShapeHeight());
        break;
View Full Code Here

      }
    }
    return bounds;
    }
    protected Rectangle2D getLinkSelectionShadowBounds(GraphicNode node){
    CoordinatesConverter coord=getCoord();
    double xStart=coord.toX(node.getStart());
    double xEnd=coord.toX(node.getEnd());
    xEnd=CoordinatesConverter.adaptSmallBarEndX(xStart,xEnd,node,config);
    Rectangle2D selectionRectangle=new Rectangle2D.Double(xStart,((GanttUI)ui).getBarY(node.getRow())+node.getGanttShapeOffset(),xEnd-xStart,node.getGanttShapeHeight());
    return selectionRectangle;
    }
View Full Code Here

      return ((GanttUI)ui).getCoord();
    }

    protected void setLinkOrigin(){
      GraphicNode node=(GraphicNode)selected;
    CoordinatesConverter coord=getCoord();
    double xStart=coord.toX((selectedIntervalNumber==0)?node.getStart():selectedInterval.getStart());
    double xEnd=selectedIntervalNumber==0?CoordinatesConverter.adaptSmallBarEndX(coord.toX(node.getStart()),coord.toX(node.getEnd()),node,config):coord.toX(selectedInterval.getEnd());
    x0link=(xStart+xEnd)/2;
    y0link=((GanttUI)ui).getBarY(node.getRow())+node.getGanttShapeOffset()+node.getGanttShapeHeight()/2;

    }
View Full Code Here

    public void consumeInterval(ScheduleInterval interval){
//      System.out.println("GanttUI consuming interval " + new java.util.Date(interval.getStart()) + " " + new java.util.Date(interval.getEnd()));
//      if (interval.getEnd() < interval.getStart())
//        return;
      CoordinatesConverter coord=((GanttParams)graphInfo).getCoord();
      if (interval.getEnd()>100000000000000L){
        // this hasn't happened in years. whatever caused it is fixed, but keeping just in case
        System.out.println("ERROR!!! leads to OutOfMemoryError, consumeInterval interval="+interval.getStart()+", "+CalendarUtil.toString(interval.getStart())+", "+interval.getEnd()+", "+CalendarUtil.toString(interval.getEnd())+"...");
        return;
      }
      double x=coord.toX(interval.getStart());
      double width=CoordinatesConverter.adaptSmallBarEndX(x,coord.toX(interval.getEnd()),node,config)-x;
//      double width=coord.toW(interval.getEnd()-interval.getStart());
      double height;
      double y=yrow+config.getGanttBarYOffset();
      int row=format.getRow();
        if (row==1){
          height=config.getGanttBarHeight();
        }
        else{
          height=config.getBaselineHeight();
          y+=config.getGanttBarHeight()+config.getBaselineHeight()*(row-2);
        }
        y+=height/2;

      double dw=height;

      if (format.getMiddle()!=null){

        if (g2==null&&format.isMain()){
          Shape shape=format.getMiddle().toGeneralPath(
              width,
              height,
              x,
              y,
              null);
          Rectangle2D bounds=shape.getBounds2D();
          node.setGanttShapeOffset(bounds.getY()-y+height/2);
          node.setGanttShapeHeight(bounds.getHeight());
        }else{
          Shape shape=format.getMiddle().draw(g2,
              width,
              height,
              x,
              y,
              useTextures());

        }
        // draw middle before ends
      }
      if (g2==null) return;

      if (format.getStart()!=null) format.getStart().draw(g2,
          dw,
          height,
          x ,
          y,
          useTextures());
      if (format.getEnd()!=null) format.getEnd().draw(g2,
          dw,
          height,
          x+width,
          y,
          useTextures()); //TODO case when no start symbol

      //TODO style and format of completion should be treated with bar prefererences instead of a special case
      if (format.isMain()&&!node.isSummary()&&node.isStarted()){
        long completedT=node.getCompleted();
        if (completedT>=interval.getStart()){
          double completedW=coord.toX(completedT)-x;
          if (completedW>width && !GanttOption.getInstance().isCompletionIsContiguous())
            completedW=width;
          completedW=CoordinatesConverter.adaptSmallBarEndX(x, x+completedW, node,config)-x;
          Rectangle2D progressBar=new Rectangle2D.Double(x,y-config.getGanttProgressBarHeight()/2,completedW,config.getGanttProgressBarHeight());
          g2.setColor(Color.BLACK);
View Full Code Here

TOP

Related Classes of com.projity.pm.graphic.timescale.CoordinatesConverter

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.