Package org.dyno.visual.swing.layouts

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


    GroupLayout layout = (GroupLayout) container.getLayout();
    CompositeAdapter containerAdapter = (CompositeAdapter) WidgetAdapter.getWidgetAdapter(container);
    WidgetAdapter post = widgets.get(0);
    Component postChild = post.getWidget();
    Constraints postConstraints = layout.getConstraints(postChild);
    Alignment postAlignment = postConstraints.getHorizontal();
    compcons = new ArrayList<CompCons>();
    if (postAlignment instanceof Trailing || postAlignment instanceof Bilateral) {
      int postTrail;
      if (postAlignment instanceof Trailing)
        postTrail = ((Trailing) postAlignment).getTrailing();
      else
        postTrail = ((Bilateral) postAlignment).getTrailing();
      for (int i = 1; i < widgets.size(); i++) {
        WidgetAdapter adapter = widgets.get(i);
        Component child = adapter.getWidget();
        Constraints constraints = layout.getConstraints(child);
        CompCons cons = new CompCons();
        cons.component = child;
        cons.constraints = constraints;
        compcons.add(cons);
        Alignment alignment = constraints.getHorizontal();
        if (alignment instanceof Trailing) {
          Trailing trailing = (Trailing) alignment.clone();
          trailing.setTrailing(postTrail);
          constraints = new Constraints(trailing, constraints.getVertical());
        } else if (alignment instanceof Bilateral) {
          Bilateral bilateral = (Bilateral) alignment.clone();
          bilateral.setTrailing(postTrail);
          constraints = new Constraints(bilateral, constraints.getVertical());
        } else if (alignment instanceof Leading) {
          Bilateral bilateral = new Bilateral(((Leading)alignment).getLeading(), postTrail, ((Leading) alignment).getSize());
          constraints = new Constraints(bilateral, constraints.getVertical());
        }
        layout.setConstraints(child, constraints);
      }
    } else if (postAlignment instanceof Leading) {
      Leading postLeading = (Leading) postAlignment;
      int postLead = postLeading.getLeading() + postChild.getWidth();
      for (int i = 1; i < widgets.size(); i++) {
        WidgetAdapter adapter = widgets.get(i);
        Component child = adapter.getWidget();
        Constraints constraints = layout.getConstraints(child);
        CompCons cons = new CompCons();
        cons.component = child;
        cons.constraints = constraints;
        compcons.add(cons);
        Alignment alignment = constraints.getHorizontal();
        if (alignment instanceof Trailing) {
          int l = postLead - child.getWidth();
          Leading trailing = new Leading(l, 10, child.getWidth());
          constraints = new Constraints(trailing,constraints.getVertical());
        } else if (alignment instanceof Bilateral) {
          int l = postLead - child.getWidth();
          Leading leading = new Leading(l, 10, child.getWidth());
          constraints = new Constraints(leading, constraints.getVertical());
        } else if (alignment instanceof Leading) {
          Leading leading = (Leading) alignment.clone();
          leading.setLeading(postLead - child.getWidth());
          constraints = new Constraints(leading, constraints.getVertical());
        }
        layout.setConstraints(child, constraints);
      }
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();
    Alignment vertical = adapter.getLastConstraints().getVertical();
    Alignment horizontal = adapter.getLastConstraints().getHorizontal();
    Point ltp = parent.getMascotLocation();
    int x = ltp.x - hot.x;
    int y = ltp.y - hot.y;
    int width = drop.getWidth();
    int height = drop.getHeight();
View Full Code Here

    CompositeAdapter containerAdapter = (CompositeAdapter) WidgetAdapter.getWidgetAdapter(container);
    WidgetAdapter post = widgets.get(0);
    Component postChild = post.getWidget();
    int postSize = postChild.getWidth();
    Constraints postConstraints = layout.getConstraints(postChild);
    Alignment postAlignment = postConstraints.getHorizontal();
    compcons = new ArrayList<CompCons>();
    Insets insets = container.getInsets();
    int innerWidth = container.getWidth() - insets.left - insets.right;
    if (postAlignment instanceof Leading) {
      for (int i = 1; i < widgets.size(); i++) {
        WidgetAdapter adapter = widgets.get(i);
        Component child = adapter.getWidget();
        Constraints constraints = layout.getConstraints(child);
        CompCons cons = new CompCons();
        cons.component = child;
        cons.constraints = constraints;
        compcons.add(cons);
        Alignment alignment = constraints.getHorizontal();
        if (alignment instanceof Leading) {
          Leading leading = (Leading) alignment.clone();
          leading.setSize(postSize);
          constraints = new Constraints(leading, constraints.getVertical());
        } else if (alignment instanceof Bilateral) {
          Bilateral bilateral = (Bilateral) alignment;
          int lead = bilateral.getLeading();
          Leading leading = new Leading(lead, postSize, 10, innerWidth - postSize - lead);
          constraints = new Constraints(leading, constraints.getVertical());
        } else if (alignment instanceof Trailing) {
          Trailing trailing = (Trailing) alignment.clone();
          trailing.setSize(postSize);
          constraints = new Constraints(trailing, constraints.getVertical());
        }
        layout.setConstraints(child, constraints);
        glAdapter.adjustLayout(child);
      }
    } else if (postAlignment instanceof Trailing) {
      for (int i = 1; i < widgets.size(); i++) {
        WidgetAdapter adapter = widgets.get(i);
        Component child = adapter.getWidget();
        Constraints constraints = layout.getConstraints(child);
        CompCons cons = new CompCons();
        cons.component = child;
        cons.constraints = constraints;
        compcons.add(cons);
        Alignment alignment = constraints.getHorizontal();
        if (alignment instanceof Leading) {
          Leading leading = (Leading) alignment.clone();
          leading.setSize(postSize);
          constraints = new Constraints(leading, constraints.getVertical());
        } else if (alignment instanceof Bilateral) {
          Bilateral bilateral = (Bilateral) alignment;
          int trail = bilateral.getTrailing();
          Trailing leading = new Trailing(trail, postSize, 10, innerWidth - postSize - trail);
          constraints = new Constraints(leading, constraints.getVertical());
        } else if (alignment instanceof Trailing) {
          Trailing trailing = (Trailing) alignment.clone();
          trailing.setSize(postSize);
          constraints = new Constraints(trailing, constraints.getVertical());
        }
        layout.setConstraints(child, constraints);
        glAdapter.adjustLayout(child);
      }
    } else if (postAlignment instanceof Bilateral) {
      for (int i = 1; i < widgets.size(); i++) {
        WidgetAdapter adapter = widgets.get(i);
        Component child = adapter.getWidget();
        Constraints constraints = layout.getConstraints(child);
        CompCons cons = new CompCons();
        cons.component = child;
        cons.constraints = constraints;
        compcons.add(cons);
        Alignment alignment = constraints.getHorizontal();
        if (alignment instanceof Leading) {
          Leading leading = (Leading) alignment;
          Bilateral bilateral = (Bilateral) postAlignment.clone();
          bilateral.setLeading(leading.getLeading());
          bilateral.setTrailing(innerWidth - leading.getLeading() - child.getWidth());
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();
    Alignment vertical = adapter.getLastConstraints().getVertical();
    Alignment horizontal = adapter.getLastConstraints().getHorizontal();
    Point ltp = parent.getMascotLocation();
    int x = ltp.x - hot.x;
    int y = ltp.y - hot.y;
    int width = drop.getWidth();
    int height = drop.getHeight();
View Full Code Here

    GroupLayout layout = (GroupLayout) container.getLayout();
    CompositeAdapter containerAdapter = (CompositeAdapter) WidgetAdapter.getWidgetAdapter(container);
    WidgetAdapter post = widgets.get(0);
    Component postChild = post.getWidget();
    Constraints postConstraints = layout.getConstraints(postChild);
    Alignment postAlignment = postConstraints.getVertical();
    compcons = new ArrayList<CompCons>();
    if (postAlignment instanceof Trailing || postAlignment instanceof Bilateral) {
      int postTrail;
      if (postAlignment instanceof Trailing)
        postTrail = ((Trailing) postAlignment).getTrailing();
      else
        postTrail = ((Bilateral) postAlignment).getTrailing();
      for (int i = 1; i < widgets.size(); i++) {
        WidgetAdapter adapter = widgets.get(i);
        Component child = adapter.getWidget();
        Constraints constraints = layout.getConstraints(child);
        CompCons cons = new CompCons();
        cons.component = child;
        cons.constraints = constraints;
        compcons.add(cons);
        Alignment alignment = constraints.getVertical();
        if (alignment instanceof Trailing) {
          Trailing trailing = (Trailing) alignment.clone();
          trailing.setTrailing(postTrail);
          constraints = new Constraints(constraints.getHorizontal(), trailing);
        } else if (alignment instanceof Bilateral) {
          Bilateral bilateral = (Bilateral) alignment.clone();
          bilateral.setTrailing(postTrail);
          constraints = new Constraints(constraints.getHorizontal(), bilateral);
        } else if (alignment instanceof Leading) {
          Bilateral bilateral = new Bilateral(((Leading)alignment).getLeading(), postTrail, ((Leading) alignment).getSize());
          constraints = new Constraints(constraints.getHorizontal(), bilateral);
        }
        layout.setConstraints(child, constraints);
      }
    } else if (postAlignment instanceof Leading) {
      Leading postLeading = (Leading) postAlignment;
      int postLead = postLeading.getLeading() + postChild.getHeight();
      for (int i = 1; i < widgets.size(); i++) {
        WidgetAdapter adapter = widgets.get(i);
        Component child = adapter.getWidget();
        Constraints constraints = layout.getConstraints(child);
        CompCons cons = new CompCons();
        cons.component = child;
        cons.constraints = constraints;
        compcons.add(cons);
        Alignment alignment = constraints.getVertical();
        if (alignment instanceof Trailing) {
          int l = postLead - child.getHeight();
          Leading trailing = new Leading(l, 10, child.getHeight());
          constraints = new Constraints(constraints.getHorizontal(), trailing);
        } else if (alignment instanceof Bilateral) {
          int l = postLead - child.getHeight();
          Leading leading = new Leading(l, 10, child.getHeight());
          constraints = new Constraints(constraints.getHorizontal(), leading);
        } else if (alignment instanceof Leading) {
          Leading leading = (Leading) alignment.clone();
          leading.setLeading(postLead - child.getHeight());
          constraints = new Constraints(constraints.getHorizontal(), leading);
        }
        layout.setConstraints(child, constraints);
      }
View Full Code Here

      CompositeAdapter containerAdapter = (CompositeAdapter) WidgetAdapter
          .getWidgetAdapter(container);
      Constraints constraints = (Constraints) containerAdapter
          .getChildConstraints(child);
      if (horizontal) {
        Alignment alignment = constraints.getHorizontal();
        if (alignment instanceof Leading) {
          if (anchor.equals("bilateral")) {
            operation = new HorizontalLeadingToBilateral(
                constraints, container, child);
          } else if (anchor.equals("trailing")) {
            operation = new HorizontalLeadingToTrailing(constraints, container, child);
          }
        } else if (alignment instanceof Bilateral) {
          if (anchor.equals("leading")) {
            operation = new HorizontalBilateralToLeading(constraints, container, child);
          } else if (anchor.equals("trailing")) {
            operation = new HorizontalBilateralToTrailing(constraints, container, child);
          }
        } else if (alignment instanceof Trailing) {
          if (anchor.equals("leading")) {
            operation = new HorizontalTrailingToLeading(constraints, container, child);
          } else if (anchor.equals("bilateral")) {
            operation = new HorizontalTrailingToBilteral(constraints, container, child);
          }
        }
      } else {
        Alignment alignment = constraints.getVertical();
        if (alignment instanceof Leading) {
          if (anchor.equals("bilateral")) {
            operation = new VerticalLeadingToBilateral(
                constraints, container, child);
          } else if (anchor.equals("trailing")) {
View Full Code Here

      Constraints constraints = new Constraints(new Leading(np.x
          - insets.left, drop.getWidth(), spring), new Leading(np.y
          - insets.top, drop.getHeight(), spring));
      container.add(drop, constraints);
    } else {
      Alignment horizontal = null;
      Alignment vertical = null;
      if (pair.hQuart == null && pair.vQuart != null) {
        int x = pair.vQuart.masc - hot.x;
        int y = p.y - hot.y;
        int width = drop.getWidth();
        int height = drop.getHeight();
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 (lastAxis instanceof Leading) {
      if (horizontal instanceof Leading) {
        return createHorizontalLeading(me, bounds, parent);
      } else if (horizontal instanceof Trailing) {
        return createHorizontalSpring(me, bounds, parent);
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

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.