Package com.projity.pm.graphic.timescale

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


      format = (BarFormat)arg0;
      Field field=format.getField();
      if (field==null) return;
      Object value=field.getValue(node.getNode(),graphInfo.getCache().getModel(),null);
      if (value==null) return;
      CoordinatesConverter coord=((GanttParams)graphInfo).getCoord();

//      int y=yrow+config.getGanttBarHeight()+config.getGanttBarYOffset();
//      int x=(int)Math.ceil(coord.toX(node.getEnd()))+config.getGanttBarAnnotationXOffset();
//      Color oldColor=g2.getColor();
//      g2.setColor(format.getMiddle().getColor());
//      g2.drawString(ObjectConverterManager.toString(value,value.getClass()), x, y);
//      if (oldColor!=null) g2.setColor(oldColor);
      String s;
      if (value instanceof Date){
        Date d=(Date)value;
        s=DateFormat.getDateInstance(DateFormat.SHORT).format(d);
        int i=s.lastIndexOf('/');
        if (i>0) s=s.substring(0, i);
      }
      else s=FieldConverter.toString(value,value.getClass(),null);
      component.setText(s); //field.getClazz()?
      int y=yrow+config.getGanttBarYOffset();//+config.getGanttBarAnnotationYOffset();
      double x0=coord.toX(node.getStart());
      double x1=coord.toX(node.getEnd());
      x1=CoordinatesConverter.adaptSmallBarEndX(x0,x1,node,config);

      int x=(int)Math.ceil(x1)+config.getGanttBarAnnotationXOffset();
      int w=fontMetrics.stringWidth(s);//config.getGanttBarAnnotationMaxWidth();
      int h=config.getGanttBarHeight();
View Full Code Here


    private double[] extraPoints=new double[3];
    public void execute(Object arg0) {
      format = (BarFormat)arg0;

      GanttLinkRouting routing=(GanttLinkRouting)((GanttParams)graphInfo).getRouting();
      CoordinatesConverter coord=((GanttParams)graphInfo).getCoord();
      //if (format.getMiddle()!=null){
          GraphicNode from=dependency.getPredecessor();
          GraphicNode to=dependency.getSuccessor();
          int type=dependency.getType();
        int fromSign=(type==DependencyType.SF||type==DependencyType.SS)?-1:1;
        int toSign=(type==DependencyType.FS||type==DependencyType.SS)?-1:1;
        double fx0=coord.toX(from.getStart());
        double fx1=coord.toX(from.getEnd());
        fx1=CoordinatesConverter.adaptSmallBarEndX(fx0,fx1,from,config);
        double tx0=coord.toX(to.getStart());
        double tx1=coord.toX(to.getEnd());
        tx1=CoordinatesConverter.adaptSmallBarEndX(tx0,tx1,to,config);
        double x0=fromSign<0?fx0:fx1;
        double x1=toSign<0?tx0:tx1;
        int rowHeight=((GanttParams)graphInfo).getRowHeight();
        int yOffset=config.getGanttBarYOffset()+config.getGanttBarHeight()/2;
View Full Code Here


    public void updateShapes(ListIterator nodeIterator){

      Rectangle bounds = ((GanttParams)graphInfo).getGanttBounds();
      CoordinatesConverter coord=((GanttParams)graphInfo).getCoord();
      if (coord==null) return;
    double rowHeight=((GanttParams)graphInfo).getRowHeight();

    int i0=(int)Math.floor(bounds.getY()/rowHeight);
    int i1=(int)Math.ceil(bounds.getMaxY()/rowHeight);
    double t0=coord.toTime(bounds.getX());
    double t1=coord.toTime(bounds.getMaxX());

    GraphicNode node;
    for (ListIterator i=nodeIterator;i.hasNext();){
      node=(GraphicNode)i.next();
      node.setRow(i.previousIndex());
View Full Code Here

    BarFormat calFormat=getCalendarFormat();
    if (calFormat==null) return;
    //non working days
      Color oldColor=g2.getColor();
      Paint oldPaint=g2.getPaint();
      CoordinatesConverter coord=((GanttParams)graphInfo).getCoord();
      Project project=coord.getProject();
      WorkingCalendar wc=(WorkingCalendar)project.getWorkCalendar();

      if (coord.getTimescaleManager().isShowWholeDays()){
        boolean useScale2=coord.getTimescaleManager().getCurrentScaleIndex()==0; //valid only for current time scales
        TimeIterator i=coord.getTimeIterator(bounds.getX(), bounds.getMaxX(),useScale2);
        long startNonworking=-1L,endNonWorking=-1L;
        Calendar cal=DateTime.calendarInstance();

        PredefinedPaint paint=(PredefinedPaint)calFormat.getMiddle().getPaint();//new PredefinedPaint(PredefinedPaint.DOT_LINE,Colors.VERY_LIGHT_GRAY,Color.WHITE);
        paint.applyPaint(g2, useTextures());
        while (i.hasNext()){
          TimeInterval interval=i.next();
          long s=interval.getStart();
          if (CalendarService.getInstance().getDay(wc, s).isWorking()){
            if (startNonworking!=-1L){
              drawNonWorking(g2, startNonworking, endNonWorking, cal, coord, bounds,useScale2);
              startNonworking=endNonWorking=-1L;
            }
          }else{
            if (startNonworking==-1L) startNonworking=s;
            endNonWorking=s;

          }
        }
        if (startNonworking!=-1L){
          drawNonWorking(g2, startNonworking, endNonWorking, cal, coord, bounds,useScale2);
          startNonworking=endNonWorking=-1L;
        }
      }

    if (container!=null){
      //scale2 separation lines
      TimeIterator i=coord.getTimeIterator(bounds.getX(), bounds.getMaxX(),true);
      g2.setPaint(new PredefinedPaint(PredefinedPaint.DOT_LINE2,Color.GRAY,g2.getBackground()));
      while (i.hasNext()){
        TimeInterval interval=i.next();
        int startX=(int)Math.round(coord.toX(interval.getStart()));
        g2.drawLine(startX,bounds.y,startX,bounds.y+bounds.height);
      }

      //project start
      int projectStartX=(int)Math.round(coord.toX(project.getStart()));
      if (projectStartX>=bounds.getX()&&projectStartX<=bounds.getMaxX()){
        g2.setPaint(new PredefinedPaint(PredefinedPaint.DASH_LINE,Color.GRAY,g2.getBackground()));
        g2.drawLine(projectStartX,bounds.y,projectStartX,bounds.y+bounds.height);
      }

      //project start
      long statusDate = project.getStatusDate();
      if (statusDate != 0) {
        int statusDateX=(int)Math.round(coord.toX(statusDate));
        if (statusDateX>=bounds.getX()&&statusDateX<=bounds.getMaxX()){
          g2.setPaint(new PredefinedPaint(PredefinedPaint.DOT_LINE2,Color.GREEN,g2.getBackground()));
          g2.drawLine(statusDateX,bounds.y,statusDateX,bounds.y+bounds.height);
        }
      }
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.