Package org.dyno.visual.swing.plugin.spi

Examples of org.dyno.visual.swing.plugin.spi.CompositeAdapter


    super(layout,tracingAdapter, op, container);
  }

 
  public boolean dragOver(Point p) {
    CompositeAdapter parent = (CompositeAdapter) WidgetAdapter.getWidgetAdapter(container);
    JComponent todrop = (JComponent)tracingAdapter.getWidget();
    Point lp = p;
    if (last_point == null) {
      last_point = lp;
      adapter.setHovered(true);
      return false;
    }
    if (lp.equals(last_point))
      return false;
    pair = calculateMascotLocation(todrop, lp, azimuth);
    Point np = pair == null ? lp : new Point(pair.vQuart == null ? lp.x : pair.vQuart.masc, pair.hQuart == null ? lp.y : pair.hQuart.masc);
    Point sp = parent.getMascotLocation();
    parent.setMascotLocation(np);
    int x = sp.x + todrop.getWidth();
    int y = sp.y + todrop.getHeight();
    int cw = x - np.x;
    int ch = y - np.y;
    todrop.setSize(cw, ch);
View Full Code Here


  private QuartetPair pair;

 
  public boolean drop(Point p) {
    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
View Full Code Here

    return true;
  }

 
  public boolean dragEnter(Point p) {
    CompositeAdapter parent = (CompositeAdapter) WidgetAdapter.getWidgetAdapter(container);
    parent.setMascotLocation(p);
    last_point = p;
    adapter.setHovered(true);
    return true;
  }
View Full Code Here

    super(layout, tracingAdapter,op, container);
  }

 
  public boolean dragOver(Point p) {
    CompositeAdapter parent = (CompositeAdapter) WidgetAdapter.getWidgetAdapter(container);
    JComponent todrop = (JComponent)tracingAdapter.getWidget();
    Point lp = p;
    if (last_point == null) {
      last_point = lp;
      adapter.setHovered(true);
      return false;
    }
    if (lp.equals(last_point))
      return false;
    pair = calculateMascotLocation(todrop, lp, azimuth);
    Point np = pair == null ? lp : new Point(pair.vQuart == null ? lp.x : pair.vQuart.masc, pair.hQuart == null ? lp.y : pair.hQuart.masc);
    Point sp = parent.getMascotLocation();
    int y = sp.y + todrop.getHeight();
    int cw = np.x - sp.x;
    int ch = y - np.y;
    todrop.setSize(cw, ch);
    np.x = sp.x;
    parent.setMascotLocation(np);
    azimuth = getAzimuth(p, last_point);
    last_point = lp;
    return true;
  }
View Full Code Here

  private QuartetPair pair;

 
  public boolean drop(Point p) {
    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
View Full Code Here

    return true;
  }

 
  public boolean dragEnter(Point p) {
    CompositeAdapter parent = (CompositeAdapter) WidgetAdapter.getWidgetAdapter(container);
    parent.setMascotLocation(p);
    last_point = p;
    adapter.setHovered(true);
    return true;
  }
View Full Code Here

  }

  @Override
  public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
    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);
      }
    }
    container.invalidate();
    containerAdapter.doLayout();
    containerAdapter.setDirty(true);
    containerAdapter.repaintDesigner();
    return Status.OK_STATUS;
  }
View Full Code Here

  }

  @Override
  public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
    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 Leading || postAlignment instanceof Bilateral) {
      int postLead;
      if (postAlignment instanceof Leading)
        postLead = ((Leading) postAlignment).getLeading();
      else
        postLead = ((Bilateral) postAlignment).getLeading();
      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 Leading) {
          Leading leading = (Leading) alignment.clone();
          leading.setLeading(postLead);
          constraints = new Constraints(constraints.getHorizontal(), leading);
        } else if (alignment instanceof Bilateral) {
          Bilateral bilateral = (Bilateral) alignment.clone();
          bilateral.setLeading(postLead);
          constraints = new Constraints(constraints.getHorizontal(), bilateral);
        } else if (alignment instanceof Trailing) {
          Bilateral bilateral = new Bilateral(postLead, ((Trailing) alignment).getTrailing(), ((Trailing) alignment).getSize());
          constraints = new Constraints(constraints.getHorizontal(), bilateral);
        }
        layout.setConstraints(child, constraints);
      }
    } else if (postAlignment instanceof Trailing) {
      Trailing postTrailing = (Trailing) postAlignment;
      int postTrail = postTrailing.getTrailing() + 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 Leading) {
          int t = postTrail - child.getHeight();
          Trailing trailing = new Trailing(t, 10, child.getHeight());
          constraints = new Constraints(constraints.getHorizontal(), trailing);
        } else if (alignment instanceof Bilateral) {
          int t = postTrail - child.getHeight();
          Trailing trailing = new Trailing(t, 10, child.getHeight());
          constraints = new Constraints(constraints.getHorizontal(), trailing);
        } else if (alignment instanceof Trailing) {
          Trailing trailing = (Trailing) alignment.clone();
          trailing.setTrailing(postTrail - child.getHeight());
          constraints = new Constraints(constraints.getHorizontal(), trailing);
        }
        layout.setConstraints(child, constraints);
      }
    }
    container.invalidate();
    containerAdapter.doLayout();
    containerAdapter.setDirty(true);
    containerAdapter.repaintDesigner();
    return Status.OK_STATUS;
  }
View Full Code Here

    super(layout, tracingAdapter,op, container);
  }

 
  public boolean dragOver(Point p) {
    CompositeAdapter parent = (CompositeAdapter) WidgetAdapter.getWidgetAdapter(container);
    JComponent todrop = (JComponent)tracingAdapter.getWidget();
    Point lp = p;
    if (last_point == null) {
      last_point = lp;
      adapter.setHovered(true);
      return false;
    }
    if (lp.equals(last_point))
      return false;
    pair = calculateMascotLocation(todrop, lp, azimuth);
    Point np = pair == null ? lp : new Point(lp.x, pair.hQuart.masc);
    Point sp = parent.getMascotLocation();
    int y = sp.y + todrop.getHeight();
    int cw = todrop.getWidth();
    int ch = y - np.y;
    todrop.setSize(cw, ch);
    azimuth = getAzimuth(p, last_point);
    last_point = lp;
    np.x = sp.x;
    parent.setMascotLocation(np);
    return true;
  }
View Full Code Here

  private QuartetPair pair;

 
  public boolean drop(Point p) {
    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();
    Spring spring = new Spring(10, 10);// TODO should be replaced by a
View Full Code Here

TOP

Related Classes of org.dyno.visual.swing.plugin.spi.CompositeAdapter

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.