Package org.dyno.visual.swing.layouts

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


        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());
          constraints = new Constraints(bilateral, constraints.getVertical());
        } else if (alignment instanceof Bilateral) {
          Bilateral leading = (Bilateral) alignment;
          Bilateral bilateral = (Bilateral) postAlignment.clone();
          bilateral.setTrailing(leading.getTrailing());
          bilateral.setLeading(leading.getLeading());
          constraints = new Constraints(bilateral, constraints.getVertical());
        } else if (alignment instanceof Trailing) {
          Trailing trailing = (Trailing) alignment;
          Bilateral bilateral = (Bilateral) postAlignment.clone();
          bilateral.setTrailing(trailing.getTrailing());
View Full Code Here


    int height = drop.getHeight();
    Spring spring = new Spring(10, 10);// TODO should be replaced by a
                      // container gap.
    if (pair == null || pair.vQuart == null) {
      if (horizontal instanceof Leading)
        horizontal = new Leading(x - insets.left, width, spring);
      else if (horizontal instanceof Trailing)
        horizontal = new Trailing(container.getWidth() - x - width - insets.right, width, spring);
      else if (horizontal instanceof Bilateral)
        horizontal = new Trailing(container.getWidth() - x - width - insets.right, width, spring);
    } else {
View Full Code Here

          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

    Point hot = dropAdapter.getHotspotPoint();
    Spring spring = new Spring(10, 10);// TODO should be replaced by a
    // container gap.
    if (pair == null) {
      Point np = new Point(p.x - hot.x, p.y - hot.y);
      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();
        vertical = new Leading(y - insets.top, height, spring);
        horizontal = pair.vQuart.anchor.createHoveredAxis(drop,
            new Rectangle(x, y, width, height));
      } else if (pair.hQuart != null && pair.vQuart == null) {
        int x = p.x - hot.x;
        int y = pair.hQuart.masc - hot.y;
        int width = drop.getWidth();
        int height = drop.getHeight();
        horizontal = new Leading(x - insets.left, width, spring);
        vertical = pair.hQuart.anchor.createHoveredAxis(drop,
            new Rectangle(x, y, width, height));
      } else if (pair.hQuart != null && pair.vQuart != null) {
        int x = pair.vQuart.masc - hot.x;
        int y = pair.hQuart.masc - hot.y;
View Full Code Here

    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);
View Full Code Here

      min = gap;
    if (gap > pref)
      pref = gap;
    Spring spring = new Spring(min, pref);
    Insets insets = parent.getInsets();
    return new Leading(bounds.y - insets.top, bounds.height, spring);
  }
View Full Code Here

        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;
          int pref_size = leading.getSize() == Alignment.PREFERRED ? prefs.height : leading.getSize();
          int min_size = pref_size > mins.height ? mins.height : pref_size;
          int actual = gap + min_size + leading.getLeading();
          if (actual > min)
            min = actual;
          actual = gap + pref_size + leading.getLeading();
          if (actual > pref)
            pref = actual;
        } else if (vertical instanceof Bilateral) {
          int gap = layoutStyle.getPreferredGap((JComponent) target, (JComponent) me, ComponentPlacement.RELATED, SwingConstants.SOUTH, parent);
          Bilateral bilateral = (Bilateral) vertical;
View Full Code Here

      min = gap;
    if (gap > pref)
      pref = gap;
    Spring spring = new Spring(min, pref);
    Insets insets = parent.getInsets();
    return new Leading(bounds.x - insets.left, bounds.width, spring);
  }
View Full Code Here

        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;
          int pref_size = leading.getSize() == Alignment.PREFERRED ? prefs.width : leading.getSize();
          int min_size = pref_size > mins.width ? mins.width : pref_size;
          int actual = gap + min_size + leading.getLeading();
          if (actual > min)
            min = actual;
          actual = gap + pref_size + leading.getLeading();
          if (actual > pref)
            pref = actual;
        } else if (horizontal instanceof Bilateral) {
          int gap = layoutStyle.getPreferredGap((JComponent) target, (JComponent) me, ComponentPlacement.RELATED, SwingConstants.EAST, parent);
          Bilateral bilateral = (Bilateral) horizontal;
View Full Code Here

    return last_constraints;
  }

  @Override
  public void addChild(Component widget) {
    Constraints cons = new Constraints(new Leading(10, 10, 10), new Leading(10, 10, 10));
    container.add(widget, cons);
  }
View Full Code Here

TOP

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

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.