List of usage examples for javax.swing.table DefaultTableModel DefaultTableModel
public DefaultTableModel()
DefaultTableModel
which is a table of zero columns and zero rows. From source file:org.martin.ftp.gui.GUIClient.java
private void closeSession() throws IOException { tblFiles.setModel(new DefaultTableModel()); txtNewDir.setText(null);/* w w w . j a v a 2s. c o m*/ linker.closeConnection(); linker = null; formManagement.setVisible(false); setVisible(true); txtServer.requestFocus(); tblSearch.setModel(new TMSearch(new LinkedList<>())); }
From source file:org.omegat.gui.issues.IssuesPanelController.java
void reset() { if (loader != null) { loader.cancel(true);// w w w. j a v a 2 s. co m loader = null; } frame.setTitle(OStrings.getString("ISSUES_WINDOW_TITLE")); panel.table.setModel(new DefaultTableModel()); panel.typeList.setModel(new DefaultListModel<>()); panel.outerSplitPane.setBottomComponent(panel.messageLabel); panel.messageLabel.setText(OStrings.getString("ISSUES_LOADING")); StaticUIUtils.setHierarchyEnabled(panel, false); panel.closeButton.setEnabled(true); panel.showAllButtonPanel.setVisible(!isShowingAllFiles()); panel.instructionsPanel.setVisible(!instructions.equals(NO_INSTRUCTIONS)); panel.instructionsTextArea.setText(instructions); }
From source file:org.ops4j.pax.idea.runner.forms.OsgiConfigEditorForm.java
public OsgiConfigEditorForm(final ConfigBean config) { String[] columnNames = { "Property", "Value" }; DefaultTableModel tableModel = new DefaultTableModel(); tableModel.setColumnIdentifiers(columnNames); m_bundleProperties.setModel(tableModel); m_bundleProperties.setShowGrid(true); m_bundleProperties.setEnabled(false); config.addBundleObserver(this); m_bundleModel = new DefaultListModel(); m_bundles.setModel(m_bundleModel);//from w ww .ja v a2 s .com }
From source file:org.ops4j.pax.idea.runner.forms.OsgiConfigEditorForm.java
private void updateSystemPropertiesTable(ConfigBean data) { String[] columnNames = { "Property", "Value" }; DefaultTableModel tableModel2 = new DefaultTableModel(); tableModel2.setColumnIdentifiers(columnNames); Set<Map.Entry<String, String>> entries = data.getSystemProperties().entrySet(); for (Map.Entry<String, String> entry : entries) { String key = entry.getKey(); String value = entry.getValue(); tableModel2.addRow(new String[] { key, value }); }//from w w w.j a v a 2s .c om m_systemProperties.setModel(tableModel2); m_systemProperties.setEnabled(true); }
From source file:org.ow2.aspirerfid.demos.warehouse.management.UI.WarehouseManagement.java
/** * Initialize the contents of the frame/*from w w w .j a v a 2s . c om*/ */ private void initialize() { final JTabbedPane tabbedPane; final JPanel deliveryPanel; final JLabel entryDateLabel; final JLabel entryDateLabel_1; final JLabel entryDateLabel_2; final JLabel entryDateLabel_3; final JLabel entryDateLabel_3_1; final JLabel entryDateLabel_3_2; final JPanel shipmentPanel; final JLabel entryDateLabel_3_1_1; final JLabel entryDateLabel_3_1_2; final JScrollPane scrollPane; final JButton printReportButton; final JButton saveReportButton; final JButton activateDoorButton; final JButton deactivateDoorButton; final JButton clearReportButton; final JPanel panel; final JLabel entryDateLabel_3_3; final JLabel entryDateLabel_2_1; frame = new JFrame(); frame.getContentPane().setLayout(new BorderLayout()); frame.setTitle("Warehouse Management"); frame.setBounds(100, 100, 1011, 625); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); tabbedPane = new JTabbedPane(); frame.getContentPane().add(tabbedPane); deliveryPanel = new JPanel(); deliveryPanel.setLayout(null); tabbedPane.addTab("Delivery Counter", null, deliveryPanel, null); entryDateLabel = new JLabel(); entryDateLabel.setText("Entry Date ........."); entryDateLabel.setBounds(533, 23, 117, 16); deliveryPanel.add(entryDateLabel); entryDateLabel_1 = new JLabel(); entryDateLabel_1.setText("User ID ................"); entryDateLabel_1.setBounds(10, 94, 117, 16); deliveryPanel.add(entryDateLabel_1); entryDateLabel_2 = new JLabel(); entryDateLabel_2.setText("Invoice ID ............"); entryDateLabel_2.setBounds(10, 23, 117, 16); deliveryPanel.add(entryDateLabel_2); entryDateLabel_3 = new JLabel(); entryDateLabel_3.setText("Warehouse ID...."); entryDateLabel_3.setBounds(10, 45, 117, 16); deliveryPanel.add(entryDateLabel_3); entryDateLabel_3_1 = new JLabel(); entryDateLabel_3_1.setText("Zone ID ................"); entryDateLabel_3_1.setBounds(10, 67, 117, 16); deliveryPanel.add(entryDateLabel_3_1); entryDateLabel_3_2 = new JLabel(); entryDateLabel_3_2.setText("Entry Hour ........."); entryDateLabel_3_2.setBounds(533, 45, 117, 16); deliveryPanel.add(entryDateLabel_3_2); entryDateLabel_3_1_1 = new JLabel(); entryDateLabel_3_1_1.setText("Offering Date ...."); entryDateLabel_3_1_1.setBounds(533, 70, 117, 16); deliveryPanel.add(entryDateLabel_3_1_1); entryDateLabel_3_1_2 = new JLabel(); entryDateLabel_3_1_2.setText("Offering Hour ...."); entryDateLabel_3_1_2.setBounds(533, 94, 117, 16); deliveryPanel.add(entryDateLabel_3_1_2); invoiceIDTextField = new JTextField(); invoiceIDTextField.setBounds(105, 19, 365, 20); deliveryPanel.add(invoiceIDTextField); warehouseIDTextField = new JTextField(); warehouseIDTextField.setBounds(105, 43, 365, 20); deliveryPanel.add(warehouseIDTextField); zoneIDTextField = new JTextField(); zoneIDTextField.setBounds(105, 66, 365, 20); deliveryPanel.add(zoneIDTextField); userIDTextField = new JTextField(); userIDTextField.setBounds(105, 90, 365, 20); deliveryPanel.add(userIDTextField); entryDateTextField = new JTextField(); entryDateTextField.setBounds(623, 19, 365, 20); deliveryPanel.add(entryDateTextField); entryHourTextField = new JTextField(); entryHourTextField.setBounds(623, 41, 365, 20); deliveryPanel.add(entryHourTextField); offeringDateTextField = new JTextField(); offeringDateTextField.setBounds(623, 66, 365, 20); deliveryPanel.add(offeringDateTextField); offeringHourTextField = new JTextField(); offeringHourTextField.setBounds(623, 90, 365, 20); deliveryPanel.add(offeringHourTextField); scrollPane = new JScrollPane(); scrollPane.setBounds(10, 129, 978, 355); deliveryPanel.add(scrollPane); deliveryTableModel = new DefaultTableModel();// All Clients Items deliveryTableModel.addColumn("Company"); deliveryTableModel.addColumn("Item Code"); deliveryTableModel.addColumn("Description"); deliveryTableModel.addColumn("Quantity Delivered"); deliveryTableModel.addColumn("Expected Quantity"); deliveryTableModel.addColumn("Quantity Remain"); deliveryTableModel.addColumn("Delivery Date"); deliveryTableModel.addColumn("Measurement ID"); deliveryTableModel.addColumn("Quantity"); deliveryTable = new JTable(deliveryTableModel); deliveryTable.setFont(new Font("Arial Narrow", Font.PLAIN, 10)); deliveryTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); scrollPane.setViewportView(deliveryTable); ListSelectionModel rowSM = deliveryTable.getSelectionModel(); printReportButton = new JButton(); printReportButton.setText("Print Report"); printReportButton.setBounds(860, 520, 117, 26); deliveryPanel.add(printReportButton); saveReportButton = new JButton(); saveReportButton.setText("Save Report"); saveReportButton.setBounds(614, 520, 117, 26); deliveryPanel.add(saveReportButton); activateDoorButton = new JButton(); activateDoorButton.addMouseListener(new ActivateDoorButtonMouseListener()); activateDoorButton.setText("Activate Door"); activateDoorButton.setBounds(50, 520, 117, 26); deliveryPanel.add(activateDoorButton); deactivateDoorButton = new JButton(); deactivateDoorButton.addMouseListener(new DeactivateDoorButtonMouseListener()); deactivateDoorButton.setText("Dectivate Door"); deactivateDoorButton.setBounds(173, 520, 117, 26); deliveryPanel.add(deactivateDoorButton); clearReportButton = new JButton(); clearReportButton.addMouseListener(new ClearReportButtonMouseListener()); clearReportButton.setText("Clear Report"); clearReportButton.setBounds(737, 520, 117, 26); deliveryPanel.add(clearReportButton); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { // Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (lsm.isSelectionEmpty()) { // no rows are selected } else { selectedRow = lsm.getMinSelectionIndex(); System.out.println("selectedRow = " + selectedRow); } } }); shipmentPanel = new JPanel(); tabbedPane.addTab("Shipment", null, shipmentPanel, null); panel = new JPanel(); panel.setLayout(null); tabbedPane.addTab("Door Config", null, panel, null); aleListeningPortTextField = new JTextField(); aleListeningPortTextField.setText("9999"); aleListeningPortTextField.setBounds(172, 41, 330, 20); panel.add(aleListeningPortTextField); epcisRepositoryURLTextField = new JTextField(); epcisRepositoryURLTextField.setText("http://localhost:8080/aspire0.3.0EpcisRepository/capture"); epcisRepositoryURLTextField.setBounds(172, 65, 330, 20); panel.add(epcisRepositoryURLTextField); entryDateLabel_3_3 = new JLabel(); entryDateLabel_3_3.setText("EPCIS Rep. URL ........."); entryDateLabel_3_3.setBounds(51, 67, 117, 16); panel.add(entryDateLabel_3_3); entryDateLabel_2_1 = new JLabel(); entryDateLabel_2_1.setText("ALE Listening Port ...."); entryDateLabel_2_1.setBounds(51, 43, 117, 16); panel.add(entryDateLabel_2_1); }
From source file:org.ow2.aspirerfid.demos.warehouse.management.UI.WMS.java
/** * Initialize the contents of the frame/*from ww w . j av a 2 s. c o m*/ */ private void initialize() { final JLabel entryDateLabel_2; final JLabel entryDateLabel_3_1_1; final JScrollPane scrollPane; final JButton printReportButton; final JButton saveReportButton; final JButton clearReportButton; frame = new JFrame(); frame.setResizable(false); frame.addWindowListener(new FrameWindowListener()); frame.getContentPane().setLayout(new BorderLayout()); frame.setTitle("Warehouse Management"); frame.setBounds(100, 100, 757, 625); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); tabbedPane = new JTabbedPane(); frame.getContentPane().add(tabbedPane); deliveryTableModel = new DefaultTableModel();// All Clients Items deliveryTableModel.addColumn("Company"); deliveryTableModel.addColumn("Item Code"); deliveryTableModel.addColumn("Description"); deliveryTableModel.addColumn("Quantity Delivered"); deliveryTableModel.addColumn("Expected Quantity"); deliveryTableModel.addColumn("Quantity Remain"); deliveryTableModel.addColumn("Delivery Date"); deliveryTableModel.addColumn("Measurement ID"); deliveryInfoModel = new DefaultTableModel();// All Clients Items deliveryInfoModel.addColumn("Company"); deliveryInfoModel.addColumn("Item Code"); deliveryInfoModel.addColumn("Description"); deliveryInfoModel.addColumn("Expected Quantity"); deliveryInfoModel.addColumn("Measurement ID"); shipmentPanel = new JPanel(); shipmentPanel.setLayout(null); tabbedPane.addTab("Shipment", null, shipmentPanel, null); submitShipmentButton = new JButton(); submitShipmentButton.addActionListener(new SubmitShipmentButtonActionListener()); submitShipmentButton.setText("Submit"); submitShipmentButton.setBounds(275, 89, 112, 25); shipmentPanel.add(submitShipmentButton); final JLabel selectAvaiableInvoiceLabel = new JLabel(); selectAvaiableInvoiceLabel.setText("Select avaiable invoice to track"); selectAvaiableInvoiceLabel.setBounds(58, 26, 195, 15); shipmentPanel.add(selectAvaiableInvoiceLabel); shipmentsCb = new JComboBox(); shipmentsCb.setModel(new DefaultComboBoxModel(new String[] {})); shipmentsCb.setSelectedItem(null); shipmentsCb.addActionListener(new ShipmentsCbActionListener()); shipmentsCb.setBounds(269, 21, 382, 24); shipmentPanel.add(shipmentsCb); final JPanel panel = new JPanel(); panel.setLayout(null); panel.setBorder(new TitledBorder(null, "Shipment information", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); panel.setBounds(10, 170, 722, 327); shipmentPanel.add(panel); final JScrollPane scrollPane_1 = new JScrollPane(); scrollPane_1.setBounds(10, 27, 702, 300); panel.add(scrollPane_1); deliveryInfo = new JTable(deliveryInfoModel); deliveryInfo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); scrollPane_1.setViewportView(deliveryInfo); deliveryPanel = new JPanel(); deliveryPanel.setLayout(null); tabbedPane.addTab("Delivery Counter", null, deliveryPanel, null); entryDateLabel_2 = new JLabel(); entryDateLabel_2.setText("Invoice ID "); entryDateLabel_2.setBounds(10, 23, 117, 16); deliveryPanel.add(entryDateLabel_2); entryDateLabel_3_1_1 = new JLabel(); entryDateLabel_3_1_1.setText("Offering Date"); entryDateLabel_3_1_1.setBounds(391, 25, 117, 16); deliveryPanel.add(entryDateLabel_3_1_1); invoiceIDTextField = new JTextField(); invoiceIDTextField.setEditable(false); invoiceIDTextField.setBounds(105, 21, 270, 20); deliveryPanel.add(invoiceIDTextField); offeringDateTextField = new JTextField(); offeringDateTextField.setEditable(false); offeringDateTextField.setBounds(511, 23, 230, 20); deliveryPanel.add(offeringDateTextField); scrollPane = new JScrollPane(); scrollPane.setBounds(10, 81, 731, 403); deliveryPanel.add(scrollPane); deliveryTable = new JTable(deliveryTableModel); deliveryTable.setFont(new Font("Arial Narrow", Font.PLAIN, 10)); deliveryTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); scrollPane.setViewportView(deliveryTable); printReportButton = new JButton(); printReportButton.setText("Print Report"); printReportButton.setBounds(459, 520, 117, 26); deliveryPanel.add(printReportButton); saveReportButton = new JButton(); saveReportButton.setText("Save Report"); saveReportButton.setBounds(213, 520, 117, 26); deliveryPanel.add(saveReportButton); clearReportButton = new JButton(); clearReportButton.addMouseListener(new ClearReportButtonMouseListener()); clearReportButton.setText("Clear Report"); clearReportButton.setBounds(336, 520, 117, 26); deliveryPanel.add(clearReportButton); }
From source file:org.pentaho.reporting.designer.core.util.FormulaEditorPanel.java
public void setFormula(final String text) { if (text == null) { formulaField.setText(null);//w ww .j av a 2s . c om formulaBox.setSelectedItem(null); return; } if (isFormulaFragment()) { final GenericExpressionRuntime expressionRuntime = new GenericExpressionRuntime(new StaticDataRow(), new DefaultTableModel(), -1, new DefaultProcessingContext()); final String formulaText = FormulaUtil.createEditorTextFromFormula(text, new ReportFormulaContext(new DefaultFormulaContext(), expressionRuntime)); formulaField.setText(formulaText); formulaBox.setSelectedItem(formulaText); } else { formulaField.setText(text); formulaBox.setSelectedItem(text); } }
From source file:org.pentaho.reporting.engine.classic.core.designtime.DesignTimeDataSchemaModel.java
protected DataSchema buildDataSchema() throws ReportDataFactoryException { this.dataFactoryException = null; AbstractReportDefinition parent = getReport(); final ParameterDataRow parameterRow = computeParameterData(); final ParameterDefinitionEntry[] parameterDefinitions = computeParameterDefinitionEntries(); final Expression[] expressions = parent.getExpressions().getExpressions(); final DataSchemaCompiler dataSchemaCompiler = new DataSchemaCompiler(getDataSchemaDefinition(), getDataAttributeContext(), getMasterReportElement().getResourceManager()); try {//from ww w .j ava 2 s . c om final CachingDataFactory dataFactory = new CachingDataFactory( new SortingDataFactory(createDataFactory(parent), new NoOpPerformanceMonitorContext()), true); final MasterReport masterReport = getMasterReportElement(); dataFactory.initialize(new DesignTimeDataFactoryContext(masterReport)); try { List<SortConstraint> sortConstraints = new SortOrderReportPreProcessor() .computeSortConstraints(parent); final TableModel reportData = queryReportData(parent.getQuery(), parent.getQueryTimeout(), dataFactory, sortConstraints); final DataSchema dataSchema = dataSchemaCompiler.compile(reportData, expressions, parameterRow, parameterDefinitions, masterReport.getReportEnvironment()); // this.columnNames = collectColumnNames(reportData, parameterRow, expressions); if (reportData instanceof CloseableTableModel) { final CloseableTableModel ctm = (CloseableTableModel) reportData; ctm.close(); } return dataSchema; } finally { dataFactory.close(); } } catch (final ReportProcessingException e) { final TableModel reportData = new DefaultTableModel(); final DataSchema dataSchema = dataSchemaCompiler.compile(reportData, expressions, parameterRow, parameterDefinitions, getMasterReportElement().getReportEnvironment()); this.dataFactoryException = e; return dataSchema; } }
From source file:org.pentaho.reporting.engine.classic.core.designtime.DesignTimeDataSchemaModel.java
private TableModel queryReportData(final String query, final int queryTimeout, final DataFactory dataFactory, final List<SortConstraint> sortConstraints) throws ReportDataFactoryException { if (offlineTableModel == null || changeTracker.isReportQueryChanged()) { TableModel reportData = null; try {/*from w ww .ja v a 2 s . c om*/ if (query == null) { reportData = new EmptyTableModel(); } else if (dataFactory instanceof DataFactoryDesignTimeSupport) { final DataFactoryDesignTimeSupport dts = (DataFactoryDesignTimeSupport) dataFactory; reportData = dts.queryDesignTimeStructure(query, new QueryDataRowWrapper(new StaticDataRow(), queryTimeout, 1, sortConstraints)); } else { reportData = dataFactory.queryData(query, new QueryDataRowWrapper(new StaticDataRow(), queryTimeout, 1, sortConstraints)); } offlineTableModel = new OfflineTableModel(reportData, new DefaultDataAttributeContext()); } finally { if (reportData instanceof CloseableTableModel) { final CloseableTableModel ctm = (CloseableTableModel) reportData; ctm.close(); } } } if (offlineTableModel == null) { return new IndexedTableModel(new DefaultTableModel()); } return offlineTableModel; }
From source file:org.pentaho.reporting.engine.classic.core.MasterReport.java
/** * The default constructor. Creates an empty but fully initialized report. *//* w w w .ja v a 2s . c o m*/ public MasterReport() { setElementType(new MasterReportType()); setResourceBundleFactory(new LibLoaderResourceBundleFactory()); this.reportConfiguration = new HierarchicalConfiguration(ClassicEngineBoot.getInstance().getGlobalConfig()); this.parameterValues = new ReportParameterValues(); setPageDefinition(null); final TableDataFactory dataFactory = new TableDataFactory(); dataFactory.addTable("default", new DefaultTableModel()); this.dataFactory = dataFactory; setQuery("default"); // Add a listener that will handle keeping the ResourceManager in sync with changes to the Document Bundle addReportModelListener(new DocumentBundleChangeHandler()); this.reportEnvironment = new DefaultReportEnvironment(getConfiguration()); this.parameterDefinition = new DefaultParameterDefinition(); final MemoryDocumentBundle documentBundle = new MemoryDocumentBundle(); documentBundle.getWriteableDocumentMetaData().setBundleType(ClassicEngineBoot.BUNDLE_TYPE); documentBundle.getWriteableDocumentMetaData().setBundleAttribute(ODFMetaAttributeNames.Meta.NAMESPACE, ODFMetaAttributeNames.Meta.CREATION_DATE, new Date()); setBundle(documentBundle); setContentBase(documentBundle.getBundleMainKey()); addReportModelListener(new ResourceBundleChangeHandler()); updateResourceBundleFactoryInternal(); }