示例#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
 private void arrangeForFall(Container c) {
   int w = Display.getInstance().getDisplayWidth();
   for (int iter = 0; iter < c.getComponentCount(); iter++) {
     Component cmp = c.getComponentAt(iter);
     cmp.setY(-c.getHeight());
   }
 }
示例#3
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;
 }
 /**
  * Handle disposal of the web browser after auth complete
  *
  * @param webBrowser
  */
 public void onDisposeLogin(final Form backForm, final WebBrowser webBrowser) {
   webBrowser.stop();
   Container parent = webBrowser.getParent();
   parent.removeComponent(webBrowser);
   parent.revalidate();
   if (backForm != null) {
     backForm.showBack();
   }
 }
示例#5
0
 private void arrangeForConcentrate(Container c) {
   int w = Display.getInstance().getDisplayWidth();
   int h = Display.getInstance().getDisplayHeight();
   int[] positionX = {-100, w / 2, w + 100, w + 100, w + 100, w / 2, -100, -100};
   int[] positionY = {-100, -100, -100, h / 2, h + 100, h + 100, h + 100, h / 2};
   for (int iter = 0; iter < c.getComponentCount(); iter++) {
     Component cmp = c.getComponentAt(iter);
     cmp.setY(positionY[iter % positionY.length]);
     cmp.setX(positionX[iter % positionX.length]);
   }
 }
示例#6
0
 private void arrangeForInterlace(Container c) {
   int w = Display.getInstance().getDisplayWidth();
   for (int iter = 0; iter < c.getComponentCount(); iter++) {
     Component cmp = c.getComponentAt(iter);
     if (iter % 2 == 0) {
       cmp.setX(-w);
     } else {
       cmp.setX(w);
     }
   }
 }
 protected void postShowContainer(Container c) {
   if ("Main".equals(c.getName())) {
     postContainerMain(c);
     aboutToShowThisContainer = null;
     return;
   }
 }
 protected void beforeShowContainer(Container c) {
   aboutToShowThisContainer = c;
   if ("Main".equals(c.getName())) {
     beforeContainerMain(c);
     aboutToShowThisContainer = null;
     return;
   }
 }
 protected void handleComponentAction(Component c, ActionEvent event) {
   Container rootContainerAncestor = getRootAncestor(c);
   if (rootContainerAncestor == null) return;
   String rootContainerName = rootContainerAncestor.getName();
   if (c.getParent().getLeadParent() != null) {
     c = c.getParent().getLeadParent();
   }
   if (rootContainerName == null) return;
   if (rootContainerName.equals("Main")) {
     if ("TextArea".equals(c.getName())) {
       onMain_TextAreaAction(c, event);
       return;
     }
     if ("MultiButton".equals(c.getName())) {
       onMain_MultiButtonAction(c, event);
       return;
     }
     if ("Button".equals(c.getName())) {
       onMain_ButtonAction(c, event);
       return;
     }
     if ("MultiButton2".equals(c.getName())) {
       onMain_MultiButton2Action(c, event);
       return;
     }
     if ("MultiButton4".equals(c.getName())) {
       onMain_MultiButton4Action(c, event);
       return;
     }
     if ("MultiButton1".equals(c.getName())) {
       onMain_MultiButton1Action(c, event);
       return;
     }
     if ("MultiButton3".equals(c.getName())) {
       onMain_MultiButton3Action(c, event);
       return;
     }
   }
 }
 public void paint(Graphics g) {
   Component cmp =
       renderer.getCellRendererComponent(
           ContainerList.this, model, model.getItemAt(offset), offset, hasFocus());
   cmp.setX(getX());
   cmp.setY(getY());
   cmp.setWidth(getWidth());
   cmp.setHeight(getHeight());
   if (cmp instanceof Container) {
     ((Container) cmp).revalidate();
   }
   cmp.setFocus(hasFocus());
   cmp.paintComponent(g);
 }
 public Dimension calcPreferredSize() {
   Component c =
       renderer.getCellRendererComponent(
           ContainerList.this, model, model.getItemAt(offset), offset, hasFocus());
   if (getWidth() <= 0) {
     c.setWidth(Display.getInstance().getDisplayWidth());
     c.setHeight(Display.getInstance().getDisplayHeight());
   } else {
     c.setWidth(getWidth());
     c.setHeight(getHeight());
   }
   if (c instanceof Container) {
     ((Container) c).revalidate();
   }
   Dimension d = c.getPreferredSize();
   return d;
 }
示例#12
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;
  }
示例#13
0
 private Container createTableDemo() {
   Container tableContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
   Table dt = new Table();
   tableContainer.addComponent(dt);
   return tableContainer;
 }
示例#14
0
 private Container createTreeDemo() {
   Container treeContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
   Tree dt = new Tree();
   treeContainer.addComponent(dt);
   return treeContainer;
 }
示例#15
0
 private Container createSpinnerDemo() {
   Container spinnerContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
   DateTimeSpinner dt = new DateTimeSpinner();
   spinnerContainer.addComponent(dt);
   return spinnerContainer;
 }