Package org.apache.isis.viewer.dnd

Examples of org.apache.isis.viewer.dnd.Size


    public void draw(Canvas canvas) {
        super.draw(canvas);

        Color color = getState().isObjectIdentified() ? Toolkit.getColor("primary2") : Toolkit.getColor("secondary1");
        Size size = getSize();
        int width = size.getWidth();
        int height = size.getHeight();
        canvas.drawRectangle(0, 0, width - 1, height - 1, color);

        TimePeriod p = getPeriod();

        int max = width - 4;
View Full Code Here


        return period;
    }

    public Size getRequiredSize() {
    Size size = super.getRequiredSize();
    size.extendWidth(304);
        return size;
    }
View Full Code Here

    public ScheduleLayout(CollectionElementBuilder viewer) {
        super(viewer);
    }

    public Size getRequiredSize(View view) {
    return new Size(155, 400);
  }
View Full Code Here

  }
   
    public void layout(View view) {
        ObjectField field = null;
        int x = 0;
        Size size = view.getSize();
        size.contract(view.getPadding());

        int width = size.getWidth();
        int maxHeight = size.getHeight();

        View[] views = view.getSubviews();

        for (int i = 0; i < views.length; i++) {
            View v = views[i];
            ObjectAdapter object = ((ObjectContent) v.getContent()).getObject();

            if (field == null) {
                ObjectSpecification nc = object.getSpecification();
                ObjectField[] fields = nc.getFields();

                for (int j = 0; j < fields.length; j++) {
                    field = fields[j];

                    if (field.getType().isOfType(Isis.getSpecificationLoader().loadSpecification(TimePeriod.class))) {
                        break;
                    }
                }
            }

            TimePeriod tp = (TimePeriod) object.getField(field);
      int y = (int) (((tp.getStart().longValue() - from) * maxHeight) / to);
            int height = (int) (((tp.getEnd().longValue() - tp.getStart().longValue()) * maxHeight) / to);

            v.setLocation(new Location(x, y));
            v.setSize(new Size(width, height));
        }
    }
View Full Code Here

            v.setSize(new Size(width, height));
        }
    }

  public Time getTime(View view, int y) {
        Size size = view.getSize();
        int maxHeight = size.getHeight();

        int longtime = (y * to) / maxHeight + from;
        Time t = new Time();
        t.setValue(longtime);
        return  t;
View Full Code Here

    int width = 0;
        View views[] = view.getSubviews();

        for (int i = 0; i < views.length; i++) {
            View v = views[i];
      Size s = v.getRequiredSize();
      height = Math.max(height, s.getHeight());
      width += s.getWidth();
    }

    return new Size(width, height);
  }   
View Full Code Here

    int x = 0, y = 0;
        View views[] = view.getSubviews();

        for (int i = 0; i < views.length; i++) {
            View v = views[i];
      Size s = v.getRequiredSize();
      v.setSize(s);
      v.setLocation(new Location(x, y));
      x += s.getWidth();
    }
  }
View Full Code Here

    options = field.getOption().getOptions();
    rowHeight = STYLE.getHeight();
  }
 
  public Size getRequiredSize() {
    Size size = new Size();
    for (int i = 0; i < options.length; i++) {
      size.extendHeight(rowHeight);
      size.ensureWidth(STYLE.stringWidth(options[i]));
    }
    size.extendHeight(2 * VPADDING);
    size.extendWidth(2 * HPADDING);
    return size;
  }
View Full Code Here

  public int getBaseline() {
        return STYLE.getAscent();
    }
 
  public void draw(Canvas canvas) {
    Size size = getSize();
    canvas.drawSolidRectangle(0,0, size.getWidth() - 1, size.getHeight() - 1, Toolkit.getColor(ColorsAndFonts.COLOR_WHITE));
    canvas.drawRectangle(0,0, size.getWidth() - 1, size.getHeight() - 1, Toolkit.getColor(ColorsAndFonts.COLOR_PRIMARY2));
    int x = HPADDING;
    int y = VPADDING;
    for (int i = 0; i < options.length; i++) {
      canvas.drawText(options[i], x, y + getBaseline(), Toolkit.getColor(ColorsAndFonts.COLOR_BLACK), STYLE);
      y += rowHeight;
View Full Code Here

    public void draw(Canvas canvas) {
        super.draw(canvas);

        Color color = getState().isObjectIdentified() ? Toolkit.getColor(ColorsAndFonts.COLOR_PRIMARY2) : Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY1);
        Size size = getSize();
        int width = size.getWidth();
        int height = size.getHeight();
        canvas.drawRectangle(0, 0, width - 1, height - 1, color);

        Percentage p = getPercentage();
        int length = (int) ((width - 4) * p.floatValue());
        canvas.drawSolidRectangle(2, 2, length, height - 5, Toolkit.getColor(ColorsAndFonts.COLOR_PRIMARY3));
View Full Code Here

TOP

Related Classes of org.apache.isis.viewer.dnd.Size

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.