Java Examples for javax.swing.table.DefaultTableModel

The following java examples will help you to understand the usage of javax.swing.table.DefaultTableModel. These source code samples are taken from different open source projects.

Example 1
Project: drugis-common-master  File: EventObjectMatcherTest.java View source code
@Test
public void testMatches() {
    DefaultTableModel model = new DefaultTableModel();
    EventObjectMatcher matcher = new EventObjectMatcher(new TableModelEvent(model));
    assertTrue(matcher.matches(new TableModelEvent(model)));
    assertFalse(matcher.matches(new TableModelEvent(new DefaultTableModel())));
    assertFalse(matcher.matches(new ActionEvent(model, 0, "")));
}
Example 2
Project: jabref-master  File: JournalAbbreviationsUtil.java View source code
public static TableModel getTableModel(Collection<Abbreviation> abbreviations) {
    Object[][] cells = new Object[abbreviations.size()][2];
    int row = 0;
    for (Abbreviation abbreviation : abbreviations) {
        cells[row][0] = abbreviation.getName();
        cells[row][1] = abbreviation.getIsoAbbreviation();
        row++;
    }
    return new DefaultTableModel(cells, new Object[] { Localization.lang("Full name"), Localization.lang("Abbreviation") }) {

        @Override
        public boolean isCellEditable(int row1, int column) {
            return false;
        }
    };
}
Example 3
Project: SubTools-master  File: PopupListener.java View source code
private synchronized void showPopup(MouseEvent e) {
    if (e.isPopupTrigger()) {
        final CustomTable t = (CustomTable) e.getComponent();
        if (t == null)
            return;
        final DefaultTableModel model = (DefaultTableModel) t.getModel();
        if (model.getRowCount() > 0)
            popupMenu.show(e.getComponent(), e.getX(), e.getY());
    }
}
Example 4
Project: OOjDREW-master  File: TopDownApp.java View source code
// TODO: This method was copied from the old GUI and has been modified to
// work with the current code base. This code should be rewritten in a much
// cleaner fashion.
private void processQuery(DefiniteClause dc) {
    // TODO: Find a way to use the existing backwardReasoner (for the sake
    // of dependency injection)
    setReasoner(new BackwardReasoner(getReasoner().clauses, getReasoner().oids));
    queryResultIterator = getReasoner().iterativeDepthFirstSolutionIterator(dc);
    getUI().setBtnNextSolutionEnabled(true);
    if (!queryResultIterator.hasNext()) {
        javax.swing.tree.DefaultMutableTreeNode root = new DefaultMutableTreeNode("unknown");
        javax.swing.tree.DefaultTreeModel dtm = new DefaultTreeModel(root);
        getUI().setSolutionTreeModel(dtm);
        getUI().setBtnNextSolutionEnabled(false);
        getUI().setVariableBindingsTableModel(new javax.swing.table.DefaultTableModel(new Object[][] { { null, null } }, new String[] { "Variable", "Binding" }));
    } else {
        BackwardReasoner.GoalList gl = (BackwardReasoner.GoalList) queryResultIterator.next();
        Hashtable varbind = gl.varBindings;
        javax.swing.tree.DefaultMutableTreeNode root = getReasoner().toTree();
        root.setAllowsChildren(true);
        javax.swing.tree.DefaultTreeModel dtm = new DefaultTreeModel(root);
        getUI().setSolutionTreeModel(dtm);
        int i = 0;
        Object[][] rowdata = new Object[varbind.size()][2];
        Enumeration e = varbind.keys();
        while (e.hasMoreElements()) {
            Object k = e.nextElement();
            Object val = varbind.get(k);
            String ks = (String) k;
            rowdata[i][0] = ks;
            rowdata[i][1] = val;
            i++;
        }
        String[] colnames = new String[] { "Variable", "Binding" };
        getUI().setVariableBindingsTableModel(new javax.swing.table.DefaultTableModel(rowdata, colnames));
    }
    if (!queryResultIterator.hasNext()) {
        getUI().setBtnNextSolutionEnabled(false);
    }
}
Example 5
Project: ASH-Viewer-master  File: JTableHelper.java View source code
public static TableModel createTableModel(Object rowData[][], Object columnNames[][]) {
    DefaultTableModel model = new LocalTableModel();
    for (int a = 0; a < columnNames.length; a++) {
        for (int b = 0; b < columnNames[a].length; b++) model.addColumn(columnNames[a][b]);
    }
    for (int a = 0; a < rowData.length; a++) {
        model.addRow(rowData[a]);
    }
    return model;
}
Example 6
Project: aspectj-in-action-code-master  File: Main.java View source code
public static void main(String[] args) {
    JFrame appFrame = new JFrame();
    appFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    DefaultTableModel tableModel = new DefaultTableModel(4, 2);
    JTable table = new JTable(tableModel);
    appFrame.getContentPane().add(table);
    appFrame.pack();
    appFrame.setVisible(true);
    String value = "[0,0]";
    tableModel.setValueAt(value, 0, 0);
    JOptionPane.showMessageDialog(appFrame, "Press OK to continue");
    int rowCount = tableModel.getRowCount();
    System.out.println("Row count = " + rowCount);
    Color gridColor = table.getGridColor();
    System.out.println("Grid color = " + gridColor);
}
Example 7
Project: bitten-master  File: AddressListRenderer.java View source code
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
    Collection<AddressListable> list = (Collection<AddressListable>) value;
    Object[][] data = new Object[list.size()][];
    Object[] columns = { "Address", "Value" };
    int i = 0;
    for (AddressListable l : list) {
        String add = "COINBASE";
        GraphAddress a = l.address();
        BigInteger v = l.value();
        if (a != null) {
            add = a.toString();
        }
        data[i] = new Object[] { add, Utils.bitcoinValueToFriendlyString(v) };
        i++;
    }
    JTable t = new JTable(new DefaultTableModel(data, columns));
    table.setRowHeight(64);
    return t;
}
Example 8
Project: micro-Blagajna-master  File: DbUtils.java View source code
/**
     *
     * @param rs
     * @return
     */
public static TableModel resultSetToTableModel(ResultSet rs) {
    try {
        ResultSetMetaData metaData = rs.getMetaData();
        int numberOfColumns = metaData.getColumnCount();
        Vector columnNames = new Vector();
        // Get the column names
        for (int column = 0; column < numberOfColumns; column++) {
            columnNames.addElement(metaData.getColumnLabel(column + 1));
        }
        // Get all rows.
        Vector rows = new Vector();
        while (rs.next()) {
            Vector newRow = new Vector();
            for (int i = 1; i <= numberOfColumns; i++) {
                newRow.addElement(rs.getObject(i));
            }
            rows.addElement(newRow);
        }
        return new DefaultTableModel(rows, columnNames);
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
Example 9
Project: micro-Blagajna-v1.x-master  File: DbUtils.java View source code
/**
     *
     * @param rs
     * @return
     */
public static TableModel resultSetToTableModel(ResultSet rs) {
    try {
        ResultSetMetaData metaData = rs.getMetaData();
        int numberOfColumns = metaData.getColumnCount();
        Vector columnNames = new Vector();
        // Get the column names
        for (int column = 0; column < numberOfColumns; column++) {
            columnNames.addElement(metaData.getColumnLabel(column + 1));
        }
        // Get all rows.
        Vector rows = new Vector();
        while (rs.next()) {
            Vector newRow = new Vector();
            for (int i = 1; i <= numberOfColumns; i++) {
                newRow.addElement(rs.getObject(i));
            }
            rows.addElement(newRow);
        }
        return new DefaultTableModel(rows, columnNames);
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
Example 10
Project: thredds-master  File: HidableTableColumnModelTest.java View source code
@Test
public void testTableModelResize() {
    DefaultTableModel model = new DefaultTableModel(6, 6);
    HidableTableColumnModel tcm = new HidableTableColumnModel(model);
    // At start numAllColumns == numVisibleColumns.
    Assert.assertEquals(tcm.getColumnCount(false), tcm.getColumnCount(true));
    // Remove column at modelIndex 1.
    tcm.setColumnVisible(tcm.getColumn(1, false), false);
    // Remove column at modelIndex 4.
    tcm.setColumnVisible(tcm.getColumn(4, false), false);
    // We've removed 2 columns.
    Assert.assertEquals(tcm.getColumnCount(false) - 2, tcm.getColumnCount(true));
    model.setColumnCount(10);
    Assert.assertEquals(10, tcm.getColumnCount(true));
    /*
         * This assertion failed in the original source code of XTableColumnModel.
         * From http://www.stephenkelvin.de/XTableColumnModel/:
         *     "There is one gotcha with this design: If you currently have invisible columns and change your table
         *     model the JTable will recreate columns, but will fail to remove any invisible columns."
         */
    Assert.assertEquals(10, tcm.getColumnCount(false));
}
Example 11
Project: UniCenta-master  File: DbUtils.java View source code
/**
     *
     * @param rs
     * @return
     */
public static TableModel resultSetToTableModel(ResultSet rs) {
    try {
        ResultSetMetaData metaData = rs.getMetaData();
        int numberOfColumns = metaData.getColumnCount();
        Vector columnNames = new Vector();
        // Get the column names
        for (int column = 0; column < numberOfColumns; column++) {
            columnNames.addElement(metaData.getColumnLabel(column + 1));
        }
        // Get all rows.
        Vector rows = new Vector();
        while (rs.next()) {
            Vector newRow = new Vector();
            for (int i = 1; i <= numberOfColumns; i++) {
                newRow.addElement(rs.getObject(i));
            }
            rows.addElement(newRow);
        }
        return new DefaultTableModel(rows, columnNames);
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
Example 12
Project: unicentaopos381-johnl-master  File: DbUtils.java View source code
/**
     *
     * @param rs
     * @return
     */
public static TableModel resultSetToTableModel(ResultSet rs) {
    try {
        ResultSetMetaData metaData = rs.getMetaData();
        int numberOfColumns = metaData.getColumnCount();
        Vector columnNames = new Vector();
        // Get the column names
        for (int column = 0; column < numberOfColumns; column++) {
            columnNames.addElement(metaData.getColumnLabel(column + 1));
        }
        // Get all rows.
        Vector rows = new Vector();
        while (rs.next()) {
            Vector newRow = new Vector();
            for (int i = 1; i <= numberOfColumns; i++) {
                newRow.addElement(rs.getObject(i));
            }
            rows.addElement(newRow);
        }
        return new DefaultTableModel(rows, columnNames);
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
Example 13
Project: UnicentaPOS_AD-master  File: DbUtils.java View source code
public static TableModel resultSetToTableModel(ResultSet rs) {
    try {
        ResultSetMetaData metaData = rs.getMetaData();
        int numberOfColumns = metaData.getColumnCount();
        Vector columnNames = new Vector();
        // Get the column names
        for (int column = 0; column < numberOfColumns; column++) {
            columnNames.addElement(metaData.getColumnLabel(column + 1));
        }
        // Get all rows.
        Vector rows = new Vector();
        while (rs.next()) {
            Vector newRow = new Vector();
            for (int i = 1; i <= numberOfColumns; i++) {
                newRow.addElement(rs.getObject(i));
            }
            rows.addElement(newRow);
        }
        return new DefaultTableModel(rows, columnNames);
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
Example 14
Project: WANDA-master  File: DbUtils.java View source code
/**
     *
     * @param rs
     * @return
     */
public static TableModel resultSetToTableModel(ResultSet rs) {
    try {
        ResultSetMetaData metaData = rs.getMetaData();
        int numberOfColumns = metaData.getColumnCount();
        Vector columnNames = new Vector();
        // Get the column names
        for (int column = 0; column < numberOfColumns; column++) {
            columnNames.addElement(metaData.getColumnLabel(column + 1));
        }
        // Get all rows.
        Vector rows = new Vector();
        while (rs.next()) {
            Vector newRow = new Vector();
            for (int i = 1; i <= numberOfColumns; i++) {
                newRow.addElement(rs.getObject(i));
            }
            rows.addElement(newRow);
        }
        return new DefaultTableModel(rows, columnNames);
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
Example 15
Project: WandaPOS-master  File: DbUtils.java View source code
/**
     *
     * @param rs
     * @return
     */
public static TableModel resultSetToTableModel(ResultSet rs) {
    try {
        ResultSetMetaData metaData = rs.getMetaData();
        int numberOfColumns = metaData.getColumnCount();
        Vector columnNames = new Vector();
        // Get the column names
        for (int column = 0; column < numberOfColumns; column++) {
            columnNames.addElement(metaData.getColumnLabel(column + 1));
        }
        // Get all rows.
        Vector rows = new Vector();
        while (rs.next()) {
            Vector newRow = new Vector();
            for (int i = 1; i <= numberOfColumns; i++) {
                newRow.addElement(rs.getObject(i));
            }
            rows.addElement(newRow);
        }
        return new DefaultTableModel(rows, columnNames);
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
Example 16
Project: GhostGrader-master  File: GradebooksWindow.java View source code
/**
     * 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")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
    jScrollPane1 = new javax.swing.JScrollPane();
    classTable = new javax.swing.JTable();
    // NOI18N
    jScrollPane1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Courses", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Georgia", 0, 14)));
    classTable.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { { null, null, null, null, null, null, null, null, null } }, new String[] { "Row", "Class Name", "Course Prefix", "Course Number", "Class Section", "Class Building", "Class Room Number", "Meeting Time", "Semester" }) {

        boolean[] canEdit = new boolean[] { false, false, false, false, false, true, true, true, true };

        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit[columnIndex];
        }
    });
    jScrollPane1.setViewportView(classTable);
    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, 787, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 521, Short.MAX_VALUE));
}
Example 17
Project: jade_agents-master  File: MonitorAgentGUI.java View source code
/** 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")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
    jComboBoxPlan = new javax.swing.JComboBox();
    jButtonProduce = new javax.swing.JButton();
    jSpinnerCount = new javax.swing.JSpinner();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTable1 = new javax.swing.JTable();
    setTitle("Produce New Item");
    jComboBoxPlan.setModel(plans);
    jComboBoxPlan.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jComboBoxPlanActionPerformed(evt);
        }
    });
    jButtonProduce.setText("Produce");
    jButtonProduce.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButtonProduceActionPerformed(evt);
        }
    });
    jSpinnerCount.setModel(new javax.swing.SpinnerNumberModel(1, 1, 100, 1));
    jTable1.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {}, new String[] { "Component", "Count" }) {

        Class[] types = new Class[] { java.lang.String.class, java.lang.Integer.class };

        public Class getColumnClass(int columnIndex) {
            return types[columnIndex];
        }
    });
    jScrollPane1.setViewportView(jTable1);
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addComponent(jComboBoxPlan, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(jSpinnerCount, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jButtonProduce)).addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 284, javax.swing.GroupLayout.PREFERRED_SIZE)).addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jComboBoxPlan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jSpinnerCount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jButtonProduce)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    pack();
}
Example 18
Project: WebCams-master  File: VideoDeviceInfo.java View source code
/** 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")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
    scroller = new javax.swing.JScrollPane();
    tableInfo = new javax.swing.JTable();
    btnClose = new javax.swing.JButton();
    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    // NOI18N
    java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("webcamstudio/Languages");
    // NOI18N
    setTitle(bundle.getString("VIDEODEVICEINFO"));
    scroller.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
    // NOI18N
    scroller.setName("scroller");
    tableInfo.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null } }, new String[] { "Device", "Name", "Type" }) {

        Class[] types = new Class[] { java.lang.String.class, java.lang.String.class, java.lang.Object.class };

        boolean[] canEdit = new boolean[] { false, false, false };

        public Class getColumnClass(int columnIndex) {
            return types[columnIndex];
        }

        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit[columnIndex];
        }
    });
    // NOI18N
    tableInfo.setName("tableInfo");
    scroller.setViewportView(tableInfo);
    // NOI18N
    btnClose.setIcon(new javax.swing.ImageIcon(getClass().getResource("/webcamstudio/resources/tango/process-stop.png")));
    // NOI18N
    btnClose.setText(bundle.getString("CLOSE"));
    // NOI18N
    btnClose.setName("btnClose");
    btnClose.setPreferredSize(new java.awt.Dimension(75, 20));
    btnClose.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnCloseActionPerformed(evt);
        }
    });
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(scroller, javax.swing.GroupLayout.DEFAULT_SIZE, 495, Short.MAX_VALUE).addGroup(layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE).addComponent(btnClose, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE))).addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(scroller, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(btnClose, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    pack();
}
Example 19
Project: Assignments-master  File: Controller.java View source code
public void actionPerformed(ActionEvent e) {
    JFrame tableFrame = new JFrame();
    JPanel tablePanel = new JPanel();
    String[] columnName = { "Word", "Synonyms" };
    DefaultTableModel table = new DefaultTableModel(columnName, 0);
    Set<String> treeKeys = d.getTreeMap().keySet();
    JTable t = new JTable();
    for (String aux : treeKeys) {
        String word = aux;
        ArrayList<String> syn = new ArrayList<>();
        syn = d.getSynonyms(word);
        Object[] data = { word, syn.toString() };
        table.addRow(data);
        t.setModel(table);
    }
    JScrollPane scroll = new JScrollPane(t);
    tablePanel.add(scroll);
    tableFrame.getContentPane().add(BorderLayout.CENTER, tablePanel);
    tableFrame.pack();
    tableFrame.setVisible(true);
}
Example 20
Project: burp-Dirbuster-master  File: DirbusterThread.java View source code
@Override
public void run() {
    try {
        /**
             * Make pre check, host existing
             */
        int statusCode = makeHttpRequest();
        if (statusCode == 302 || statusCode == 404 || statusCode == 501 || statusCode == 502) {
            return;
        }
        log.info("Status code: ---" + statusCode + "--- Found path " + url);
        /**
             * Add data to GUI table model
             */
        ((DefaultTableModel) panel.getTblFoundDirs().getModel()).addRow(new Object[] { true, url, statusCode });
        /**
             * Send to spider this host
             */
        if (!callbacks.isInScope(url)) {
            callbacks.includeInScope(url);
        }
        callbacks.sendToSpider(url);
        log.info("Sent to Spider: " + url);
    } catch (Exception e) {
        log.error("Error make HTTP Request: " + url + e.getMessage());
    }
}
Example 21
Project: ChromisPOS-master  File: AboutDialog.java View source code
/**
     * 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")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
    jScrollPane2 = new javax.swing.JScrollPane();
    jTable1 = new javax.swing.JTable();
    jLabel3 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    jTable1.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null } }, new String[] { "Title 1", "Title 2", "Title 3", "Title 4" }));
    jScrollPane2.setViewportView(jTable1);
    // NOI18N
    jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/uk/chromis/images/chromis_main.png")));
    // NOI18N
    jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12));
    jLabel2.setText("www.chromis.co.uk");
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jLabel3)).addGroup(layout.createSequentialGroup().addGap(30, 30, 30).addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE))).addContainerGap(33, Short.MAX_VALUE)));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(1, 1, 1).addComponent(jLabel2).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
}
Example 22
Project: consulo-master  File: MoveArrangementGroupingRuleDownAction.java View source code
@Override
public void actionPerformed(AnActionEvent e) {
    ArrangementGroupingRulesControl control = ArrangementGroupingRulesControl.KEY.getData(e.getDataContext());
    if (control == null) {
        return;
    }
    int[] rows = control.getSelectedRows();
    int row = rows[0];
    if (rows.length != 1 || rows[0] == control.getRowCount() - 1) {
        return;
    }
    if (control.isEditing()) {
        control.getCellEditor().stopCellEditing();
    }
    DefaultTableModel model = control.getModel();
    Object value = model.getValueAt(row, 0);
    model.removeRow(row);
    model.insertRow(row + 1, new Object[] { value });
    control.getSelectionModel().setSelectionInterval(row + 1, row + 1);
}
Example 23
Project: cooper-master  File: SelectGroupDialog.java View source code
private JComponent createGroups() {
    DefaultTableModel model = new DefaultTableModel() {

        @Override
        public Class getColumnClass(int c) {
            Object value = getValueAt(0, c);
            if (value != null) {
                return value.getClass();
            } else {
                return String.class;
            }
        }
    };
    TableSorter sorter = new TableSorter(model);
    groupsTable = new JTable(sorter);
    model.addColumn("是�显示");
    model.addColumn("命令组");
    model.addColumn("属性");
    try {
        Object[] row;
        GroupConf groupConf;
        for (String group : CommandConfMgr.getInstance().getGroupNames()) {
            row = new Object[3];
            groupConf = CommandConfMgr.getInstance().getTheGroup(group);
            row[0] = new Boolean(groupConf.isVisible());
            row[1] = group;
            row[2] = groupConf.getAttribute();
            model.addRow(row);
        }
    } catch (JDependException e) {
        e.printStackTrace();
    }
    sorter.setTableHeader(groupsTable.getTableHeader());
    sorter.setSortingStatus(2, TableSorter.ASCENDING);
    return new JScrollPane(groupsTable);
}
Example 24
Project: dbTagger-master  File: Table.java View source code
public void initTableModel(TableData result) {
    String[][] data = result.getBody();
    String[] titles = result.getHeaders();
    DefaultTableModel tableModel = new DefaultTableModel(data, titles) {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isCellEditable(int row, int column) {
            return false;
        }
    };
    setModel(tableModel);
    // key column width
    getColumnModel().getColumn(0).setMaxWidth(FIRST_ROW_MAX_WIDTH);
}
Example 25
Project: dpwsim-master  File: DPWSUtilities.java View source code
public static String addOperationsInfo(String deviceinfo, DefaultTableModel ops) {
    if (ops != null) {
        for (int i = 0; i < ops.getRowCount(); i++) {
            String opName = (String) ops.getValueAt(i, 0);
            String param = (String) ops.getValueAt(i, 1);
            String status = (String) ops.getValueAt(i, 2);
            deviceinfo += "\nOPERATION," + opName + "," + param + "," + status;
        }
    }
    return deviceinfo;
}
Example 26
Project: FlightPlot-master  File: LogInfo.java View source code
private void createUIComponents() {
    // Info table
    infoTableModel = new DefaultTableModel() {

        @Override
        public boolean isCellEditable(int row, int col) {
            return false;
        }
    };
    infoTableModel.addColumn("Property");
    infoTableModel.addColumn("Value");
    infoTable = new JTable(infoTableModel);
    // Parameters table
    parametersTableModel = new DefaultTableModel() {

        @Override
        public boolean isCellEditable(int row, int col) {
            return false;
        }
    };
    parametersTableModel.addColumn("Parameter");
    parametersTableModel.addColumn("Value");
    parametersTable = new JTable(parametersTableModel);
}
Example 27
Project: geogebra-master  File: FrequencyTablePanel.java View source code
public void setTableFromGeoFrequencyTable(AlgoFrequencyTable algo, boolean useClasses) {
    String[] strValue = algo.getValueString();
    String[] strFrequency = algo.getFrequencyString();
    String[] strHeader = algo.getHeaderString();
    statTable.setStatTable(strValue.length, null, 2, strHeader);
    DefaultTableModel model = statTable.getModel();
    if (useClasses) {
        for (int row = 0; row < strValue.length - 1; row++) {
            model.setValueAt(strValue[row] + " - " + strValue[row + 1], row, 0);
            model.setValueAt(strFrequency[row], row, 1);
        }
    } else {
        for (int row = 0; row < strValue.length; row++) {
            model.setValueAt(strValue[row], row, 0);
            model.setValueAt(strFrequency[row], row, 1);
        }
    }
    setTableSize();
}
Example 28
Project: ggp-base-master  File: HumanDetailPanel.java View source code
private AbstractAction selectButtonMethod() {
    return new AbstractAction("Select") {

        @Override
        public void actionPerformed(ActionEvent evt) {
            int row = moveTable.getSelectedRow();
            if (row != -1) {
                DefaultTableModel model = (DefaultTableModel) moveTable.getModel();
                selection = (Move) model.getValueAt(row, 0);
                moveTextField.setText(selection.toString());
            }
        }
    };
}
Example 29
Project: helixsoft-commons-master  File: RecordStreamFormatter.java View source code
/** Format as a TableModel */
public static TableModel asTableModel(RecordStream rs) throws StreamException {
    Vector<Vector<String>> data = new Vector<Vector<String>>();
    Vector<String> colnames = new Vector<String>();
    int colNum = rs.getMetaData().getNumCols();
    for (int col = 0; col < colNum; ++col) {
        colnames.add(rs.getMetaData().getColumnName(col));
    }
    Record rec;
    while ((rec = rs.getNext()) != null) {
        Vector<String> row = new Vector<String>();
        for (int col = 0; col < colNum; ++col) {
            row.add("" + rec.get(col));
        }
        data.add(row);
    }
    DefaultTableModel model = new DefaultTableModel(data, colnames);
    return model;
}
Example 30
Project: HUSACCT-master  File: ApplicationAnalysisHistoryOverviewFrame.java View source code
private void addTable() {
    String workspace = mainController.getWorkspaceController().getCurrentWorkspace().getName();
    ApplicationDTO applicationDTO = ServiceProvider.getInstance().getDefineService().getApplicationDetails();
    String application = applicationDTO.name;
    ArrayList<ProjectDTO> projects = applicationDTO.projects;
    HashMap<String, HashMap<String, String>> tableData = mainController.getApplicationAnalysisHistoryLogController().getApplicationHistoryFromFile(workspace, application, projects);
    analysisTableModel = new DefaultTableModel();
    analysisTable = new JTable(analysisTableModel) {

        @Override
        public boolean isCellEditable(int rowIndex, int colIndex) {
            return false;
        }
    };
    analysisTableModel.addColumn(localeService.getTranslatedString("Application"));
    analysisTableModel.addColumn(localeService.getTranslatedString("Path"));
    analysisTableModel.addColumn(localeService.getTranslatedString("DateTime"));
    analysisTableModel.addColumn(localeService.getTranslatedString("Packages"));
    analysisTableModel.addColumn(localeService.getTranslatedString("Classes"));
    analysisTableModel.addColumn(localeService.getTranslatedString("Interfaces"));
    analysisTableModel.addColumn(localeService.getTranslatedString("Dependencies"));
    analysisTable.getTableHeader().setReorderingAllowed(false);
    analysisTable.getTableHeader().setResizingAllowed(true);
    analysisTable.setAutoCreateRowSorter(true);
    //Sort by date/time, newest on top
    analysisTable.getRowSorter().toggleSortOrder(2);
    //Sort by date/time, newest on top
    analysisTable.getRowSorter().toggleSortOrder(2);
    for (Entry<String, HashMap<String, String>> entry : tableData.entrySet()) {
        Long analysisTimestampLong = Long.parseLong(entry.getKey());
        Date analysisTimestampDate = new Date(analysisTimestampLong * 1000);
        DateFormat analysisTimestampFormat = new SimpleDateFormat("dd-MM-yyyy hh:MM:ss");
        HashMap<String, String> analysisData = entry.getValue();
        analysisTableModel.addRow(new Object[] { analysisData.get("application"), analysisData.get("path"), analysisTimestampFormat.format(analysisTimestampDate), analysisData.get("packages"), analysisData.get("classes"), analysisData.get("interfaces"), analysisData.get("dependencies") });
    }
    this.add(new JScrollPane(analysisTable));
}
Example 31
Project: intellij-community-master  File: MoveArrangementGroupingRuleUpAction.java View source code
@Override
public void actionPerformed(AnActionEvent e) {
    ArrangementGroupingRulesControl control = ArrangementGroupingRulesControl.KEY.getData(e.getDataContext());
    if (control == null) {
        return;
    }
    int[] rows = control.getSelectedRows();
    int row = rows[0];
    if (rows.length != 1 || row == 0) {
        return;
    }
    if (control.isEditing()) {
        control.getCellEditor().stopCellEditing();
    }
    DefaultTableModel model = control.getModel();
    Object value = model.getValueAt(row, 0);
    model.removeRow(row);
    model.insertRow(row - 1, new Object[] { value });
    control.getSelectionModel().setSelectionInterval(row - 1, row - 1);
}
Example 32
Project: JadexPlayer-master  File: ServiceProperties.java View source code
//-------- methods --------
/**
	 *  Set the service.
	 */
public void setService(IService service) {
    IServiceIdentifier sid = service.getServiceIdentifier();
    getTextField("Name").setText(sid.getServiceName());
    getTextField("Type").setText(sid.getServiceType().getName());
    getTextField("Provider").setText(sid.getProviderId().toString());
    JTable list = (JTable) getComponent("Methods").getComponent(0);
    Method[] methods = sid.getServiceType().getMethods();
    String[] returntypes = new String[methods.length];
    String[] names = new String[methods.length];
    String[] parameters = new String[methods.length];
    for (int i = 0; i < methods.length; i++) {
        returntypes[i] = SReflect.getUnqualifiedClassName(methods[i].getReturnType());
        names[i] = methods[i].getName();
        Class[] params = methods[i].getParameterTypes();
        String pstring = "";
        for (int j = 0; j < params.length; j++) {
            if (j == 0)
                pstring = SReflect.getUnqualifiedClassName(params[j]);
            else
                pstring += ", " + SReflect.getUnqualifiedClassName(params[j]);
        }
        parameters[i] = pstring;
    }
    DefaultTableModel dtm = new DefaultTableModel();
    dtm.addColumn("Return Type", returntypes);
    dtm.addColumn("Method Name", names);
    dtm.addColumn("Parameters", parameters);
    list.setModel(dtm);
}
Example 33
Project: jdk7u-jdk-master  File: DefaultPolicyChange_Swing.java View source code
private static void runTestSwing() {
    KeyboardFocusManager currentKFM = KeyboardFocusManager.getCurrentKeyboardFocusManager();
    FocusTraversalPolicy defaultFTP = currentKFM.getDefaultFocusTraversalPolicy();
    ContainerOrderFocusTraversalPolicy newFTP = new ContainerOrderFocusTraversalPolicy();
    JFrame jf = new JFrame("Test1");
    JWindow jw = new JWindow(jf);
    JDialog jd = new JDialog(jf);
    JPanel jp1 = new JPanel();
    JButton jb1 = new JButton("jb1");
    JTable jt1 = new JTable(new DefaultTableModel());
    jf.add(jb1);
    jf.add(jt1);
    jf.add(jp1);
    System.out.println("FTP current on jf= " + jf.getFocusTraversalPolicy());
    System.out.println("FTP current on jw= " + jw.getFocusTraversalPolicy());
    System.out.println("FTP current on jd= " + jd.getFocusTraversalPolicy());
    if (!(jf.getFocusTraversalPolicy() instanceof LayoutFocusTraversalPolicy) || !(jw.getFocusTraversalPolicy() instanceof LayoutFocusTraversalPolicy) || !(jd.getFocusTraversalPolicy() instanceof LayoutFocusTraversalPolicy)) {
        throw new RuntimeException("Failure! Swing toplevel must have LayoutFocusTraversalPolicy installed");
    }
    jf.setVisible(true);
    System.out.println("Now will set another policy.");
    currentKFM.setDefaultFocusTraversalPolicy(newFTP);
    FocusTraversalPolicy resultFTP = jw.getFocusTraversalPolicy();
    System.out.println("FTP current on jf= " + jf.getFocusTraversalPolicy());
    System.out.println("FTP current on jw= " + jw.getFocusTraversalPolicy());
    System.out.println("FTP current on jd= " + jd.getFocusTraversalPolicy());
    if (!resultFTP.equals(defaultFTP)) {
        Sysout.println("Failure! FocusTraversalPolicy should not change");
        Sysout.println("Was: " + defaultFTP);
        Sysout.println("Become: " + resultFTP);
        throw new RuntimeException("Failure! FocusTraversalPolicy should not change");
    }
}
Example 34
Project: jnode-master  File: JTableTest.java View source code
public static void main(String[] argv) {
    JFrame f = new JFrame("JTable Test");
    f.setSize(400, 400);
    f.add(new JScrollPane(new JTable(new DefaultTableModel(new Object[][] { { 1, 2, 3, 4 }, { 'a', 'b', 'c', 'd' }, { 5, 6, 7, 8 }, { 11, 22, 33, 44 }, { 55, 66, 66, 88 } }, new Object[] { 'A', 'B', 'C', 'D' }))));
    f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    f.setVisible(true);
}
Example 35
Project: montagnesdor-master  File: SpreadSheetCreation.java View source code
public static void main(String[] args) {
    // Create the data to save.
    final Object[][] data = new Object[6][2];
    data[0] = new Object[] { "January", 1 };
    data[1] = new Object[] { "February", 3 };
    data[2] = new Object[] { "March", 8 };
    data[3] = new Object[] { "April", 10 };
    data[4] = new Object[] { "May", 15 };
    data[5] = new Object[] { "June", 18 };
    final String[] columns = new String[] { "Month", "Temp" };
    final TableModel model = new DefaultTableModel(data, columns);
    try {
        // Save the data to an ODS file and open it.
        final File file = new File("target/template/temperature.ods");
        SpreadSheet.createEmpty(model).saveAs(file);
        OOUtils.open(file);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Example 36
Project: OpenDolphin-master  File: DocumentHistoryView.java View source code
/** 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.
     */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    jScrollPane1 = new javax.swing.JScrollPane();
    table = new open.dolphin.client.DocHistoryTipsTable();
    cntLbl = new javax.swing.JLabel();
    docTypeCombo = new javax.swing.JComboBox();
    periodCombo = new javax.swing.JComboBox();
    // NOI18N
    setName("Form");
    // NOI18N
    jScrollPane1.setName("jScrollPane1");
    table.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null } }, new String[] { "Title 1", "Title 2", "Title 3", "Title 4" }));
    // NOI18N
    table.setName("table");
    jScrollPane1.setViewportView(table);
    cntLbl.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    // NOI18N
    java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("open/dolphin/client/resources/DocumentHistoryView");
    // NOI18N
    cntLbl.setText(bundle.getString("cntLbl.text"));
    // NOI18N
    cntLbl.setName("cntLbl");
    // NOI18N
    docTypeCombo.setName("docTypeCombo");
    // NOI18N
    periodCombo.setName("periodCombo");
    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 362, Short.MAX_VALUE).add(layout.createSequentialGroup().add(docTypeCombo, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(periodCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 93, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(cntLbl, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(layout.createSequentialGroup().add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 309, Short.MAX_VALUE).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(docTypeCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(periodCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(cntLbl))));
}
Example 37
Project: openjdk8-jdk-master  File: DefaultPolicyChange_Swing.java View source code
private static void runTestSwing() {
    KeyboardFocusManager currentKFM = KeyboardFocusManager.getCurrentKeyboardFocusManager();
    FocusTraversalPolicy defaultFTP = currentKFM.getDefaultFocusTraversalPolicy();
    ContainerOrderFocusTraversalPolicy newFTP = new ContainerOrderFocusTraversalPolicy();
    JFrame jf = new JFrame("Test1");
    JWindow jw = new JWindow(jf);
    JDialog jd = new JDialog(jf);
    JPanel jp1 = new JPanel();
    JButton jb1 = new JButton("jb1");
    JTable jt1 = new JTable(new DefaultTableModel());
    jf.add(jb1);
    jf.add(jt1);
    jf.add(jp1);
    System.out.println("FTP current on jf= " + jf.getFocusTraversalPolicy());
    System.out.println("FTP current on jw= " + jw.getFocusTraversalPolicy());
    System.out.println("FTP current on jd= " + jd.getFocusTraversalPolicy());
    if (!(jf.getFocusTraversalPolicy() instanceof LayoutFocusTraversalPolicy) || !(jw.getFocusTraversalPolicy() instanceof LayoutFocusTraversalPolicy) || !(jd.getFocusTraversalPolicy() instanceof LayoutFocusTraversalPolicy)) {
        throw new RuntimeException("Failure! Swing toplevel must have LayoutFocusTraversalPolicy installed");
    }
    jf.setVisible(true);
    System.out.println("Now will set another policy.");
    currentKFM.setDefaultFocusTraversalPolicy(newFTP);
    FocusTraversalPolicy resultFTP = jw.getFocusTraversalPolicy();
    System.out.println("FTP current on jf= " + jf.getFocusTraversalPolicy());
    System.out.println("FTP current on jw= " + jw.getFocusTraversalPolicy());
    System.out.println("FTP current on jd= " + jd.getFocusTraversalPolicy());
    if (!resultFTP.equals(defaultFTP)) {
        Sysout.println("Failure! FocusTraversalPolicy should not change");
        Sysout.println("Was: " + defaultFTP);
        Sysout.println("Become: " + resultFTP);
        throw new RuntimeException("Failure! FocusTraversalPolicy should not change");
    }
}
Example 38
Project: org.openscada.external-master  File: SpreadSheetCreation.java View source code
public static void main(String[] args) {
    // Create the data to save.
    final Object[][] data = new Object[6][2];
    data[0] = new Object[] { "January", 1 };
    data[1] = new Object[] { "February", 3 };
    data[2] = new Object[] { "March", 8 };
    data[3] = new Object[] { "April", 10 };
    data[4] = new Object[] { "May", 15 };
    data[5] = new Object[] { "June", 18 };
    final String[] columns = new String[] { "Month", "Temp" };
    final TableModel model = new DefaultTableModel(data, columns);
    try {
        // Save the data to an ODS file and open it.
        final File file = new File("temperature.ods");
        SpreadSheet.createEmpty(model).saveAs(file);
        OOUtils.open(file);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Example 39
Project: pentaho-reporting-master  File: FormulaTestBase.java View source code
protected void setUp() throws Exception {
    final ExpressionRuntime runtime = new GenericExpressionRuntime(new StaticDataRow(), new DefaultTableModel(), 0, new DefaultProcessingContext());
    context = new ReportFormulaContext(new TestFormulaContext(TestFormulaContext.testCaseDataset), runtime);
    ClassicEngineBoot.getInstance().start();
}
Example 40
Project: spudplayer-master  File: HumanDetailPanel.java View source code
private AbstractAction selectButtonMethod() {
    return new AbstractAction("Select") {

        public void actionPerformed(ActionEvent evt) {
            int row = moveTable.getSelectedRow();
            if (row != -1) {
                DefaultTableModel model = (DefaultTableModel) moveTable.getModel();
                selection = (Move) model.getValueAt(row, 0);
                moveTextField.setText(selection.toString());
            }
        }
    };
}
Example 41
Project: Telesto-master  File: Panel.java View source code
public void refresh(Database database) throws SQLException {
    Connection connection = database.getConnection();
    Statement statement = connection.createStatement();
    // We don't have to worry about escaping here
    statement.execute("SELECT * FROM " + tableName);
    ResultSet results = statement.getResultSet();
    ResultSetMetaData meta = results.getMetaData();
    int columnCount = meta.getColumnCount();
    String[] columnNames = new String[columnCount];
    for (int i = 0; i < columnCount; i++) {
        columnNames[i] = meta.getColumnName(i + 1);
    }
    DefaultTableModel model = new TableModel(new Object[0][], columnNames);
    table.setModel(model);
    while (results.next()) {
        Object[] row = new Object[columnCount];
        for (int i = 0; i < columnCount; i++) {
            row[i] = results.getObject(i + 1);
        }
        model.addRow(row);
    }
}
Example 42
Project: triple-master  File: VerifiedRandomNumbersDialog.java View source code
private void init() {
    final List<VerifiedRandomNumbers> verified = RemoteRandom.getVerifiedRandomNumbers();
    final String[][] tableValues = getTableValues(verified);
    final DefaultTableModel model = new DefaultTableModel(tableValues, new String[] { "Reason", "Dice Rolls" }) {

        private static final long serialVersionUID = 8876974698508561554L;

        @Override
        public boolean isCellEditable(final int row, final int column) {
            return false;
        }
    };
    final JTable table = new JTable(model);
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(new JScrollPane(table), BorderLayout.CENTER);
    final JPanel buttons = new JPanel();
    buttons.setLayout(new FlowLayout(FlowLayout.CENTER));
    getContentPane().add(buttons, BorderLayout.SOUTH);
    final JButton close = new JButton("Close");
    close.addActionListener( e -> setVisible(false));
    buttons.add(close);
}
Example 43
Project: Feuille-master  File: ChooseFX.java View source code
private void init() {
    try {
        javax.swing.UIManager.setLookAndFeel(new NimbusLookAndFeel());
        javax.swing.SwingUtilities.updateComponentTreeUI(this);
    } catch (UnsupportedLookAndFeelException exc) {
        System.out.println("Nimbus LookAndFeel not loaded : " + exc);
    }
    String[] fxHead = new String[] { "Name", "Author(s)", "Description", "Effects" };
    tableModel = new DefaultTableModel(null, fxHead) {

        Class[] types = new Class[] { String.class, String.class, String.class, String.class };

        boolean[] canEdit = new boolean[] { false, false, false, false };

        @Override
        public Class getColumnClass(int columnIndex) {
            return types[columnIndex];
        }

        @Override
        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit[columnIndex];
        }
    };
    jTable1.setModel(tableModel);
    TableColumn column;
    for (int i = 0; i < 4; i++) {
        column = jTable1.getColumnModel().getColumn(i);
        switch(i) {
            case 0:
                column.setPreferredWidth(150);
                //Name
                break;
            case 1:
                column.setPreferredWidth(150);
                //Author(s)
                break;
            case 2:
                column.setPreferredWidth(400);
                //Description
                break;
            case 3:
                column.setPreferredWidth(600);
                //Effects
                break;
        }
    }
}
Example 44
Project: Jailer-master  File: ParameterSelector.java View source code
/**
	 * Refreshes table.
	 */
private void refresh() {
    Collections.sort(parameters);
    Object[][] data = new Object[parameters.size() + 1][];
    int i = 0;
    data[i++] = new Object[] { "<new parameter>" };
    for (String s : parameters) {
        data[i++] = new Object[] { s };
    }
    paramTable.setModel(new DefaultTableModel(data, new Object[] { "Parameter" }) {

        @Override
        public boolean isCellEditable(int row, int column) {
            return false;
        }

        private static final long serialVersionUID = 2703862797772451362L;
    });
}
Example 45
Project: prottest3-master  File: FrequenciesView.java View source code
/** 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.
     */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    jScrollPane1 = new javax.swing.JScrollPane();
    tableFrequencies = new javax.swing.JTable();
    lblTitle = new javax.swing.JLabel();
    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    // NOI18N
    setName("Form");
    // NOI18N
    jScrollPane1.setName("jScrollPane1");
    org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(es.uvigo.darwin.xprottest.XProtTestApp.class).getContext().getResourceMap(FrequenciesView.class);
    // NOI18N
    tableFrequencies.setBackground(resourceMap.getColor("tableFrequencies.background"));
    DefaultTableModel freqTableModel = new javax.swing.table.DefaultTableModel() {

        public Class getColumnClass(int column) {
            if (column >= 0 && column <= getColumnCount()) {
                try {
                    return getValueAt(0, column).getClass();
                } catch (ArrayIndexOutOfBoundsException e) {
                    return Object.class;
                }
            } else
                return Object.class;
        }

        public boolean isCellEditable(int row, int col) {
            return false;
        }
    };
    freqTableModel.addColumn("AA", new String[20][1]);
    freqTableModel.addColumn("Frequency", new Double[20][1]);
    tableFrequencies.setModel(freqTableModel);
    RowSorter<TableModel> freqSorter = new TableRowSorter<TableModel>(freqTableModel);
    tableFrequencies.setRowSorter(freqSorter);
    tableFrequencies.setColumnSelectionAllowed(true);
    // NOI18N
    tableFrequencies.setName("tableFrequencies");
    jScrollPane1.setViewportView(tableFrequencies);
    lblTitle.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    // NOI18N
    java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("es/uvigo/darwin/xprottest/analysis/resources/FrequenciesView");
    // NOI18N
    lblTitle.setText(bundle.getString("msg-title"));
    // NOI18N
    lblTitle.setName("lblTitle");
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 217, Short.MAX_VALUE).addComponent(lblTitle, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 217, Short.MAX_VALUE)).addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(lblTitle).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE).addContainerGap()));
    pack();
}
Example 46
Project: v-unit-master  File: SearchController.java View source code
/**
	 * füllt die Kundentabelle mit den gefundenen Daten
	 */
private void fillCustomerTableContent() {
    Vector rowData = getCustomerRows(this.currentSearchTerm);
    Vector columns = getCustomerColumns();
    this.tablePanel.getTableSearchCustomer().setModel(new javax.swing.table.DefaultTableModel(rowData, columns) {

        public boolean isCellEditable(int row, int column) {
            return false;
        }
    });
    this.tablePanel.getTableSearchCustomer().getModel().addTableModelListener(new TableModelListener() {

        @Override
        public void tableChanged(TableModelEvent e) {
            fillCustomerTableContent();
        }
    });
    this.tablePanel.getTableSearchCustomer().getSelectionModel().addListSelectionListener(new TableCustomerListSelectionHandler(MainWindow.get(), this.tablePanel.getTableSearchCustomer()));
    TableColumnModel colModel = this.tablePanel.getTableSearchCustomer().getColumnModel();
    colModel.getColumn(0).setPreferredWidth(80);
    colModel.getColumn(1).setPreferredWidth(100);
    colModel.getColumn(2).setPreferredWidth(250);
    colModel.getColumn(3).setPreferredWidth(250);
    colModel.getColumn(4).setPreferredWidth(100);
    colModel.getColumn(5).setPreferredWidth(450);
    this.tablePanel.getTableSearchCustomer().getTableHeader().setReorderingAllowed(false);
}
Example 47
Project: AnalyzerBeans-master  File: ListResultHtmlRenderer.java View source code
@Override
public HtmlFragment render(final ListResult<?> result) {
    SimpleHtmlFragment htmlFragment = new SimpleHtmlFragment();
    final List<?> values = result.getValues();
    final int rowCount = values.size();
    final TableModel tableModel = new DefaultTableModel(rowCount, 1);
    for (int i = 0; i < rowCount; i++) {
        tableModel.setValueAt(values.get(i), i, 0);
    }
    final Description description = ReflectionUtils.getAnnotation(result.getClass(), Description.class);
    final String descriptionText;
    if (description != null) {
        descriptionText = description.value();
    } else {
        descriptionText = "Values";
    }
    htmlFragment.addBodyElement(new SectionHeaderBodyElement(descriptionText + " (" + rowCount + ")"));
    if (rowCount == 0) {
        htmlFragment.addBodyElement("<p>No records to display.</p>");
    } else {
        htmlFragment.addBodyElement(new TableBodyElement(tableModel, "annotatedRowsTable", new int[0]));
    }
    return htmlFragment;
}
Example 48
Project: atlasframework-master  File: MapusageTable.java View source code
private DefaultTableModel getTableModel() {
    if (tm == null) {
        tm = new DefaultTableModel() {

            public int getColumnCount() {
                return (dpe instanceof DpLayer ? 4 : 1);
            }

            ;

            public int getRowCount() {
                return getMapsUsing().size();
            }

            ;

            public Object getValueAt(int row, int column) {
                switch(column) {
                    case 0:
                        return getMapsUsing().get(row).getTitle().toString();
                    case 1:
                        return getMapsUsing().get(row).isVisible(dpe);
                    case 2:
                        return getMapsUsing().get(row).isVisibleInLegend(dpe);
                    case 3:
                        return getMapsUsing().get(row).isSelectableFor(dpe.getId());
                }
                return super.getValueAt(row, column);
            }

            ;

            public String getColumnName(int column) {
                switch(column) {
                    case 0:
                        return GpSwingUtil.R("EditDpEntryGUI.usage.Maps.col.name");
                    case 1:
                        return GpSwingUtil.R("EditDpEntryGUI.usage.Maps.col.visible");
                    case 2:
                        return GpSwingUtil.R("EditDpEntryGUI.usage.Maps.col.visibleInLegend");
                    case 3:
                        return GpSwingUtil.R("EditDpEntryGUI.usage.Maps.col.selectable");
                }
                return super.getColumnName(column);
            }

            ;

            public boolean isCellEditable(int row, int column) {
                return false;
            }

            ;
        };
    }
    return tm;
}
Example 49
Project: BW4T-master  File: MainPanel.java View source code
/**
     * Update the Bot table with the newest values.
     */
public void refreshEPartnerTableModel() {
    final DefaultTableModel tableModel = getEntityPanel().getEPartnerTableModel();
    tableModel.setRowCount(0);
    int rows = getClientConfig().getEpartners().size();
    for (int i = 0; i < rows; i++) {
        EPartnerConfig botConfig = getClientConfig().getEpartner(i);
        Object[] newBotObject = { botConfig.getEpartnerName(), botConfig.getFileName(), botConfig.getEpartnerAmount() };
        tableModel.addRow(newBotObject);
    }
}
Example 50
Project: cismet-gui-commons-master  File: TheProperties.java View source code
/**
     * DOCUMENT ME!
     *
     * @param  modelData  DOCUMENT ME!
     */
public static void showUIDefaultsGUI(final Object[][] modelData) {
    final Object[] colNames = new Object[2];
    // NOI18N
    colNames[0] = "Key";
    // NOI18N
    colNames[1] = "Value";
    final DefaultTableModel model = new DefaultTableModel(modelData, colNames) {

        @Override
        public boolean isCellEditable(final int row, final int column) {
            return false;
        }
    };
    final JXTable table = new JXTable(model);
    // JTable table = new JTable(model);
    // NOI18N
    final JFrame frame = new JFrame("UIDefaults");
    frame.getContentPane().add(new JScrollPane(table), BorderLayout.CENTER);
    frame.setSize(1050, 950);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}
Example 51
Project: clicktrace-master  File: OpenSessionDialog.java View source code
@SuppressWarnings("serial")
private void loadSessions() {
    sessions = sessionManager.loadAll();
    DefaultTableModel dataModel = new DefaultTableModel(new String[] { "Name", "Screenshots", "Modified" }, sessions.size()) {

        @Override
        public boolean isCellEditable(int row, int column) {
            // all cells not editable
            return false;
        }
    };
    view.table.setModel(dataModel);
    view.table.getSelectionModel().setSelectionInterval(0, 0);
    int i = 0;
    for (Session session : sessions) {
        SessionMetadata metadata = session.loadMetadata();
        view.table.getModel().setValueAt(session, i, 0);
        view.table.getModel().setValueAt(metadata.getSize(), i, 1);
        view.table.getModel().setValueAt(metadata.getModified(), i, 2);
        i++;
    }
}
Example 52
Project: codjo-data-process-master  File: ResultPaneLogic.java View source code
public static TableModel createTableModelResult(StringBuffer buffer, SQLEditorTools sqlEditorTools) {
    String columns = sqlEditorTools.extractLine(buffer);
    String[] columnNames = sqlEditorTools.lineToArray(columns, "\t");
    DefaultTableModel model = new DefaultTableModel();
    model.setColumnIdentifiers(columnNames);
    String currentLine = sqlEditorTools.extractLine(buffer);
    while (currentLine != null) {
        model.addRow(sqlEditorTools.lineToArray(currentLine, "\t"));
        currentLine = sqlEditorTools.extractLine(buffer);
    }
    return model;
}
Example 53
Project: DataCleaner-master  File: CategorizationResultSwingRenderer.java View source code
@Override
public JComponent render(final CategorizationResult analyzerResult) {
    final DefaultPieDataset dataset = new DefaultPieDataset();
    final Collection<String> categoryNames = analyzerResult.getCategoryNames();
    for (final String categoryName : categoryNames) {
        final Number count = analyzerResult.getCategoryCount(categoryName);
        dataset.setValue(categoryName, count);
    }
    final DefaultTableModel model = prepareModel(analyzerResult, dataset);
    final DCTable table = new DCTable(model);
    table.setColumnControlVisible(false);
    table.setRowHeight(22);
    final JFreeChart chart = ChartFactory.createPieChart(null, dataset, true, false, false);
    ChartUtils.applyStyles(chart);
    final ChartPanel chartPanel = ChartUtils.createPanel(chart, false);
    final DCPanel leftPanel = WidgetUtils.decorateWithShadow(chartPanel);
    final DCPanel rightPanel = new DCPanel();
    rightPanel.setLayout(new VerticalLayout());
    rightPanel.add(WidgetUtils.decorateWithShadow(table.toPanel()));
    final JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.setOpaque(false);
    split.add(leftPanel);
    split.add(rightPanel);
    split.setDividerLocation(550);
    return split;
}
Example 54
Project: fa15-ceg3120-master  File: PaymentsTab.java View source code
/**
	 * Adds fields to container.
	 */
private static Container addFields() {
    Container cont = new Container();
    cont.setBounds(6, 6, WINDOW_WIDTH, (WINDOW_HEIGHT - WINDOW_HEIGHT_QUARTER));
    cont.setLayout(null);
    JLabel paymentsSearchLabel = new JLabel("Search job number:");
    cont.add(paymentsSearchLabel);
    paymentsSearchLabel.setBounds(5, 5, 120, 20);
    JButton paymentsSearchButton = new JButton("Search");
    paymentsSearchButton.setBounds(530, 5, 120, 20);
    cont.add(paymentsSearchButton);
    final JTextField paymentsSearchOptions = new JTextField();
    paymentsSearchOptions.setBounds(275, 5, 240, 20);
    cont.add(paymentsSearchOptions);
    String[] columnName = { "Job Number", "Cost", "Payments", "Balance" };
    final DefaultTableModel paymentsModel = new DefaultTableModel(columnName, 0);
    JTable tblPaymentsResults2 = new JTable(paymentsModel);
    tblPaymentsResults2.setModel(paymentsModel);
    JScrollPane paymentsResults = new JScrollPane(tblPaymentsResults2);
    paymentsResults.setBounds(45, 45, 605, 100);
    cont.add(paymentsResults);
    return cont;
}
Example 55
Project: HCS-Tools-master  File: WellDetailPanel.java View source code
private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Open Source Project license - Sphinx-4 (cmusphinx.sourceforge.net/sphinx4/)
    overviewPanel = new JPanel();
    splitPane1 = new JSplitPane();
    scrollTable = new JScrollPane();
    readoutTable = new JTable();
    compoundPanel = new JPanel();
    //======== this ========
    setLayout(new BorderLayout());
    //======== overviewPanel ========
    {
        overviewPanel.setLayout(new BorderLayout());
    }
    add(overviewPanel, BorderLayout.NORTH);
    //======== splitPane1 ========
    {
        splitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT);
        splitPane1.setResizeWeight(0.8);
        //======== scrollTable ========
        {
            //---- readoutTable ----
            readoutTable.setModel(new DefaultTableModel(new Object[][] { { null, null }, { null, null } }, new String[] { "Name", "Value" }) {

                boolean[] columnEditable = new boolean[] { false, true };

                @Override
                public boolean isCellEditable(int rowIndex, int columnIndex) {
                    return columnEditable[columnIndex];
                }
            });
            scrollTable.setViewportView(readoutTable);
        }
        splitPane1.setTopComponent(scrollTable);
        //======== compoundPanel ========
        {
            compoundPanel.setMinimumSize(new Dimension(100, 100));
            compoundPanel.setLayout(new BorderLayout());
        }
        splitPane1.setBottomComponent(compoundPanel);
    }
    add(splitPane1, BorderLayout.CENTER);
// JFormDesigner - End of component initialization  //GEN-END:initComponents
}
Example 56
Project: jedit_cc4401-master  File: ListModelEditor.java View source code
public void open(DefaultListModel listModel) {
    final DefaultTableModel tableModel = createTableModel(listModel);
    final JTable table = new JTable(tableModel);
    table.setToolTipText("Move: PgUp/PgDown; Edit: Double-Click or Insert/Delete");
    table.addKeyListener(new KeyAdapter() {

        public void keyPressed(KeyEvent e) {
            int[] selRows = table.getSelectedRows();
            if (selRows.length == 0) {
                return;
            }
            int firstSelectedRow = selRows[0];
            int key = e.getKeyCode();
            ListSelectionModel selectionModel = table.getSelectionModel();
            switch(key) {
                case KeyEvent.VK_DELETE:
                    for (int i = selRows.length - 1; i >= 0; i--) {
                        tableModel.removeRow(selRows[i]);
                    }
                    if (firstSelectedRow >= 0 && firstSelectedRow < tableModel.getRowCount()) {
                        selectionModel.addSelectionInterval(firstSelectedRow, firstSelectedRow);
                    }
                    // avoid beep
                    e.consume();
                    break;
                case KeyEvent.VK_INSERT:
                    tableModel.insertRow(firstSelectedRow + 1, new String[] { "" });
                    // Dont edit cell
                    e.consume();
                    break;
                case KeyEvent.VK_PAGE_UP:
                case KeyEvent.VK_PAGE_DOWN:
                    boolean isUp = key == KeyEvent.VK_PAGE_UP;
                    int direction = isUp ? -1 : 1;
                    int min = selectionModel.getMinSelectionIndex() + direction;
                    int max = selectionModel.getMaxSelectionIndex() + direction;
                    if (min < 0 || max >= tableModel.getRowCount()) {
                        // avoid ArrayIndexOutOfBoundsException
                        return;
                    }
                    for (int i = 0; i < selRows.length; i++) {
                        int row = selRows[isUp ? i : (selRows.length - 1 - i)];
                        int to = row + direction;
                        selectionModel.removeSelectionInterval(row, row);
                        selectionModel.addSelectionInterval(to, to);
                        tableModel.moveRow(row, row, to);
                    }
                    break;
            }
        }
    });
    int result = JOptionPane.showConfirmDialog(null, table, "Change " + jEdit.getProperty("history.caption"), JOptionPane.OK_CANCEL_OPTION);
    if (result == JOptionPane.OK_OPTION) {
        updatelistModel(listModel, tableModel);
    }
}
Example 57
Project: jhove2-master  File: AssessmentConfigurator.java View source code
/**
     * Initialize the contents of the frame.
     */
private void initialize() {
    frmAssessmentConfigurator = new JFrame();
    frmAssessmentConfigurator.setTitle("Assessment Configurator");
    frmAssessmentConfigurator.setBounds(100, 100, 442, 300);
    frmAssessmentConfigurator.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JMenuBar menuBar = new JMenuBar();
    frmAssessmentConfigurator.setJMenuBar(menuBar);
    JMenu mnFile = new JMenu("File");
    menuBar.add(mnFile);
    JMenu mnHelp = new JMenu("Help");
    menuBar.add(mnHelp);
    JScrollPane scrollPane = new JScrollPane();
    frmAssessmentConfigurator.getContentPane().add(scrollPane, BorderLayout.CENTER);
    table = new JTable();
    table.setModel(new DefaultTableModel(new Object[][] { { null, null, null } }, new String[] { "Name", "Description", "Object Filter" }) {

        Class[] columnTypes = new Class[] { String.class, String.class, String.class };

        public Class getColumnClass(int columnIndex) {
            return columnTypes[columnIndex];
        }
    });
    table.getColumnModel().getColumn(0).setPreferredWidth(30);
    scrollPane.setViewportView(table);
    JPanel panel = new JPanel();
    frmAssessmentConfigurator.getContentPane().add(panel, BorderLayout.SOUTH);
    JButton btnAddRuleset = new JButton("Add RuleSet");
    buttonGroup.add(btnAddRuleset);
    panel.add(btnAddRuleset);
    JButton btnEditRuleset = new JButton("Edit RuleSet");
    buttonGroup.add(btnEditRuleset);
    panel.add(btnEditRuleset);
    JButton btnDeleteRuleset = new JButton("Delete RuleSet");
    buttonGroup.add(btnDeleteRuleset);
    panel.add(btnDeleteRuleset);
    JLabel lblRulesets = new JLabel("RuleSets");
    lblRulesets.setHorizontalAlignment(SwingConstants.CENTER);
    frmAssessmentConfigurator.getContentPane().add(lblRulesets, BorderLayout.NORTH);
}
Example 58
Project: jpreferences-master  File: ProfilesPage.java View source code
/**
	 * Sets the profiles to be displayed and interacted with.
	 * 
	 * @param profiles
	 *            the profiles to set
	 */
public void setProfiles(List<String[]> profiles) {
    // create array for profiles and skip the header
    String[][] p = new String[profiles.size() - 1][];
    for (int i = 0; i < profiles.size() - 1; i++) {
        p[i] = profiles.get(i + 1);
    }
    this.profiles = profiles;
    profilesTable.setModel(new DefaultTableModel(p, profiles.get(0)));
}
Example 59
Project: monsiaj-master  File: CListBuilder.java View source code
@Override
void buildChildren(Interface xml, Container parent, WidgetInfo info) {
    int cCount = info.getChildren().size();
    PandaCList clist = (PandaCList) parent;
    // make all cells uneditable.
    clist.setModel(new DefaultTableModel(0, cCount) {

        @Override
        public boolean isCellEditable(int row, int column) {
            return false;
        }
    });
    for (int i = 0; i < cCount; i++) {
        ChildInfo cInfo = info.getChild(i);
        WidgetInfo wInfo = cInfo.getWidgetInfo();
        Component header = WidgetBuilder.buildWidget(xml, wInfo, parent);
        if (header instanceof JComponent) {
            clist.registerHeaderComponent(i, (JComponent) header);
        } else {
            throw new WidgetBuildingException("not-JComponent component for CList header");
        }
    }
}
Example 60
Project: POS_Toko_Obat-master  File: dbDTransaksi.java View source code
public void tampilDetail(String idTrans, DefaultTableModel dataModel, JLabel totalx, JTable tablex) {
    try {
        Statement stmt = koneksi.createStatement();
        ResultSet rs = stmt.executeQuery("select * from DTransaksi where idTrans = '" + idTrans + "'");
        int total = 0;
        while (rs.next()) {
            String idTransx = rs.getString(1);
            String nama = rs.getString(2);
            int harga = rs.getInt(3);
            int jumlah = rs.getInt(4);
            int subtotal = rs.getInt(5);
            Object[] x = { idTransx, nama, harga, jumlah, subtotal };
            dataModel.addRow(x);
            total += subtotal;
        }
        totalx.setText("" + total);
    } catch (SQLException e) {
        e.printStackTrace();
    }
}
Example 61
Project: qi4j-sdk-master  File: PropertiesPanel.java View source code
/**
     * Create table table or properties using the supplied query
     *
     * @param query the Query
     *
     * @return TableModel
     */
protected TableModel createData(Query query) {
    DefaultTableModel model = new DefaultTableModel();
    for (Object qObj : query) {
        AssociationStateHolder state = qi4jspi.stateOf((EntityComposite) qObj);
        EntityDescriptor descriptor = qi4jspi.entityDescriptorFor((EntityComposite) qObj);
        // genereate column, first time only
        if (model.getColumnCount() < 1) {
            for (PropertyDescriptor persistentPropertyDescriptor : descriptor.state().properties()) {
                model.addColumn(persistentPropertyDescriptor.qualifiedName().name());
            }
        }
        Object[] rowData = new Object[model.getColumnCount()];
        int i = 0;
        for (PropertyDescriptor persistentPropertyDescriptor : descriptor.state().properties()) {
            rowData[i++] = state.propertyFor(persistentPropertyDescriptor.accessor());
        }
        model.addRow(rowData);
    }
    return model;
}
Example 62
Project: snap-desktop-master  File: VariablesTableAdapterTest.java View source code
@Test
public void variablesProperty() {
    final JTable table = new JTable();
    bindingContext.bind("variables", new VariablesTableAdapter(table));
    assertTrue(table.getModel() instanceof DefaultTableModel);
    final DefaultTableModel tableModel = (DefaultTableModel) table.getModel();
    tableModel.addRow(new String[] { "", "" });
    tableModel.addRow(new String[] { "", "" });
    assertEquals(2, table.getRowCount());
    table.setValueAt("a", 0, 0);
    assertEquals("a", table.getValueAt(0, 0));
    table.setValueAt("A", 0, 1);
    assertEquals("A", table.getValueAt(0, 1));
    table.setValueAt("b", 1, 0);
    assertEquals("b", table.getValueAt(1, 0));
    table.setValueAt("B", 1, 1);
    assertEquals("B", table.getValueAt(1, 1));
    bindingContext.getPropertySet().setValue("variables", new MosaicOp.Variable[] { new MosaicOp.Variable("d", "D") });
    assertEquals(1, table.getRowCount());
    assertEquals("d", table.getValueAt(0, 0));
    assertEquals("D", table.getValueAt(0, 1));
}
Example 63
Project: SocialNetworkApp-master  File: SocialNetworkNameChangedListener.java View source code
/**
     * Update network summary panel after a social network is renamed
     * 
     * @param RowsSetEvent rowsSetEvent
     */
public void handleEvent(RowsSetEvent rowsSetEvent) {
    if (!rowsSetEvent.containsColumn(CyNetwork.NAME)) {
        return;
    }
    // Retrieve new network name
    // only 1 row
    CyRow row = rowsSetEvent.getSource().getAllRows().get(0);
    String updatedName = (String) row.getAllValues().get(CyNetwork.NAME);
    Long s = null, suid = (Long) row.getAllValues().get("SUID");
    SocialNetwork network = null;
    CyNetwork cyNetwork = null;
    Iterator<Entry<String, SocialNetwork>> it = this.appManager.getSocialNetworkMap().entrySet().iterator();
    Map.Entry<String, SocialNetwork> pair = null;
    while (it.hasNext()) {
        pair = (Map.Entry<String, SocialNetwork>) it.next();
        network = (SocialNetwork) pair.getValue();
        cyNetwork = network.getCyNetwork();
        if (cyNetwork != null) {
            s = cyNetwork.getSUID();
            if (suid.equals(s)) {
                String oldName = network.getNetworkName();
                // Update SocialNetwork map
                network.setNetworkName(updatedName);
                this.appManager.getSocialNetworkMap().remove(pair.getKey());
                this.appManager.getSocialNetworkMap().put(updatedName, network);
                // Update network summary panel
                DefaultTableModel model = (DefaultTableModel) this.userPanel.getNetworkTableRef().getModel();
                int rowIndex = getRow(model, oldName);
                if (rowIndex > -1) {
                    model.setValueAt(updatedName, rowIndex, 0);
                }
            }
        }
    }
}
Example 64
Project: SoftwareProjekt-master  File: GUI.java View source code
private JPanel createTokenStreamTable() {
    JPanel tablePanel = new JPanel();
    tableColl = new Vector<String>();
    tableRow = new Vector<Vector<String>>();
    tableColl.add("#");
    tableColl.add("type");
    tableColl.add("target");
    tableColl.add("typeTarget");
    tableColl.add("op1");
    tableColl.add("typeOp1");
    tableColl.add("op2");
    tableColl.add("typeOp2");
    tableColl.add("parameter");
    DefaultTableModel tableModle = new DefaultTableModel(tableRow, tableColl);
    JTable table = new JTable(tableModle);
    table.setPreferredScrollableViewportSize(new Dimension(500, 300));
    table.setFillsViewportHeight(true);
    JScrollPane scrollPane = new JScrollPane(table);
    tablePanel.add(scrollPane);
    return tablePanel;
}
Example 65
Project: spring-rich-client-master  File: ShuttleSortableTableModelTests.java View source code
public void testNullComparisonWithComparator() {
    Object[] columnNames = new Object[] { "first name", "last name" };
    Object[][] data = new Object[][] { { "Peter", "De Bruycker" }, { "Jan", "Hoskens" }, { null, "test" } };
    DefaultTableModel tableModel = new DefaultTableModel(data, columnNames);
    ShuttleSortableTableModel shuttleSortableTableModel = new ShuttleSortableTableModel(tableModel);
    shuttleSortableTableModel.setComparator(0, new Comparator() {

        public int compare(Object o1, Object o2) {
            String s1 = (String) o1;
            String s2 = (String) o2;
            if (s1 == null && s2 == null) {
                return 0;
            }
            if (s1 == null) {
                return 1;
            }
            if (s2 == null) {
                return -1;
            }
            return s1.compareTo(s2);
        }
    });
    shuttleSortableTableModel.sortByColumn(new ColumnToSort(1, 0));
    // the row with first name == null must be the last one after sort
    assertEquals("Jan", shuttleSortableTableModel.getValueAt(0, 0));
    assertEquals("Peter", shuttleSortableTableModel.getValueAt(1, 0));
    assertEquals(null, shuttleSortableTableModel.getValueAt(2, 0));
}
Example 66
Project: springrcp-master  File: ShuttleSortableTableModelTests.java View source code
public void testNullComparisonWithComparator() {
    Object[] columnNames = new Object[] { "first name", "last name" };
    Object[][] data = new Object[][] { { "Peter", "De Bruycker" }, { "Jan", "Hoskens" }, { null, "test" } };
    DefaultTableModel tableModel = new DefaultTableModel(data, columnNames);
    ShuttleSortableTableModel shuttleSortableTableModel = new ShuttleSortableTableModel(tableModel);
    shuttleSortableTableModel.setComparator(0, new Comparator() {

        public int compare(Object o1, Object o2) {
            String s1 = (String) o1;
            String s2 = (String) o2;
            if (s1 == null && s2 == null) {
                return 0;
            }
            if (s1 == null) {
                return 1;
            }
            if (s2 == null) {
                return -1;
            }
            return s1.compareTo(s2);
        }
    });
    shuttleSortableTableModel.sortByColumn(new ColumnToSort(1, 0));
    // the row with first name == null must be the last one after sort
    assertEquals("Jan", shuttleSortableTableModel.getValueAt(0, 0));
    assertEquals("Peter", shuttleSortableTableModel.getValueAt(1, 0));
    assertEquals(null, shuttleSortableTableModel.getValueAt(2, 0));
}
Example 67
Project: swp-uebersetzerbau-ss12-master  File: GUI.java View source code
private JPanel createTokenStreamTable() {
    JPanel tablePanel = new JPanel();
    tableColl = new Vector<String>();
    tableRow = new Vector<Vector<String>>();
    tableColl.add("#");
    tableColl.add("type");
    tableColl.add("target");
    tableColl.add("typeTarget");
    tableColl.add("op1");
    tableColl.add("typeOp1");
    tableColl.add("op2");
    tableColl.add("typeOp2");
    tableColl.add("parameter");
    DefaultTableModel tableModle = new DefaultTableModel(tableRow, tableColl);
    JTable table = new JTable(tableModle);
    table.setPreferredScrollableViewportSize(new Dimension(500, 300));
    table.setFillsViewportHeight(true);
    JScrollPane scrollPane = new JScrollPane(table);
    tablePanel.add(scrollPane);
    return tablePanel;
}
Example 68
Project: zombieland-master  File: InterfazRankingPartida.java View source code
/**
	 * Initialize the contents of the frame.
	 */
private void initialize() {
    frmRanking = new JFrame();
    frmRanking.setTitle("Ranking");
    frmRanking.setBounds(100, 100, 800, 600);
    frmRanking.setResizable(false);
    frmRanking.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frmRanking.getContentPane().setLayout(null);
    JLabel lblPartida = new JLabel("Nombre_Partida");
    lblPartida.setBackground(Color.WHITE);
    lblPartida.setForeground(Color.BLACK);
    lblPartida.setFont(new Font("Trebuchet MS", Font.PLAIN, 36));
    lblPartida.setBounds(10, 0, 774, 81);
    frmRanking.getContentPane().add(lblPartida);
    JLabel label = new JLabel("");
    label.setIcon(new ImageIcon(RutaImagen.get("imagenes/fondoRankPartida.png")));
    label.setBounds(10, 335, 800, 255);
    frmRanking.getContentPane().add(label);
    table = new JTable();
    table.setEnabled(false);
    table.setShowVerticalLines(false);
    table.setBackground(new Color(192, 192, 192));
    table.setBorder(new EmptyBorder(0, 0, 0, 0));
    table.setShowHorizontalLines(false);
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.setForeground(Color.BLACK);
    table.setModel(new DefaultTableModel(new Object[][] { { null, null }, { null, null }, { null, null }, { null, null }, { null, null }, { null, null }, { null, null }, { null, null }, { null, null }, { null, null } }, new String[] { "Nombre de usuario", "Puntaje" }) {

        /**
			 * 
			 */
        private static final long serialVersionUID = 1L;

        Class<?>[] columnTypes = new Class[] { String.class, Integer.class };

        public Class<?> getColumnClass(int columnIndex) {
            return columnTypes[columnIndex];
        }
    });
    table.getColumnModel().getColumn(0).setPreferredWidth(570);
    table.setBounds(48, 144, 679, 160);
    frmRanking.getContentPane().add(table);
    JLabel lblNombreDeUsuario = new JLabel("Nombre de usuario");
    lblNombreDeUsuario.setBounds(48, 120, 159, 14);
    frmRanking.getContentPane().add(lblNombreDeUsuario);
    JLabel lblPuntaje = new JLabel("Puntaje");
    lblPuntaje.setBounds(651, 119, 76, 14);
    frmRanking.getContentPane().add(lblPuntaje);
    JButton btnRegresar = new JButton("Regresar");
    btnRegresar.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent arg0) {
        // Volver a la ronda.
        }
    });
    btnRegresar.setBounds(386, 325, 182, 50);
    frmRanking.getContentPane().add(btnRegresar);
}
Example 69
Project: sqe-master  File: ConfigureRulesPanel.java View source code
private void fillTable() {
    if (null == pmdSettings) {
        return;
    }
    DefaultTableModel model = new javax.swing.table.DefaultTableModel(new Object[][] {}, new String[] { "Rule", "Enabled" }) {

        Class[] types = new Class[] { java.lang.String.class, java.lang.Boolean.class };

        boolean[] canEdit = new boolean[] { false, true };

        @Override
        public Class getColumnClass(int columnIndex) {
            return types[columnIndex];
        }

        @Override
        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit[columnIndex];
        }
    };
    Collection<Rule> rules = new ArrayList<Rule>();
    RuleSetFactory ruleSetFactory = new RuleSetFactory();
    try {
        Iterator<RuleSet> iterator = ruleSetFactory.getRegisteredRuleSets();
        while (iterator.hasNext()) {
            RuleSet ruleSet = iterator.next();
            rules.addAll(ruleSet.getRules());
        }
        for (Rule rule : rules) {
            //if rule is not in preferences then assume it is ON
            model.addRow(new Object[] { rule, pmdSettings.isRuleActive(rule) });
        }
        SortedRuleTableModel sorter = new SortedRuleTableModel(model, rulesTable.getTableHeader());
        rulesTable.setModel(sorter);
        rulesTable.getColumnModel().getColumn(0).setCellRenderer(new RuleCellRenderer());
        rulesTable.getSelectionModel().addListSelectionListener(new RulesListListener());
    } catch (RuleSetNotFoundException ex) {
        logger.log(Level.SEVERE, "exception", ex);
    }
}
Example 70
Project: tri-master  File: WordListDialog.java View source code
/**
     * 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")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
    jScrollPane1 = new javax.swing.JScrollPane();
    table = new javax.swing.JTable();
    jPanel1 = new javax.swing.JPanel();
    saveb = new javax.swing.JButton();
    cancelb = new javax.swing.JButton();
    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("Results");
    table.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {}, new String[] { "Word", "Score" }) {

        Class[] types = new Class[] { java.lang.String.class, java.lang.Double.class };

        public Class getColumnClass(int columnIndex) {
            return types[columnIndex];
        }
    });
    jScrollPane1.setViewportView(table);
    getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
    jPanel1.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
    saveb.setText("Save...");
    saveb.setPreferredSize(new java.awt.Dimension(74, 31));
    saveb.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            savebActionPerformed(evt);
        }
    });
    jPanel1.add(saveb);
    saveb.getAccessibleContext().setAccessibleName("");
    cancelb.setText("Cancel");
    cancelb.setPreferredSize(new java.awt.Dimension(74, 31));
    cancelb.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            cancelbActionPerformed(evt);
        }
    });
    jPanel1.add(cancelb);
    getContentPane().add(jPanel1, java.awt.BorderLayout.SOUTH);
    pack();
    setLocationRelativeTo(null);
}
Example 71
Project: compiler_syntax-master  File: Syntax_Frame.java View source code
/**
     * 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")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
    jPanel1 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    text_area = new javax.swing.JTextArea();
    jLabel1 = new javax.swing.JLabel();
    Syntax_button = new javax.swing.JButton();
    analysis_button = new javax.swing.JButton();
    clean_button = new javax.swing.JButton();
    jScrollPane2 = new javax.swing.JScrollPane();
    production_table = new javax.swing.JTable();
    jScrollPane3 = new javax.swing.JScrollPane();
    result_table = new javax.swing.JTable();
    jLabel2 = new javax.swing.JLabel();
    jLabel3 = new javax.swing.JLabel();
    read_button = new javax.swing.JButton();
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    text_area.setColumns(20);
    text_area.setRows(5);
    jScrollPane1.setViewportView(text_area);
    jLabel1.setText("代�区");
    Syntax_button.setText("导入文法");
    Syntax_button.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            Syntax_buttonActionPerformed(evt);
        }
    });
    analysis_button.setText("�法分�");
    analysis_button.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            analysis_buttonActionPerformed(evt);
        }
    });
    clean_button.setText("清空文本");
    clean_button.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            clean_buttonActionPerformed(evt);
        }
    });
    production_table.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null } }, new String[] { "编�", "产生�", "select集" }));
    jScrollPane2.setViewportView(production_table);
    result_table.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null }, { null, null, null } }, new String[] { "栈内元素", "输入缓冲区", "说明" }));
    jScrollPane3.setViewportView(result_table);
    jLabel2.setText("产生�select集");
    jLabel3.setText("�法分�区");
    read_button.setText("导入文本");
    read_button.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            read_buttonActionPerformed(evt);
        }
    });
    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addGap(23, 23, 23).addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addComponent(jLabel3).addGap(0, 0, Short.MAX_VALUE)).addComponent(jScrollPane3).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 515, Short.MAX_VALUE).addGap(30, 30, 30).addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addComponent(Syntax_button).addComponent(analysis_button).addComponent(clean_button).addComponent(read_button, javax.swing.GroupLayout.Alignment.LEADING))).addGroup(jPanel1Layout.createSequentialGroup().addComponent(jLabel1).addGap(0, 0, Short.MAX_VALUE))).addGap(18, 18, 18).addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jLabel2).addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 472, javax.swing.GroupLayout.PREFERRED_SIZE)))).addContainerGap()));
    jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel1).addComponent(jLabel2)).addGap(4, 4, 4).addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false).addComponent(jScrollPane1).addGroup(jPanel1Layout.createSequentialGroup().addComponent(Syntax_button).addGap(45, 45, 45).addComponent(read_button).addGap(41, 41, 41).addComponent(analysis_button).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 46, Short.MAX_VALUE).addComponent(clean_button).addGap(26, 26, 26)).addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(jLabel3).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(172, 172, 172)));
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(0, 10, Short.MAX_VALUE)));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 607, javax.swing.GroupLayout.PREFERRED_SIZE));
    pack();
}
Example 72
Project: emergency-service-drools-app-master  File: EmergenciesDashboard.java View source code
/** 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")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
    jTabbedPane1 = new javax.swing.JTabbedPane();
    jPanel1 = new javax.swing.JPanel();
    jPanel2 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    System.out.println(">>>>  Opening the DASHBOARD");
    emergenciesjTable = new javax.swing.JTable();
    jPanel3 = new javax.swing.JPanel();
    refreshjButton = new javax.swing.JButton();
    liveReportjButton = new javax.swing.JButton();
    jPanel4 = new javax.swing.JPanel();
    jPanel5 = new javax.swing.JPanel();
    jPanel6 = new javax.swing.JPanel();
    jButton1 = new javax.swing.JButton();
    jButton2 = new javax.swing.JButton();
    jScrollPane2 = new javax.swing.JScrollPane();
    hospitalsjTable = new javax.swing.JTable();
    jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Emergencies", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));
    Collection<Emergency> emergencies = (Collection<Emergency>) persistenceService.getAllEmergencies();
    System.out.println(">>>>  Emergencies Count in the DASHBOARD:" + emergencies.size());
    Object[][] emergenciesArray = new Object[emergencies.size()][4];
    Iterator<Emergency> it = emergencies.iterator();
    int i = 0;
    while (it.hasNext()) {
        Emergency emergency = it.next();
        emergenciesArray[i][0] = emergency.getId();
        emergenciesArray[i][1] = emergency.getCall().getId();
        emergenciesArray[i][2] = emergency.getType().toString();
        emergenciesArray[i][3] = emergency.getNroOfPeople();
        i++;
    }
    emergenciesjTable.setModel(new javax.swing.table.DefaultTableModel(emergenciesArray, new String[] { "Emergency ID", "Call ID", "Emergency Type", "People involved" }));
    jScrollPane1.setViewportView(emergenciesjTable);
    jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Actions", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));
    refreshjButton.setText("Refresh");
    refreshjButton.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            refreshjButtonActionPerformed(evt);
        }
    });
    liveReportjButton.setText("Emergency Live Report");
    liveReportjButton.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            liveReportjButtonActionPerformed(evt);
        }
    });
    org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
    jPanel3.setLayout(jPanel3Layout);
    jPanel3Layout.setHorizontalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel3Layout.createSequentialGroup().add(refreshjButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 108, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED).add(liveReportjButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 225, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addContainerGap()));
    jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(refreshjButton).add(liveReportjButton)));
    org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jScrollPane1).add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel2Layout.createSequentialGroup().add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 155, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addContainerGap(27, Short.MAX_VALUE)));
    org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    jTabbedPane1.addTab("Emergencies", jPanel1);
    jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Hospitals", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));
    jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Actions", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));
    jButton1.setText("Refresh");
    jButton1.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton1ActionPerformed(evt);
        }
    });
    jButton2.setText("View Hospital Status");
    org.jdesktop.layout.GroupLayout jPanel6Layout = new org.jdesktop.layout.GroupLayout(jPanel6);
    jPanel6.setLayout(jPanel6Layout);
    jPanel6Layout.setHorizontalGroup(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel6Layout.createSequentialGroup().add(5, 5, 5).add(jButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 109, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED).add(jButton2).addContainerGap()));
    jPanel6Layout.setVerticalGroup(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel6Layout.createSequentialGroup().add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jButton2).add(jButton1)).addContainerGap()));
    hospitalsjTable.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null } }, new String[] { "Title 1", "Title 2", "Title 3", "Title 4" }));
    jScrollPane2.setViewportView(hospitalsjTable);
    org.jdesktop.layout.GroupLayout jPanel5Layout = new org.jdesktop.layout.GroupLayout(jPanel5);
    jPanel5.setLayout(jPanel5Layout);
    jPanel5Layout.setHorizontalGroup(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jScrollPane2).add(jPanel6, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel5Layout.createSequentialGroup().add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 141, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addContainerGap(35, Short.MAX_VALUE)));
    org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4);
    jPanel4.setLayout(jPanel4Layout);
    jPanel4Layout.setHorizontalGroup(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    jTabbedPane1.addTab("Hospitals", jPanel4);
    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jTabbedPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 487, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE));
    layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(layout.createSequentialGroup().add(jTabbedPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 319, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addContainerGap()));
    pack();
}
Example 73
Project: autopsy-master  File: IngestProgressSnapshotPanel.java View source code
/**
     * 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")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
    snapshotsScrollPane = new javax.swing.JScrollPane();
    threadActivitySnapshotsTable = new javax.swing.JTable();
    jobScrollPane = new javax.swing.JScrollPane();
    jobTable = new javax.swing.JTable();
    refreshButton = new javax.swing.JButton();
    closeButton = new javax.swing.JButton();
    moduleScrollPane = new javax.swing.JScrollPane();
    moduleTable = new javax.swing.JTable();
    threadActivitySnapshotsTable.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {}, new String[] {}));
    snapshotsScrollPane.setViewportView(threadActivitySnapshotsTable);
    jobTable.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {}, new String[] {}));
    jobScrollPane.setViewportView(jobTable);
    // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(refreshButton, org.openide.util.NbBundle.getMessage(IngestProgressSnapshotPanel.class, "IngestProgressSnapshotPanel.refreshButton.text"));
    refreshButton.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            refreshButtonActionPerformed(evt);
        }
    });
    // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(closeButton, org.openide.util.NbBundle.getMessage(IngestProgressSnapshotPanel.class, "IngestProgressSnapshotPanel.closeButton.text"));
    closeButton.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            closeButtonActionPerformed(evt);
        }
    });
    moduleTable.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {}, new String[] {}));
    moduleScrollPane.setViewportView(moduleTable);
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addComponent(snapshotsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 881, Short.MAX_VALUE).addGroup(layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE).addComponent(refreshButton).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(closeButton)).addComponent(jobScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 881, Short.MAX_VALUE).addComponent(moduleScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 881, Short.MAX_VALUE)).addContainerGap()));
    layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] { closeButton, refreshButton });
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(snapshotsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 102, Short.MAX_VALUE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jobScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 102, Short.MAX_VALUE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(moduleScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(refreshButton).addComponent(closeButton)).addContainerGap()));
    layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] { closeButton, refreshButton });
}
Example 74
Project: aap-2013-2-master  File: AnimalListarFrame.java View source code
/** 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")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
    jScrollPane1 = new javax.swing.JScrollPane();
    tabela = new javax.swing.JTable();
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    tabela.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null } }, new String[] { "Title 1", "Title 2", "Title 3", "Title 4" }));
    jScrollPane1.setViewportView(tabela);
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 375, javax.swing.GroupLayout.PREFERRED_SIZE).addContainerGap(13, Short.MAX_VALUE)));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE).addContainerGap(13, Short.MAX_VALUE)));
    pack();
}
Example 75
Project: CheS-Mapper-master  File: CCDataTable.java View source code
@Override
protected DefaultTableModel createTableModel() {
    DefaultTableModel model = new DefaultTableModel() {

        @Override
        public Class<?> getColumnClass(int columnIndex) {
            if (columnIndex == 0)
                return Integer.class;
            if (columnIndex == 1)
                return Compound.class;
            if (columnIndex >= nonPropColumns && props.get(columnIndex - nonPropColumns) instanceof NumericProperty)
                return Double.class;
            return String.class;
        }

        @Override
        public boolean isCellEditable(int row, int column) {
            return false;
        }
    };
    model.addColumn("");
    model.addColumn(WordUtils.capitalize(getItemName()));
    model.addColumn(getExtraColumn());
    nonPropColumns = model.getColumnCount();
    for (CompoundProperty p : props) model.addColumn(p);
    return model;
}
Example 76
Project: cl1-master  File: NodeSetPropertiesPanel.java View source code
/** Sets up the table model */
protected void setupTableModel() {
    model = new DefaultTableModel(columnNames, 0);
    String[] rowNames = { "Number of nodes:", "In-weight:", "Out-weight:", "Density:", "Quality:", "P-value:" };
    Object[] row = new Object[2];
    for (String rowName : rowNames) {
        row[0] = rowName;
        row[1] = null;
        model.addRow(row);
    }
    detailsTable.setModel(model);
    detailsTable.getColumn(detailsTable.getColumnName(0)).setCellRenderer(new RightAlignedLabelRenderer());
}
Example 77
Project: ComicEPUB-master  File: TableRowTransferHandler.java View source code
@Override
public boolean importData(TransferSupport info) {
    JTable target = (JTable) info.getComponent();
    JTable.DropLocation dl = (JTable.DropLocation) info.getDropLocation();
    DefaultTableModel model = (DefaultTableModel) target.getModel();
    int index = dl.getRow();
    int max = model.getRowCount();
    if (index < 0 || index > max)
        index = max;
    addIndex = index;
    target.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    try {
        int[] indices = (int[]) info.getTransferable().getTransferData(localObjectFlavor);
        if (source == target)
            addCount = indices.length;
        for (int i = 0; i < indices.length; i++) {
            int idx = index++;
            IImageFileInfo fileInfo = mList.get(indices[i]);
            model.insertRow(idx, Constant.createRecord(fileInfo));
            mList.insert(idx, fileInfo);
            target.getSelectionModel().addSelectionInterval(idx, idx);
        }
        return true;
    } catch (Exception ufe) {
        ufe.printStackTrace();
    }
    return false;
}
Example 78
Project: credenjava-master  File: ListadoPlantillas.java View source code
/** 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.
     */
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents() {
    jPanel1 = new javax.swing.JPanel();
    jPanel2 = new javax.swing.JPanel();
    jPanel3 = new javax.swing.JPanel();
    jPanel4 = new javax.swing.JPanel();
    jButton1 = new javax.swing.JButton();
    jButton2 = new javax.swing.JButton();
    jPanel5 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTable1 = new javax.swing.JTable();
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    getContentPane().add(jPanel1, java.awt.BorderLayout.EAST);
    getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH);
    getContentPane().add(jPanel3, java.awt.BorderLayout.WEST);
    jButton1.setText("Editar");
    jButton1.addMouseListener(new java.awt.event.MouseAdapter() {

        public void mouseClicked(java.awt.event.MouseEvent evt) {
            jButton1MouseClicked(evt);
        }
    });
    jPanel4.add(jButton1);
    jButton2.setText("Cerrar");
    jPanel4.add(jButton2);
    getContentPane().add(jPanel4, java.awt.BorderLayout.NORTH);
    jPanel5.setLayout(new java.awt.GridLayout());
    jPanel5.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
    jTable1.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null } }, new String[] { "Title 1", "Title 2", "Title 3", "Title 4" }));
    jScrollPane1.setViewportView(jTable1);
    jPanel5.add(jScrollPane1);
    getContentPane().add(jPanel5, java.awt.BorderLayout.CENTER);
    pack();
}
Example 79
Project: dwoss-master  File: AfterInvoiceTablePanel.java View source code
/** 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")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
    jScrollPane1 = new javax.swing.JScrollPane();
    table = new javax.swing.JTable();
    jScrollPane2 = new javax.swing.JScrollPane();
    reasonArea = new javax.swing.JTextArea();
    table.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null } }, new String[] { "Title 1", "Title 2", "Title 3", "Title 4" }));
    jScrollPane1.setViewportView(table);
    reasonArea.setColumns(20);
    reasonArea.setRows(5);
    reasonArea.setBorder(javax.swing.BorderFactory.createTitledBorder("Grund / Beschreibung"));
    jScrollPane2.setViewportView(reasonArea);
    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, 660, Short.MAX_VALUE).addComponent(jScrollPane2));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(0, 0, Short.MAX_VALUE)));
}
Example 80
Project: felix-master  File: OsgiProbesTabUI.java View source code
public void propertyChange(PropertyChangeEvent e) {
    /*
     * This a static tab, each new visit will provide the same
     * information. A dynamic tab update is provided in LinuxTab
     *
     */
    if (e.getPropertyName().equals(Plugin.NEW_NODE_READY)) {
        this.getProperties((MBeanServerConnection) e.getNewValue());
    } else if (e.getPropertyName().equals(Plugin.EMPTY_NODE)) {
        this.innerTable.setModel(new DefaultTableModel());
        this.invalidate();
        this.validate();
    }
}
Example 81
Project: geotools-tike-master  File: GeometryPanel.java View source code
/** 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.
     */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    jScrollPane1 = new javax.swing.JScrollPane();
    jXTable1 = new org.jdesktop.swingx.JXTable();
    jXTable1.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null } }, new String[] { "Title 1", "Title 2", "Title 3", "Title 4" }));
    jScrollPane1.setViewportView(jXTable1);
    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup().addContainerGap(221, Short.MAX_VALUE).add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 167, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(layout.createSequentialGroup().addContainerGap().add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 276, Short.MAX_VALUE).addContainerGap()));
}
Example 82
Project: gtitool-master  File: HistoryPathComponentTest.java View source code
/**
   * The main method.
   * 
   * @param arguments The arguments.
   */
public static void main(String[] arguments) {
    try {
        // Word
        Word word = new DefaultWord();
        // Symbol
        //$NON-NLS-1$
        Symbol symbol0 = new DefaultSymbol("a");
        //$NON-NLS-1$
        Symbol symbol1 = new DefaultSymbol("b");
        //$NON-NLS-1$
        Symbol symbol2 = new DefaultSymbol("c");
        //$NON-NLS-1$
        Symbol symbol3 = new DefaultSymbol("d");
        //$NON-NLS-1$
        Symbol symbol4 = new DefaultSymbol("e");
        //$NON-NLS-1$
        Symbol symbol5 = new DefaultSymbol("f");
        //$NON-NLS-1$
        Symbol symbol6 = new DefaultSymbol("g");
        //$NON-NLS-1$
        Symbol symbol7 = new DefaultSymbol("h");
        //$NON-NLS-1$
        Symbol symbol8 = new DefaultSymbol("i");
        //$NON-NLS-1$
        Symbol symbol9 = new DefaultSymbol("j");
        // Alphabet
        Alphabet alphabet = new DefaultAlphabet(symbol0, symbol1, symbol2, symbol3, symbol4, symbol5, symbol6, symbol7, symbol8, symbol9);
        // State
        //$NON-NLS-1$
        State state0 = new DefaultState("z0");
        //$NON-NLS-1$
        State state1 = new DefaultState("z1");
        //$NON-NLS-1$
        State state2 = new DefaultState("z2");
        // Transition
        Transition transition0 = new DefaultTransition(alphabet, alphabet, word, word, state0, state1, symbol0, symbol1, symbol2, symbol3, symbol4, symbol5, symbol6, symbol7, symbol8, symbol9);
        Transition transition1 = new DefaultTransition(alphabet, alphabet, word, word, state1, state2, symbol1, symbol2);
        Transition transition2 = new DefaultTransition(alphabet, alphabet, word, word, state2, state2, symbol0, symbol1, symbol2);
        // HistoryPath
        HistoryPath historyPath = new HistoryPath();
        historyPath.add(transition0, symbol0);
        historyPath.add(transition1, symbol2);
        historyPath.add(transition2, symbol2);
        // Model
        DefaultTableModel model = new DefaultTableModel();
        //$NON-NLS-1$
        model.addColumn("History");
        model.addRow(new Object[] { historyPath });
        // ColumnModel
        DefaultTableColumnModel columnModel = new DefaultTableColumnModel();
        TableColumn historyColumn = new TableColumn(0);
        //$NON-NLS-1$
        historyColumn.setHeaderValue("History");
        historyColumn.setCellRenderer(new HistoryPathTableCellRenderer());
        columnModel.addColumn(historyColumn);
        //$NON-NLS-1$
        JFrame jFrame = new JFrame("PrettyStringHistoryComponentTest");
        JTable jTable = new JTable() {

            /**
         * The serial version uid.
         */
            private static final long serialVersionUID = -585804705346618616L;

            @Override
            public boolean isCellEditable(@SuppressWarnings("unused") int x, @SuppressWarnings("unused") int y) {
                return false;
            }
        };
        jTable.setModel(model);
        jTable.setColumnModel(columnModel);
        JScrollPane jScrollPane = new JScrollPane();
        jScrollPane.setViewportView(jTable);
        jFrame.add(jScrollPane);
        jFrame.setBounds(0, 0, 800, 600);
        jFrame.setLocationRelativeTo(null);
        jFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        jFrame.setVisible(true);
    } catch (Exception exc) {
        exc.printStackTrace();
        System.exit(1);
    }
}
Example 83
Project: hfsexplorer-master  File: JavaPartitionEditor.java View source code
/** 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.
     */
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents() {
    jScrollPane1 = new javax.swing.JScrollPane();
    jTable1 = new javax.swing.JTable();
    jTable1.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null } }, new String[] { "Number", "Type", "Offset", "Length" }) {

        boolean[] canEdit = new boolean[] { false, false, false, false };

        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit[columnIndex];
        }
    });
    jScrollPane1.setViewportView(jTable1);
    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(layout.createSequentialGroup().addContainerGap().add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 505, Short.MAX_VALUE).addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(layout.createSequentialGroup().addContainerGap().add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 260, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addContainerGap(92, Short.MAX_VALUE)));
}
Example 84
Project: hook-any-text-master  File: HistoryDialog.java View source code
@Override
public synchronized void update(Observable o, Object arg) {
    History history = (History) o;
    DefaultTableModel model = (DefaultTableModel) historyTable.getModel();
    model.addRow(new Object[] { breakTooltipContent(history.getLast().getInput(), 100), breakTooltipContent(history.getLast().getOutput(), 100) });
    if (model.getRowCount() > History.HISTORY_MAX_SIZE) {
        model.removeRow(0);
    }
    latestDisplayed = model.getRowCount() - 1;
}
Example 85
Project: IDDEA-master  File: DataManager.java View source code
public void getData(DefaultTableModel datamodel) {
    String sqlselection = "SELECT junctions.Id AS Junction, junctions.X AS JX, junctions.Y AS JY, junctions.T AS JT, junctions.SpatialNeighbors AS JSps, junctions.TemporalNeighbors AS JTps, " + "endpoints.Id AS Endpoint, endpoints.X AS EX, endpoints.Y AS EY, endpoints.T AS ET, endpoints.SpatialNeighbors AS ESps, endpoints.TemporalNeighbors AS ETps " + "FROM junctions LEFT JOIN endpoints ON junctions.Id = endpoints.Junction";
    try {
        ResultSet result = stm.executeQuery(sqlselection);
        if (result != null) {
            while (result.next()) {
                datamodel.addRow(new Object[] { result.getInt("Junction"), result.getInt("JX"), result.getInt("JY"), result.getInt("JT"), result.getString("JSps"), result.getString("JTps"), result.getInt("Endpoint"), result.getInt("EX"), result.getInt("EY"), result.getInt("ET"), result.getString("ESps"), result.getString("ETps") });
            }
        }
    } catch (SQLException se) {
        se.printStackTrace();
    }
}
Example 86
Project: inquisition-master  File: DragAndDropQuestionEditorPanel.java View source code
private DefaultTableModel makeExtraFragmentsTableModel(DragAndDropQuestion question) {
    List<String> extraFragments = question.getExtraFragments();
    Object[][] tableRows = new Object[extraFragments.size()][];
    for (int i = 0; i < extraFragments.size(); i++) tableRows[i] = new Object[] { extraFragments.get(i) };
    DefaultTableModel model = new DefaultTableModel(tableRows, new String[] { "Extra fragments" }) {

        @Override
        public Class<?> getColumnClass(int columnIndex) {
            return java.lang.String.class;
        }
    };
    return model;
}
Example 87
Project: intellij-generator-plugin-master  File: TypeToTextPanel.java View source code
protected DefaultTableModel createTableModel() {
    String[] columNames = { "type (full qualified)", "initializer expression", "generate add/remove" };
    DefaultTableModel defaultTableModel = new DefaultTableModel(initializerRowData, columNames) {

        public boolean isCellEditable(int row, int col) {
            return true;
        }

        @Override
        public Class<?> getColumnClass(int i) {
            if (i == 2) {
                return Boolean.class;
            }
            return super.getColumnClass(i);
        }
    };
    return defaultTableModel;
}
Example 88
Project: irma_card_management-master  File: LogDetailView.java View source code
public void setLogEntry(LogEntry log) {
    try {
        credential = log.getCredential();
        String action = "";
        if (log instanceof IssueLogEntry) {
            action = "Issue";
        } else if (log instanceof VerifyLogEntry) {
            action = "Verify";
        } else if (log instanceof RemoveLogEntry) {
            action = "Remove";
        }
        lblTitle.setText(String.format("<html>%s <a href=\"%d\">%s</a></html>", action, credential.getId(), credential.getName()));
        lblTimestamp.setText(log.getTimestamp().toString());
        DefaultTableModel tableModel = new DefaultTableModel(COLUMN_NAMES, 0);
        table.setModel(tableModel);
        Attributes attributes = credentials.getAttributes(credential);
        for (AttributeDescription attribute : credential.getAttributes()) {
            tableModel.addRow(new Object[] { attribute.getName(), new String(attributes.get(attribute.getName())), attribute.getDescription() });
        }
    //		} catch (InfoException e) {
    //			e.printStackTrace();
    } catch (CardServiceException e) {
        e.printStackTrace();
    }
}
Example 89
Project: j-maanova-master  File: ExperimentDesignPanel.java View source code
/**
     * do initialization after GUI build init
     */
@SuppressWarnings("serial")
private void postGuiInit(MicroarrayExperiment experiment) {
    MicroarrayExperimentDesign design = experiment.getDesign();
    DefaultTableModel tableModel = new DefaultTableModel(design.getDesignData(), design.getDesignFactors()) {

        /**
             * {@inheritDoc}
             */
        @Override
        public boolean isCellEditable(int row, int column) {
            return false;
        }
    };
    this.designTable.setModel(tableModel);
}
Example 90
Project: jEdit-master  File: ListModelEditor.java View source code
public void open(DefaultListModel listModel) {
    final DefaultTableModel tableModel = createTableModel(listModel);
    final JTable table = new JTable(tableModel);
    // TODO: put this string in properties
    table.setToolTipText("Move: PgUp/PgDown; Edit: Double-Click or Insert/Delete");
    table.setRowHeight(GenericGUIUtilities.defaultRowHeight());
    table.getColumnModel().getColumn(0).setPreferredWidth(GenericGUIUtilities.defaultColumnWidth());
    table.addKeyListener(new KeyAdapter() {

        public void keyPressed(KeyEvent e) {
            int[] selRows = table.getSelectedRows();
            if (selRows.length == 0) {
                return;
            }
            int firstSelectedRow = selRows[0];
            int key = e.getKeyCode();
            ListSelectionModel selectionModel = table.getSelectionModel();
            switch(key) {
                case KeyEvent.VK_DELETE:
                    for (int i = selRows.length - 1; i >= 0; i--) {
                        tableModel.removeRow(selRows[i]);
                    }
                    if (firstSelectedRow >= 0 && firstSelectedRow < tableModel.getRowCount()) {
                        selectionModel.addSelectionInterval(firstSelectedRow, firstSelectedRow);
                    }
                    // avoid beep
                    e.consume();
                    break;
                case KeyEvent.VK_INSERT:
                    tableModel.insertRow(firstSelectedRow + 1, new String[] { "" });
                    // Dont edit cell
                    e.consume();
                    break;
                case KeyEvent.VK_PAGE_UP:
                case KeyEvent.VK_PAGE_DOWN:
                    boolean isUp = key == KeyEvent.VK_PAGE_UP;
                    int direction = isUp ? -1 : 1;
                    int min = selectionModel.getMinSelectionIndex() + direction;
                    int max = selectionModel.getMaxSelectionIndex() + direction;
                    if (min < 0 || max >= tableModel.getRowCount()) {
                        // avoid ArrayIndexOutOfBoundsException
                        return;
                    }
                    for (int i = 0; i < selRows.length; i++) {
                        int row = selRows[isUp ? i : (selRows.length - 1 - i)];
                        int to = row + direction;
                        selectionModel.removeSelectionInterval(row, row);
                        selectionModel.addSelectionInterval(to, to);
                        tableModel.moveRow(row, row, to);
                    }
                    break;
            }
        }
    });
    int result = JOptionPane.showConfirmDialog(null, table, "Change " + jEdit.getProperty("history.caption"), JOptionPane.OK_CANCEL_OPTION);
    if (result == JOptionPane.OK_OPTION) {
        updatelistModel(listModel, tableModel);
    }
}
Example 91
Project: josm-master  File: RelationMemberListMergeModel.java View source code
@Override
protected void setValueAt(DefaultTableModel model, Object value, int row, int col) {
    if (model == getMergedTableModel() && col == 1) {
        RelationMember memberOld = getMergedEntries().get(row);
        RelationMember memberNew = new RelationMember((String) value, memberOld.getMember());
        getMergedEntries().remove(row);
        getMergedEntries().add(row, memberNew);
        fireModelDataChanged();
    }
}
Example 92
Project: josm-older-master  File: RelationMemberListMergeModel.java View source code
@Override
protected void setValueAt(DefaultTableModel model, Object value, int row, int col) {
    if (model == getMergedTableModel() && col == 1) {
        RelationMember memberOld = getMergedEntries().get(row);
        RelationMember memberNew = new RelationMember((String) value, memberOld.getMember());
        getMergedEntries().remove(row);
        getMergedEntries().add(row, memberNew);
        fireModelDataChanged();
    }
}
Example 93
Project: jsonde-master  File: SunJVMFieldsPanel.java View source code
private JTable getVirtualMachineTable() {
    DefaultTableModel vmTableModel = new DefaultTableModel();
    vmTableModel.addColumn("PID");
    vmTableModel.addColumn("Application");
    try {
        VirtualMachineService vmService = VirtualMachineService.getInstance();
        for (VirtualMachineData vmData : vmService.getVirtualMachines()) {
            vmTableModel.addRow(new Object[] { vmData.getId(), vmData.getDescription() });
        }
    } catch (VirtualMachineServiceException e) {
        Main.getInstance().processException(e);
    }
    JTable vmTable = new JTable(vmTableModel);
    return vmTable;
}
Example 94
Project: metingear-master  File: SelectionTable.java View source code
public void setSheet(int index) {
    String[][] data = helper.getSheetData(index);
    super.setModel(new DefaultTableModel(data, ExcelUtilities.buildHeaders(0, data[0].length)));
    end = super.getRowCount();
    for (int i = 0; i < getColumnCount(); i++) {
        this.getColumnModel().getColumn(index).setWidth(80);
    }
}
Example 95
Project: mitobo-master  File: MTBTableModelDataIOXmlbeans.java View source code
@Override
public ALDXMLObjectType writeData(Object obj) throws ALDDataIOManagerException, ALDDataIOProviderException {
    if (!(obj instanceof DefaultTableModel)) {
        throw new ALDDataIOProviderException(ALDDataIOProviderExceptionType.OBJECT_TYPE_ERROR, "MTBTabelModelDataIO::writeData object to write is of wrong type <" + obj.getClass().getCanonicalName() + ">");
    }
    ALDXMLAnyType aldXmlObject = ALDXMLAnyType.Factory.newInstance();
    aldXmlObject.setClassName(obj.getClass().getName());
    aldXmlObject.setValue(null);
    return aldXmlObject;
}
Example 96
Project: music-tagger-master  File: Menu.java View source code
public void actionPerformed(ActionEvent e) {
    //TODO: delete tag here
    int[] selecetdRows;
    selecetdRows = Table_Panel.table.getSelectedRows();
    int selecetdRowsCount = Table_Panel.table.getSelectedRowCount();
    DefaultTableModel model = (DefaultTableModel) Table_Panel.table.getModel();
    for (int i = selecetdRowsCount - 1; i >= 0; i--) {
        model.removeRow(selecetdRows[i]);
        Main_Frame.filevector.removeElementAt(selecetdRows[i]);
    }
//				System.out.println("delete");
}
Example 97
Project: nbites-master  File: CameraOffsetsPanel.java View source code
/**
     * 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")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
void initComponents() {
    Options = new javax.swing.JPanel();
    sentToRobotButton = new javax.swing.JButton();
    saveToConfigButton = new javax.swing.JButton();
    jScrollPane1 = new javax.swing.JScrollPane();
    displayTable = new javax.swing.JTable();
    goButton = new javax.swing.JButton();
    Options.setBackground(new java.awt.Color(242, 242, 242));
    // NOI18N
    Options.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 2, true), "camera offset calibration", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("PT Serif", 1, 14)));
    sentToRobotButton.setText("Send to robot");
    saveToConfigButton.setText("save to config file");
    displayTable.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {}, new String[] { "robot", "camera", "status", "d-roll", "d-tilt", "given", "used" }) {

        boolean[] canEdit = new boolean[] { false, false, false, false, false, false, false };

        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit[columnIndex];
        }
    });
    displayTable.setFocusable(false);
    displayTable.setShowGrid(false);
    jScrollPane1.setViewportView(displayTable);
    goButton.setText("go!");
    javax.swing.GroupLayout OptionsLayout = new javax.swing.GroupLayout(Options);
    Options.setLayout(OptionsLayout);
    OptionsLayout.setHorizontalGroup(OptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, OptionsLayout.createSequentialGroup().addContainerGap().addGroup(OptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 487, Short.MAX_VALUE).addGroup(OptionsLayout.createSequentialGroup().addComponent(goButton).addGap(1, 1, 1).addComponent(sentToRobotButton).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(saveToConfigButton).addGap(0, 0, Short.MAX_VALUE))).addContainerGap()));
    OptionsLayout.setVerticalGroup(OptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(OptionsLayout.createSequentialGroup().addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 350, Short.MAX_VALUE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(OptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(saveToConfigButton).addComponent(sentToRobotButton).addComponent(goButton)).addContainerGap()));
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addContainerGap().addComponent(Options, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(Options, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addContainerGap()));
}
Example 98
Project: openjdk-master  File: bug4473075.java View source code
public void run() {
    frame = new JFrame();
    frame.setUndecorated(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    table = new JTable();
    String t = "a cell text";
    table.setModel(new DefaultTableModel(new Object[][] { new Object[] { t, t, t, t, t } }, new Object[] { t, t, t, t, t }));
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    scpScroll = new JScrollPane(table);
    // Manually set preferred size of header...
    Dimension preferredSize = new Dimension(table.getSize().width, USER_HEADER_HEIGHT);
    table.getTableHeader().setPreferredSize(preferredSize);
    frame.setContentPane(scpScroll);
    frame.setSize(250, 480);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    point = scpScroll.getHorizontalScrollBar().getLocationOnScreen();
}
Example 99
Project: openmicroscopy-master  File: FileTableRendererFileColumn.java View source code
/**
     * Overridden to set the correct renderer.
     * @see DefaultTableCellRenderer#getTableCellRendererComponent(JTable,
     * Object, boolean, boolean, int, int)
     */
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    final DefaultTableModel dtm = (DefaultTableModel) table.getModel();
    final FileElement element = (FileElement) dtm.getValueAt(row, column);
    if (element.isDirectory())
        setIcon(DIRECTORY_ICON);
    else
        setIcon(FILE_ICON);
    setText(element.toString());
    return this;
}
Example 100
Project: Oyster-GUI-master  File: OysterTable.java View source code
//	@Override
//	public TableCellEditor getCellEditor(int row, int column) {
//	   Object value = super.getValueAt(row, column);
//	   if(value != null) {
//	      if(value instanceof JComboBox) {
//	           return (TableCellEditor) new ComboBoxEditor().getTableCellEditorComponent(this, value, true, row, column);
//	      }
//	            return getDefaultEditor(value.getClass());
//	   }
//	   return super.getCellEditor(row, column);
//	}
public void ClearSelectedRow() {
    DefaultTableModel dftm = (DefaultTableModel) this.getModel();
    if (this.getSelectedRowCount() < 2) {
        if (this.getSelectedRow() > -1) {
            dftm.removeRow(this.getSelectedRow());
        }
    } else if (this.getSelectedRowCount() > 1) {
        int[] rowsSelected = new int[this.getSelectedRowCount()];
        for (int i = 0; i < rowsSelected.length; i++) {
            dftm.removeRow(rowsSelected[i]);
        }
    }
}
Example 101
Project: pentaho-reporting-oem-sdk-master  File: PentahoEditableDrillDownFunctionTest.java View source code
@Override
protected void setUp() throws Exception {
    super.setUp();
    ClassicEngineBoot.getInstance().start();
    final ExpressionRuntime runtime = new GenericExpressionRuntime(new StaticDataRow(), new DefaultTableModel(), 0, new DefaultProcessingContext());
    reportFormulaContext = new ReportFormulaContext(new TestFormulaContext(TestFormulaContext.testCaseDataset), runtime);
}