private void createUIComponents() { UpdaterTreeNode.Renderer renderer = new SummaryTreeNode.Renderer(); myPlatformLoadingIcon = new AsyncProcessIcon("Loading..."); myPlatformSummaryRootNode = new RootNode(); myPlatformDetailsRootNode = new RootNode(); ColumnInfo[] platformSummaryColumns = new ColumnInfo[]{new DownloadStatusColumnInfo(), new TreeColumnInfo("Name"), new ApiLevelColumnInfo(), new RevisionColumnInfo(), new StatusColumnInfo()}; myPlatformSummaryTable = new TreeTableView(new ListTreeTableModelOnColumns(myPlatformSummaryRootNode, platformSummaryColumns)); SdkUpdaterConfigPanel.setTreeTableProperties(myPlatformSummaryTable, renderer); MouseListener modificationListener = new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { refreshModified(); } }; myPlatformSummaryTable.addMouseListener(modificationListener); ColumnInfo[] platformDetailColumns = new ColumnInfo[]{new DownloadStatusColumnInfo(), new TreeColumnInfo("Name"), new ApiLevelColumnInfo(), new RevisionColumnInfo(), new StatusColumnInfo()}; myPlatformDetailTable = new TreeTableView(new ListTreeTableModelOnColumns(myPlatformDetailsRootNode, platformDetailColumns)); SdkUpdaterConfigPanel.setTreeTableProperties(myPlatformDetailTable, renderer); myPlatformDetailTable.addMouseListener(modificationListener); }
private void createUIComponents() { myToolsLoadingIcon = new AsyncProcessIcon("Loading..."); myToolsSummaryRootNode = new RootNode(); myToolsDetailsRootNode = new RootNode(); UpdaterTreeNode.Renderer renderer = new SummaryTreeNode.Renderer(); ColumnInfo[] toolsSummaryColumns = new ColumnInfo[]{new DownloadStatusColumnInfo(), new TreeColumnInfo("Name"), new VersionColumnInfo(), new StatusColumnInfo()}; myToolsSummaryTable = new TreeTableView(new ListTreeTableModelOnColumns(myToolsSummaryRootNode, toolsSummaryColumns)); SdkUpdaterConfigPanel.setTreeTableProperties(myToolsSummaryTable, renderer); ColumnInfo[] toolsDetailColumns = new ColumnInfo[]{new DownloadStatusColumnInfo(), new TreeColumnInfo("Name"), new VersionColumnInfo(), new StatusColumnInfo()}; myToolsDetailTable = new TreeTableView(new ListTreeTableModelOnColumns(myToolsDetailsRootNode, toolsDetailColumns)); SdkUpdaterConfigPanel.setTreeTableProperties(myToolsDetailTable, renderer); MouseListener modificationListener = new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { refreshModified(); } }; myToolsDetailTable.addMouseListener(modificationListener); myToolsSummaryTable.addMouseListener(modificationListener); }
private static <T> TreeTableModel createModel(final Collection<? extends TreeTableColumn<T>> columns, final ContentProvider<T> contentProvider) { final Collection<ColumnInfo> columnsInfos = new ArrayList<ColumnInfo>(columns.size()); boolean first = true; for (final TreeTableColumn<T> column : columns) { if (first) { columnsInfos.add(new TreeColumnInfo(column.getCaption())); } else { columnsInfos.add(new ColumnInfo(column.getCaption()) { public Object valueOf(final Object o) { return o; } public Class getColumnClass() { return TableColumnMarker.class; } }); } first = false; } final DefaultMutableTreeNode root; final Collection<? extends T> rootObjects = contentProvider.getRoots(); if (!rootObjects.isEmpty()) { if (rootObjects.size() == 1) { root = new DefaultMutableTreeNode(rootObjects.iterator().next()); addChildren(root, contentProvider); } else { root = new DefaultMutableTreeNode(HIDDEN_ROOT); for (final T rootObject : rootObjects) { final DefaultMutableTreeNode subRoot = new DefaultMutableTreeNode(rootObject); addChildren(subRoot, contentProvider); root.add(subRoot); } } } else { root = null; } return new ListTreeTableModelOnColumns(root, columnsInfos.toArray(new ColumnInfo[columnsInfos.size()])); }