1 19 20 package org.netbeans.test.xml.schema.core.lib; 21 import javax.swing.JList ; 22 import org.netbeans.jellytools.TopComponentOperator; 23 import org.netbeans.jellytools.actions.SaveAllAction; 24 import org.netbeans.jemmy.operators.JComponentOperator; 25 import org.netbeans.jemmy.operators.JListOperator; 26 import org.netbeans.jemmy.operators.JToggleButtonOperator; 27 import org.netbeans.test.xml.schema.core.lib.util.Helpers; 28 29 33 public class SchemaMultiView { 34 35 private TopComponentOperator m_opTopComponent; 36 37 private JToggleButtonOperator m_opSchemaButton; 38 private JToggleButtonOperator m_opDesignButton; 39 private JToggleButtonOperator m_opSourceButton; 40 41 private JToggleButtonOperator m_opColumnsButton; 42 private JToggleButtonOperator m_opTreeButton; 43 44 private boolean m_bMacOS = true; 45 46 49 public SchemaMultiView(String strTopComponentName) { 50 m_opTopComponent = new TopComponentOperator(strTopComponentName); 51 52 JComponentOperator opToolbar = Helpers.getComponentOperator(m_opTopComponent, "org.netbeans.core.multiview.TabsComponent$TB", 0); 54 55 if (opToolbar == null) { 57 opToolbar = Helpers.getComponentOperator(m_opTopComponent, "javax.swing.JToolBar", 0); 58 m_bMacOS = false; 59 } 60 61 JComponentOperator opSchemaViewToolbar = Helpers.getComponentOperator(m_opTopComponent, "javax.swing.JToolBar", m_bMacOS ? 0: 1); 62 63 m_opSchemaButton = new JToggleButtonOperator(opToolbar, "Schema"); 64 m_opDesignButton = new JToggleButtonOperator(opToolbar, "Design"); 65 m_opSourceButton = new JToggleButtonOperator(opToolbar, "Source"); 66 67 switchToSchema(); 68 69 m_opColumnsButton = new JToggleButtonOperator(opSchemaViewToolbar, 0); 70 m_opTreeButton = new JToggleButtonOperator(opSchemaViewToolbar, 1); 71 } 72 73 public TopComponentOperator getTopComponentOperator() { 74 return m_opTopComponent; 75 } 76 77 public void switchToSchema() { 78 m_opSchemaButton.push(); 79 Helpers.waitNoEvent(); 80 } 81 82 public void switchToDesign() { 83 m_opDesignButton.push(); 84 Helpers.waitNoEvent(); 85 } 86 87 public void switchToSource() { 88 m_opSourceButton.push(); 89 Helpers.waitNoEvent(); 90 } 91 92 public void switchToSchemaColumns() { 93 m_opColumnsButton.push(); 94 Helpers.waitNoEvent(); 95 } 96 97 public void switchToSchemaTree() { 98 m_opTreeButton.push(); 99 Helpers.waitNoEvent(); 100 } 101 102 public JListOperator getColumnListOperator(int column) { 103 JComponentOperator opComponent = Helpers.getComponentOperator(m_opTopComponent, "org.netbeans.modules.xml.xam.ui.column.ColumnListView$ColumnList", column, 200); 104 if (opComponent == null) { 105 return null; 106 } 107 JList list = (JList ) opComponent.getSource(); 108 109 return new JListOperator(list); 110 } 111 112 public void close() { 113 new SaveAllAction().performAPI(); 114 115 m_opTopComponent.close(); 116 } 117 } 118 | Popular Tags |