Package org.dyno.visual.swing.layouts

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


    if (!hovered) {
      Graphics2D g2d = (Graphics2D) g;
      Stroke old = g2d.getStroke();
      g2d.setColor(BASELINE_COLOR);
      g2d.setStroke(STROKE2);
      GroupLayout layout = (GroupLayout) container.getLayout();
      int width = container.getWidth();
      int height = container.getHeight();
      Insets insets = container.getInsets();
      CompositeAdapter adapter = (CompositeAdapter) WidgetAdapter.getWidgetAdapter(container);
      int count = adapter.getChildCount();
      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();
View Full Code Here


    return true;
  }

  @Override
  public boolean removeChild(Component child) {
    GroupLayout layout = (GroupLayout) container.getLayout();
    last_constraints = layout.getConstraints(child);
    assert last_constraints != null;
    container.remove(child);
    container.validate();
    return true;
  }
View Full Code Here

      Constraints constraints = new Constraints(horizontal, vertical);
      comps.put(widget, constraints);
      array.add(widget);
    }
    container.removeAll();
    GroupLayout layout = new GroupLayout();
    container.setLayout(layout);
    for (JComponent widget : array) {
      Constraints constraints = comps.get(widget);
      container.add(widget, constraints);
    }
View Full Code Here

  }

  @Override
  public boolean cloneLayout(JComponent panel) {
    panel.setLayout(copyLayout(panel));
    GroupLayout layout = (GroupLayout) container.getLayout();
    CompositeAdapter parent = (CompositeAdapter) WidgetAdapter.getWidgetAdapter(container);
    int count = parent.getChildCount();
    for (int i = 0; i < count; i++) {
      JComponent child = (JComponent) parent.getChild(i);
      WidgetAdapter cAdapter = WidgetAdapter.getWidgetAdapter(child);
      Constraints childConstraints = layout.getConstraints(child);
      panel.add(cAdapter.cloneWidget(), childConstraints==null?null:childConstraints.clone());
    }
    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 vertical = constraints.getVertical();
    if (vertical instanceof Leading) {
      return createVerticalLeading(me, bounds, parent);
    } else if (vertical instanceof Trailing) {
      return createVerticalTrailing(me, bounds, parent);
View Full Code Here

  @Override
  protected LayoutManager copyLayout(Container con) {
    LayoutManager layout = con.getLayout();
    if (layout == null || layout.getClass() != GroupLayout.class)
      return new GroupLayout();
    else
      return layout;
  }
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) {
      if (lastAxis instanceof Leading)
View Full Code Here

      return layout;
  }

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

      }
    }
  }

  private void adjustVerticalTrailingBy(Component widget, int delta_height) {
    GroupLayout layout = (GroupLayout) container.getLayout();
    CompositeAdapter containerAdapter = (CompositeAdapter) WidgetAdapter.getWidgetAdapter(container);
    int count = containerAdapter.getChildCount();
    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);
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);
View Full Code Here

TOP

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

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.