Package org.dyno.visual.swing.layouts

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


  @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


  @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) {
      return createVerticalLeading(me, bounds, parent);
    } else if (vertical instanceof Trailing) {
      return createVerticalTrailing(me, bounds, parent);
    } else if (vertical instanceof Bilateral) {
View Full Code Here

    CompositeAdapter parent = (CompositeAdapter) WidgetAdapter.getWidgetAdapter(container);
    Insets insets = container.getInsets();
    WidgetAdapter dropAdapter = tracingAdapter;
    JComponent drop = (JComponent)dropAdapter.getParentContainer();
    Point hot = dropAdapter.getHotspotPoint();
    Constraints cons = adapter.getLastConstraints();
    Alignment horizontal = cons.getHorizontal();
    Alignment vertical = cons.getVertical();
    Point ltp = parent.getMascotLocation();
    int x = ltp.x - hot.x;
    int y = ltp.y - hot.y;
    int width = drop.getWidth();
    int height = drop.getHeight();
    Spring spring = new Spring(10, 10);// TODO should be replaced by a
    // container gap.
    if (pair == null) {
      if (horizontal instanceof Leading)
        horizontal = new Leading(x - insets.left, width, spring);
      else if (horizontal instanceof Trailing)
        horizontal = new Leading(x - insets.left, width, spring);
      else if (horizontal instanceof Bilateral)
        horizontal = new Leading(x - insets.left, width, spring);
      if (vertical instanceof Leading)
        vertical = new Leading(y - insets.top, height, spring);
      else if (vertical instanceof Trailing)
        vertical = new Leading(y - insets.top, height, spring);
      else if (vertical instanceof Bilateral)
        vertical = new Leading(y - insets.top, height, spring);
    } else {
      if (pair.vQuart != null) {
        horizontal = pair.vQuart.anchor.createRightAxis(drop, new Rectangle(x, y, width, height), horizontal);
      } else {
        if (horizontal instanceof Leading)
          horizontal = new Leading(x - insets.left, width, spring);
        else if (horizontal instanceof Trailing)
          horizontal = new Leading(x - insets.left, width, spring);
        else if (horizontal instanceof Bilateral)
          horizontal = new Leading(x - insets.left, width, spring);
      }
      if (pair.hQuart != null) {
        vertical = pair.hQuart.anchor.createBottomAxis(drop, new Rectangle(x, y, width, height), vertical);
      } else {
        if (vertical instanceof Leading)
          vertical = new Leading(y - insets.top, height, spring);
        else if (vertical instanceof Trailing)
          vertical = new Leading(y - insets.top, height, spring);
        else if (vertical instanceof Bilateral)
          vertical = new Leading(y - insets.top, height, spring);
      }
    }
    assert horizontal != null && vertical != null;
    Constraints constraints = new Constraints(horizontal, vertical);
    container.add(drop, constraints);
    last_point = null;
    return true;
  }
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 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 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) {
      if (lastAxis instanceof Leading)
        return createHorizontalLeading(me, bounds, parent);
      else if (lastAxis instanceof Trailing)
        return createHorizontalSpring(me, bounds, parent);
View Full Code Here

    int count = parent.getComponentCount();
    GroupLayout layout = (GroupLayout) parent.getLayout();
    LayoutStyle layoutStyle = LayoutStyle.getInstance();
    for (int i = 0; i < count; i++) {
      Component target = parent.getComponent(i);
      Constraints constraints = layout.getConstraints(target);
      Rectangle targetBounds = target.getBounds();
      if (constraints != null && isOverlap(bounds.x, bounds.width, targetBounds.x, targetBounds.width)) {
        Alignment vertical = constraints.getVertical();
        Dimension prefs = target.getPreferredSize();
        Dimension mins = target.getMinimumSize();
        if (vertical instanceof Trailing) {
          int gap = layoutStyle.getPreferredGap((JComponent) target, (JComponent) me, ComponentPlacement.UNRELATED, SwingConstants.NORTH, parent);
          Trailing trailing = (Trailing) vertical;
View Full Code Here

    int count = parent.getComponentCount();
    GroupLayout layout = (GroupLayout) parent.getLayout();
    LayoutStyle layoutStyle = LayoutStyle.getInstance();
    for (int i = 0; i < count; i++) {
      Component target = parent.getComponent(i);
      Constraints constraints = layout.getConstraints(target);
      Rectangle targetBounds = target.getBounds();
      if (constraints != null && isOverlap(bounds.x, bounds.width, targetBounds.x, targetBounds.width)) {
        Alignment vertical = constraints.getVertical();
        Dimension prefs = target.getPreferredSize();
        Dimension mins = target.getMinimumSize();
        if (vertical instanceof Leading) {
          int gap = layoutStyle.getPreferredGap((JComponent) target, (JComponent) me, ComponentPlacement.UNRELATED, SwingConstants.SOUTH, parent);
          Leading leading = (Leading) vertical;
View Full Code Here

    int count = parent.getComponentCount();
    GroupLayout layout = (GroupLayout) parent.getLayout();
    LayoutStyle layoutStyle = LayoutStyle.getInstance();
    for (int i = 0; i < count; i++) {
      Component target = parent.getComponent(i);
      Constraints constraints = layout.getConstraints(target);
      Rectangle targetBounds = target.getBounds();
      if (constraints != null && isOverlap(bounds.y, bounds.height, targetBounds.y, targetBounds.height)) {
        Alignment horizontal = constraints.getHorizontal();
        Dimension prefs = target.getPreferredSize();
        Dimension mins = target.getMinimumSize();
        if (horizontal instanceof Trailing) {
          int gap = layoutStyle.getPreferredGap((JComponent) target, (JComponent) me, ComponentPlacement.UNRELATED, SwingConstants.WEST, parent);
          Trailing trailing = (Trailing) horizontal;
View Full Code Here

    int count = parent.getComponentCount();
    GroupLayout layout = (GroupLayout) parent.getLayout();
    LayoutStyle layoutStyle = LayoutStyle.getInstance();
    for (int i = 0; i < count; i++) {
      Component target = parent.getComponent(i);
      Constraints constraints = layout.getConstraints(target);
      Rectangle targetBounds = target.getBounds();
      if (constraints != null && isOverlap(bounds.y, bounds.height, targetBounds.y, targetBounds.height)) {
        Alignment horizontal = constraints.getHorizontal();
        Dimension prefs = target.getPreferredSize();
        Dimension mins = target.getMinimumSize();
        if (horizontal instanceof Leading) {
          int gap = layoutStyle.getPreferredGap((JComponent) target, (JComponent) me, ComponentPlacement.UNRELATED, SwingConstants.EAST, parent);
          Leading leading = (Leading) horizontal;
View Full Code Here

TOP

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

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.