예제 #1
0
 static Container flow(XComponent layout) {
   Container panel = new Container();
   for (XComponent component : ((XContainer) layout).components) {
     panel.addComponent(render(component));
   }
   return panel;
 }
예제 #2
0
 static Container box(XComponent layout, int axis) {
   Container panel = new Container();
   panel.setLayout(new BoxLayout(axis));
   for (XComponent component : ((XContainer) layout).components) {
     panel.addComponent(render(component));
   }
   return panel;
 }
예제 #3
0
  public Container createDemo() {
    final Container effects = new Container(new BoxLayout(BoxLayout.Y_AXIS));
    effects.setScrollableY(true);
    Button interlace = new Button("Interlace");
    Button fall = new Button("Fall");
    Button concentrate = new Button("Concentrate");
    final Button grow = new Button("Grow");
    final Button morph = new Button("Morph");
    Button dragAndDrop = new Button("Drag & Drop");
    final Button replace = new Button("Replace Slide");
    final Button replaceFade = new Button("Replace Fade");
    final Button replaceCover = new Button("Replace Cover");
    // Button shake = new Button("Shake");

    interlace.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            arrangeForInterlace(effects);
            effects.animateUnlayoutAndWait(800, 20);
            effects.animateHierarchyFade(800, 20);
          }
        });

    fall.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            arrangeForFall(effects);
            effects.animateUnlayoutAndWait(800, 20);
            effects.animateHierarchyFade(800, 20);
          }
        });

    concentrate.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            arrangeForConcentrate(effects);
            effects.animateUnlayoutAndWait(800, 20);
            effects.animateHierarchyFade(800, 20);
          }
        });

    grow.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            grow.setPreferredH(grow.getPreferredH() * 3);
            effects.animateLayoutAndWait(800);
            grow.setPreferredSize(null);
            effects.animateLayoutAndWait(800);
          }
        });

    morph.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            TextArea ta = new TextArea("Morphed Text Area");
            ta.setVisible(false);
            effects.addComponent(0, ta);
            effects.animateLayoutAndWait(400);
            ta.setVisible(true);
            effects.morphAndWait(morph, ta, 3000);
            effects.removeComponent(morph);
            effects.revalidate();
            effects.addComponent(morph);
            effects.morphAndWait(ta, morph, 3000);
            effects.removeComponent(ta);
            effects.animateLayout(400);
          }
        });

    replace.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            TextArea ta = new TextArea("Replaced Text Area");
            Container c = replace.getParent();
            ta.setPreferredSize(replace.getPreferredSize());
            c.replaceAndWait(
                replace,
                ta,
                CommonTransitions.createSlide(CommonTransitions.SLIDE_VERTICAL, true, 500));
            c.replaceAndWait(
                ta,
                replace,
                CommonTransitions.createSlide(CommonTransitions.SLIDE_VERTICAL, false, 500));
          }
        });

    replaceFade.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            TextArea ta = new TextArea("Replaced Text Area");
            Container c = replaceFade.getParent();
            ta.setPreferredSize(replaceFade.getPreferredSize());
            c.replaceAndWait(replaceFade, ta, CommonTransitions.createFade(500));
            c.replaceAndWait(ta, replaceFade, CommonTransitions.createFade(500));
          }
        });

    replaceCover.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            TextArea ta = new TextArea("Replaced Text Area");
            Container c = replaceCover.getParent();
            ta.setPreferredSize(replaceCover.getPreferredSize());
            c.replaceAndWait(
                replaceCover,
                ta,
                CommonTransitions.createCover(CommonTransitions.SLIDE_VERTICAL, true, 500));
            c.replaceAndWait(
                ta,
                replaceCover,
                CommonTransitions.createCover(CommonTransitions.SLIDE_VERTICAL, false, 500));
          }
        });

    dragAndDrop.setDraggable(true);
    effects.setDropTarget(true);

    effects.addComponent(interlace);
    effects.addComponent(fall);
    effects.addComponent(grow);
    effects.addComponent(morph);
    effects.addComponent(replace);
    effects.addComponent(replaceFade);
    effects.addComponent(replaceCover);
    effects.addComponent(concentrate);
    effects.addComponent(dragAndDrop);
    // effects.addComponent(shake);

    return effects;
  }
예제 #4
0
 private Container createTableDemo() {
   Container tableContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
   Table dt = new Table();
   tableContainer.addComponent(dt);
   return tableContainer;
 }
예제 #5
0
 private Container createTreeDemo() {
   Container treeContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
   Tree dt = new Tree();
   treeContainer.addComponent(dt);
   return treeContainer;
 }
예제 #6
0
 private Container createSpinnerDemo() {
   Container spinnerContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
   DateTimeSpinner dt = new DateTimeSpinner();
   spinnerContainer.addComponent(dt);
   return spinnerContainer;
 }