private void copyTextDataToClipboard() { final Cursor oldCursor = getCursor(); try { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); final String dataAsText = getDataAsText(); if (dataAsText != null) { SystemUtils.copyToClipboard(dataAsText); } } finally { setCursor(oldCursor); } }
public ProductPlacemarkView(VectorDataNode vectorDataNode) { this.vectorDataNode = vectorDataNode; this.vectorDataNode.getProduct().addProductNodeListener(new PNL()); tableModel = new PlacemarkTableModel(); JTable placemarkTable = new JTable(); placemarkTable.setRowSorter(new TableRowSorter<>(tableModel)); placemarkTable.addMouseListener(new PopupMenuHandler(this)); placemarkTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); placemarkTable.setModel(tableModel); final TableCellRenderer renderer = placemarkTable.getTableHeader().getDefaultRenderer(); final int margin = placemarkTable.getTableHeader().getColumnModel().getColumnMargin(); Enumeration<TableColumn> columns = placemarkTable.getColumnModel().getColumns(); while (columns.hasMoreElements()) { TableColumn tableColumn = columns.nextElement(); final int width = getColumnMinWith(tableColumn, renderer, margin); tableColumn.setMinWidth(width); } final JScrollPane scrollPane = new JScrollPane(placemarkTable); setLayout(new BorderLayout()); add(scrollPane, BorderLayout.CENTER); }
private void onNodeChange(ProductNodeEvent event) { ProductNode sourceNode = event.getSourceNode(); if (sourceNode == vectorDataNode) { updateTable(); } else if (sourceNode.getOwner() == vectorDataNode.getPlacemarkGroup()) { updateTable(); } }
public PlacemarkViewTopComponent(VectorDataNode document) { super(document); updateDisplayName(); setName(getDisplayName()); placemarkView = new ProductPlacemarkView(document); setLayout(new BorderLayout()); add(placemarkView, BorderLayout.CENTER); }