public void testCardLayout() throws Exception {
   JComponent rootComponent = getInstrumentedRootComponent("TestCardLayout.form", "BindingTest");
   assertTrue(rootComponent.getLayout() instanceof CardLayout);
   CardLayout cardLayout = (CardLayout) rootComponent.getLayout();
   assertEquals(10, cardLayout.getHgap());
   assertEquals(20, cardLayout.getVgap());
 }
 public void testCardLayoutShow() throws Exception {
   JComponent rootComponent =
       getInstrumentedRootComponent("TestCardLayoutShow.form", "BindingTest");
   assertTrue(rootComponent.getLayout() instanceof CardLayout);
   assertEquals(rootComponent.getComponentCount(), 2);
   assertFalse(rootComponent.getComponent(0).isVisible());
   assertTrue(rootComponent.getComponent(1).isVisible());
 }
  public void testGridLayout() throws Exception {
    JComponent rootComponent =
        getInstrumentedRootComponent("TestGridConstraints.form", "BindingTest");
    final LayoutManager layout = rootComponent.getLayout();
    assertTrue(isInstanceOf(layout, GridLayoutManager.class.getName()));

    assertEquals(1, invokeMethod(layout, "getRowCount"));
    assertEquals(1, invokeMethod(layout, "getColumnCount"));
  }
Ejemplo n.º 4
0
 public void setVisible(boolean bShow, String title) {
   if (bShow) {
     String strDir = "";
     String strFreq = "";
     String strTraynum = "";
     m_strHelpFile = getHelpFile(title);
     String strSampleName = getSampleName(title);
     String frameBounds = getFrameBounds(title);
     StringTokenizer tok = new QuotedStringTokenizer(title);
     if (tok.hasMoreTokens()) strDir = tok.nextToken();
     if (tok.hasMoreTokens()) strFreq = tok.nextToken();
     if (tok.hasMoreTokens()) strTraynum = tok.nextToken();
     else {
       try {
         Integer.parseInt(strDir);
         // if strdir is number, then strdir is empty, and the
         // strfreq is the number
         strTraynum = strFreq;
         strFreq = strDir;
         strDir = "";
       } catch (Exception e) {
       }
     }
     try {
       setTitle(gettitle(strFreq));
       m_lblSampleName.setText("3");
       boolean bVast = isVast(strTraynum);
       CardLayout layout = (CardLayout) m_pnlSampleName.getLayout();
       if (!bVast) {
         if (strSampleName == null) {
           strSampleName = getSampleName(strDir, strTraynum);
         }
         m_lblSampleName.setText(strSampleName);
         layout.show(m_pnlSampleName, OTHER);
       } else {
         m_strDir = strDir;
         setTrays();
         layout.show(m_pnlSampleName, VAST);
         m_trayTimer.start();
       }
       boolean bSample = bVast || !strSampleName.trim().equals("");
       m_pnlSampleName.setVisible(bSample);
       m_lblLogin.setForeground(getBackground());
       m_lblLogin.setVisible(false);
       m_passwordField.setText("");
       m_passwordField.setCaretPosition(0);
     } catch (Exception e) {
       Messages.writeStackTrace(e);
     }
     setBounds(frameBounds);
     ExpPanel exp = Util.getActiveView();
     if (exp != null) exp.waitLogin(true);
   }
   writePersistence();
   setVisible(bShow);
 }
  public void testGridConstraints() throws Exception {
    JComponent rootComponent =
        getInstrumentedRootComponent("TestGridConstraints.form", "BindingTest");
    assertEquals(1, rootComponent.getComponentCount());
    final LayoutManager layout = rootComponent.getLayout();
    assertTrue(isInstanceOf(layout, GridLayoutManager.class.getName()));

    final Object constraints =
        invokeMethod(layout, "getConstraints", new Class[] {int.class}, new Object[] {0});
    assertTrue(isInstanceOf(constraints, GridConstraints.class.getName()));

    assertEquals(1, invokeMethod(constraints, "getColSpan"));
    assertEquals(1, invokeMethod(constraints, "getRowSpan"));
  }