use of javax.swing.table.TableColumnModel in project processdash by dtuma.
the class WBSColumnSelectorDialog method buildTreeModel.
/**
* Construct the TreeNode structure for the available columns
* @param availableTabs
* @return TreeNode
*/
private TreeNode buildTreeModel(Map availableTabs) {
DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Tabs");
for (Iterator iter = availableTabs.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry entry = (Map.Entry) iter.next();
DefaultMutableTreeNode tabNode = new DefaultMutableTreeNode(entry.getKey());
TableColumnModel tableColumnModel = (TableColumnModel) entry.getValue();
for (Enumeration e = tableColumnModel.getColumns(); e.hasMoreElements(); ) {
DefaultMutableTreeNode columnNode = new DefaultMutableTreeNode(e.nextElement());
tabNode.add(columnNode);
}
rootNode.add(tabNode);
}
return rootNode;
}
use of javax.swing.table.TableColumnModel in project processdash by dtuma.
the class WBSTabPanel method getTabData.
public LinkedHashMap<String, TableColumnModel> getTabData() {
LinkedHashMap<String, TableColumnModel> result = new LinkedHashMap<String, TableColumnModel>();
for (int i = 0; i < tabbedPane.getTabCount() - 1; i++) {
String tabName = tabbedPane.getTitleAt(i);
String key = tabName;
int j = 0;
while (result.containsKey(key)) {
key = tabName + " (" + (++j) + ")";
}
TableColumnModel colModel = (TableColumnModel) tableColumnModels.get(i);
result.put(key, colModel);
}
return result;
}
use of javax.swing.table.TableColumnModel in project processdash by dtuma.
the class WBSTabPanel method copyColumnsDeep.
private TableColumnModel copyColumnsDeep(TableColumnModel tableColumnModel) {
TableColumnModel newTableColumnModel = new DefaultTableColumnModel();
for (Enumeration columns = tableColumnModel.getColumns(); columns.hasMoreElements(); ) {
DataTableColumn existingColumn = (DataTableColumn) columns.nextElement();
newTableColumnModel.addColumn(new DataTableColumn(existingColumn));
}
return newTableColumnModel;
}
use of javax.swing.table.TableColumnModel in project processdash by dtuma.
the class SaveAsExcelAction method writeData.
private void writeData(File f) {
DataJTable dataTable = getDataJTable();
WBSTabPanel tabPanel = getWBSTabPanel();
WBSExcelWriter writer = new WBSExcelWriter(dataTable);
LinkedHashMap<String, TableColumnModel> tabs = tabPanel.getTabData();
for (Map.Entry<String, TableColumnModel> e : tabs.entrySet()) {
writer.addData(e.getKey(), e.getValue());
}
try {
writer.save(f);
} catch (IOException ioe) {
Object message = resources.formatStrings("Error.Message_FMT", f.getAbsolutePath());
JOptionPane.showMessageDialog(tabPanel, message, resources.getString("Error.Title"), JOptionPane.ERROR_MESSAGE);
}
}
use of javax.swing.table.TableColumnModel in project processdash by dtuma.
the class QuickLauncher method buildUI.
private void buildUI() throws Exception {
String windowTitle;
String versionNumber = getVersionNumber();
if (versionNumber == null)
windowTitle = resources.getString("Window_Title");
else
windowTitle = resources.format("Window_Title2_FMT", versionNumber);
frame = new JFrame(windowTitle);
DashboardIconFactory.setLauncherWindowIcon(frame);
JPanel contents = new JPanel();
contents.setLayout(new BoxLayout(contents, BoxLayout.Y_AXIS));
launcherFactory = new InstanceLauncherFactory();
DropTransferHandler th = new DropTransferHandler(this, launcherFactory);
contents.setTransferHandler(th);
contents.add(new JLabel(resources.getString("Window_Prompt")));
contents.add(new OptionCheckbox("Read_Only", "-DreadOnly=true\n" + "-Dteamdash.wbs.readOnly=true", null, processFactory, false));
contents.add(new OptionCheckbox("Disable_Export", "-D" + Settings.SYS_PROP_PREFIX + "export.disableAutoExport=true\n" + "-D" + Settings.SYS_PROP_PREFIX + "backup.extraDirectories=", null, processFactory, true));
contents.add(new OptionCheckbox("Use_External_Templates", null, "-D" + Settings.SYS_PROP_PREFIX + "templates.disableSearchPath=true", processFactory, false));
JTable table = new JTable(instanceList);
TableColumnModel cols = table.getColumnModel();
for (int i = 0; i < InstanceList.COLUMN_WIDTHS.length; i++) {
int width = InstanceList.COLUMN_WIDTHS[i];
cols.getColumn(i).setPreferredWidth(width);
}
table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.setTransferHandler(th);
table.setPreferredScrollableViewportSize(new Dimension(380, 100));
JScrollPane scrollPane = new JScrollPane(table);
scrollPane.setBackground(Color.WHITE);
contents.add(scrollPane);
actionHandler = new InstanceActionHandler(table, instanceList);
instanceList.addTableModelListener((TableModelListener) EventHandler.create(TableModelListener.class, this, "updateCursor"));
frame.getContentPane().add(contents);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
Aggregations