Package org.dyno.visual.swing.layouts

Examples of org.dyno.visual.swing.layouts.Alignment


  @Override
  public Alignment createRightAxis(Component me, Rectangle bounds, Alignment lastAxis) {
    Container parent = target.getParent();
    GroupLayout layout = (GroupLayout) parent.getLayout();
    Constraints constraints = layout.getConstraints(target);
    Alignment horizontal = constraints.getHorizontal();
    if (horizontal instanceof Leading) {
      return createHorizontalLeading(me, bounds, parent);
    } else if (horizontal instanceof Trailing) {
      return createHorizontalTrailing(me, bounds, parent);
    } else if (horizontal instanceof Bilateral) {
View Full Code Here


  @Override
  public Alignment createLeftAxis(Component me, Rectangle bounds, Alignment lastAxis) {
    Container parent = target.getParent();
    GroupLayout layout = (GroupLayout) parent.getLayout();
    Constraints constraints = layout.getConstraints(target);
    Alignment horizontal = constraints.getHorizontal();
    if (horizontal instanceof Leading) {
      return createHorizontalLeading(me, bounds, parent);
    } else if (horizontal instanceof Trailing) {
      return createHorizontalTrailing(me, bounds, parent);
    } else if (horizontal instanceof Bilateral) {
View Full Code Here

  @Override
  public Alignment createHoveredAxis(Component me, Rectangle bounds) {
    Container parent = target.getParent();
    GroupLayout layout = (GroupLayout) parent.getLayout();
    Constraints constraints = layout.getConstraints(target);
    Alignment vertical = constraints.getVertical();
    if (vertical instanceof Leading) {
      return createVerticalLeading(me, bounds, parent);
    } else if (vertical instanceof Trailing) {
      return createVerticalTrailing(me, bounds, parent);
    } else if (vertical instanceof Bilateral) {
View Full Code Here

  @Override
  public Alignment createBottomAxis(Component me, Rectangle bounds, Alignment lastAxis) {
    Container parent = target.getParent();
    GroupLayout layout = (GroupLayout) parent.getLayout();
    Constraints constraints = layout.getConstraints(target);
    Alignment vertical = constraints.getVertical();
    if (vertical instanceof Leading) {
      return createVerticalLeading(me, bounds, parent);
    } else if (vertical instanceof Trailing) {
      return createVerticalTrailing(me, bounds, parent);
    } else if (vertical instanceof Bilateral) {
View Full Code Here

      for (int i = 0; i < count; i++) {
        Component child = adapter.getChild(i);
        WidgetAdapter childAdapter = WidgetAdapter.getWidgetAdapter(child);
        if (childAdapter.isSelected()) {
          Constraints constraints = layout.getConstraints(child);
          Alignment horizontal = constraints.getHorizontal();
          int y = child.getY() + child.getHeight() / 2;
          int x = 0;
          if (horizontal instanceof Leading) {
            x = ((Leading) horizontal).getLeading();
            g2d.drawLine(insets.left, y, insets.left + x, y);
            Polygon polygon = new Polygon();
            polygon.addPoint(insets.left, y - BOX + 1);
            polygon.addPoint(insets.left, y + BOX);
            polygon.addPoint(insets.left + BOX, y);
            g2d.fillPolygon(polygon);
          } else if (horizontal instanceof Trailing) {
            x = child.getX() + child.getWidth();
            g2d.drawLine(width - insets.right, y, x, y);
            Polygon polygon = new Polygon();
            polygon.addPoint(width - insets.right, y - BOX);
            polygon.addPoint(width - insets.right, y + BOX - 1);
            polygon.addPoint(width - BOX - insets.right, y);
            g2d.fillPolygon(polygon);
          } else if (horizontal instanceof Bilateral) {
            x = ((Bilateral) horizontal).getLeading();
            g2d.drawLine(insets.left, y, insets.left + x, y);
            Polygon polygon = new Polygon();
            polygon.addPoint(insets.left, y - BOX + 1);
            polygon.addPoint(insets.left, y + BOX);
            polygon.addPoint(insets.left + BOX, y);
            g2d.fillPolygon(polygon);
            x = child.getX() + child.getWidth();
            g2d.drawLine(width - insets.right, y, x, y);
            polygon = new Polygon();
            polygon.addPoint(width - insets.right, y - BOX);
            polygon.addPoint(width - insets.right, y + BOX - 1);
            polygon.addPoint(width - BOX - insets.right, y);
            g2d.fillPolygon(polygon);
          }
          Alignment vertical = constraints.getVertical();
          x = child.getX() + child.getWidth() / 2;
          if (vertical instanceof Leading) {
            y = ((Leading) vertical).getLeading();
            g2d.drawLine(x, insets.top, x, insets.top + y);
            Polygon polygon = new Polygon();
View Full Code Here

  @Override
  public Alignment createTopAxis(Component me, Rectangle bounds, Alignment lastAxis) {
    Container parent = target.getParent();
    GroupLayout layout = (GroupLayout) parent.getLayout();
    Constraints constraints = layout.getConstraints(target);
    Alignment vertical = constraints.getVertical();
    if (vertical instanceof Leading) {
      if (lastAxis instanceof Leading)
        return createVerticalLeading(me, bounds, parent);
      else if (lastAxis instanceof Trailing)
        return createVerticalSpring(me, bounds, parent);
View Full Code Here

  @Override
  public void adjustLayout(Component widget) {
    GroupLayout layout = (GroupLayout) container.getLayout();
    Constraints constraints = layout.getConstraints(widget);
    Alignment horizontal = constraints.getHorizontal();
    if (horizontal instanceof Leading) {
      Leading leading = (Leading) horizontal;
      if (leading.getSize() == Alignment.PREFERRED) {
        int now_width = widget.getWidth();
        int pref_width = widget.getPreferredSize().width;
        int delta_width = pref_width - now_width;
        if (delta_width != 0) {
          adjustHorizontalLeadingBy(widget, delta_width);
          container.doLayout();
          container.validate();
        }
      } else {
        int delta_width = leading.getSize() - widget.getWidth();
        if (delta_width != 0) {
          adjustHorizontalLeadingBy(widget, delta_width);
          container.doLayout();
          container.validate();
        }
      }
    } else if (horizontal instanceof Trailing) {
      Trailing trailing = (Trailing) horizontal;
      if (trailing.getSize() == Alignment.PREFERRED) {
        int now_width = widget.getWidth();
        int pref_width = widget.getPreferredSize().width;
        int delta_width = pref_width - now_width;
        if (delta_width != 0) {
          adjustHorizontalTrailingBy(widget, delta_width);
          container.doLayout();
          container.validate();
        }
      } else {
        int delta_width = trailing.getSize() - widget.getWidth();
        if (delta_width != 0) {
          adjustHorizontalTrailingBy(widget, delta_width);
          container.doLayout();
          container.validate();
        }
      }
    }

    Alignment vertical = constraints.getVertical();
    if (vertical instanceof Leading) {
      Leading leading = (Leading) vertical;
      if (leading.getSize() == Alignment.PREFERRED) {
        int now_height = widget.getHeight();
        int pref_height = widget.getPreferredSize().height;
View Full Code Here

    for (int i = 0; i < count; i++) {
      Component target = containerAdapter.getChild(i);
      if (target != widget) {
        if (isTopRelatedTo((JComponent) target, (JComponent) widget)) {
          Constraints constraints = layout.getConstraints(target);
          Alignment vertical = constraints.getHorizontal();
          if (vertical instanceof Trailing) {
            Trailing leading = (Trailing) vertical;
            leading.setTrailing(leading.getTrailing() + delta_height);
            adjustVerticalTrailingBy(target, delta_height);
          } else if (vertical instanceof Bilateral) {
View Full Code Here

    for (int i = 0; i < count; i++) {
      Component target = containerAdapter.getChild(i);
      if (target != widget) {
        if (isBottomRelatedTo((JComponent) target, (JComponent) widget)) {
          Constraints constraints = layout.getConstraints(target);
          Alignment vertical = constraints.getVertical();
          if (vertical instanceof Leading) {
            Leading leading = (Leading) vertical;
            leading.setLeading(leading.getLeading() + delta_height);
            adjustVerticalLeadingBy(target, delta_height);
          } else if (vertical instanceof Bilateral) {
View Full Code Here

    for (int i = 0; i < count; i++) {
      Component target = containerAdapter.getChild(i);
      if (target != widget) {
        if (isLeftRelatedTo((JComponent) target, (JComponent) widget)) {
          Constraints constraints = layout.getConstraints(target);
          Alignment horizontal = constraints.getHorizontal();
          if (horizontal instanceof Trailing) {
            Trailing leading = (Trailing) horizontal;
            leading.setTrailing(leading.getTrailing() + delta_width);
            adjustHorizontalTrailingBy(target, delta_width);
          } else if (horizontal instanceof Bilateral) {
View Full Code Here

TOP

Related Classes of org.dyno.visual.swing.layouts.Alignment

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.