/* * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package org.jemmy.browser; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import javax.swing.table.DefaultTableModel; import org.jemmy.control.Wrap; /** * * @author shura */ public class PropertiesPanel extends javax.swing.JPanel { DefaultTableModel model; /** Creates new form PropertiesPanel */ public PropertiesPanel() { model = new DefaultTableModel(); model.addColumn("Property"); model.addColumn("Class"); model.addColumn("Value"); initComponents(); } public DefaultTableModel getTableModel() { return model; } public void setWrap(Wrap control) { while (getTableModel().getRowCount() > 0) { getTableModel().removeRow(0); } if (control != null) { HashMap props = control.getPropertiesQiuet(); Object val; ArrayList propNames = new ArrayList(props.keySet()); Collections.sort(propNames); for (String pk : propNames) { val = props.get(pk); if(val != null) { model.addRow(new Object[]{pk, val.getClass().getName(), val.toString()}); } else { model.addRow(new Object[]{pk, "null", "null"}); } } } revalidate(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jTable1.setModel(getTableModel()); jScrollPane1.setViewportView(jTable1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE) ); }// //GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable jTable1; // End of variables declaration//GEN-END:variables }