/** * Returns the icon for the specified URL. * * @param image * Image. * @param initialDim * Initial dimension of the icon. * @return Icon instance. */ public static ImageWrapperResizableIcon getIcon(Image image, Dimension initialDim) { return new ImageWrapperResizableIcon(image, initialDim); }
@Override public void setDimension(Dimension dim) { this.setPreferredSize(dim); } }
@Override public JPopupPanel getPopupPanel(JCommandButton jcb) { JCommandPopupMenu popup = new JCommandPopupMenu(); JCommandMenuButton button; for (final Column column : availableColumns) { button = new JCommandMenuButton(column.getTitle(), ImageWrapperResizableIcon.getIcon(ImageUtilities.loadImage("org/gephi/desktop/datalab/resources/column.png"), new Dimension(16, 16))); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { DataLaboratoryHelper.getDefault().executeAttributeColumnsManipulator(acm, graphModel, table, column); } }); popup.addMenuButton(button); } return popup; } });
private void createExportCommandButton() { exportCommandButton = new JCommandButton(StaticWidgetHelper.getSynaptixWidgetConstantsBundle().exportEllipsis(), ImageWrapperResizableIcon.getIcon(IconHelper.Icons.EXPORT_EXCEL.getFileURL(), new Dimension(16, 16))); exportCommandButton.setCommandButtonKind(CommandButtonKind.ACTION_ONLY); exportCommandButton.setDisplayState(CommandButtonDisplayState.MEDIUM); exportCommandButton.addActionListener(new ExportAction()); exportCommandButton.setEnabled(false); }
/** * Create the special merge columns button. */ private void prepareMergeColumnsButton() { JCommandButtonStrip strip = new JCommandButtonStrip(JCommandButtonStrip.StripOrientation.HORIZONTAL); strip.setDisplayState(CommandButtonDisplayState.BIG); JCommandButton button = new JCommandButton(NbBundle.getMessage(DataTableTopComponent.class, "DataTableTopComponent.mergeColumnsButton.text"), ImageWrapperResizableIcon.getIcon(ImageUtilities.loadImage("org/gephi/desktop/datalab/resources/merge.png", true), new Dimension(16, 16))); button.setCommandButtonKind(JCommandButton.CommandButtonKind.ACTION_ONLY); button.setDisplayState(CommandButtonDisplayState.BIG); if (isShowingNodesTable()) { button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showMergeColumnsUI(MergeColumnsUI.Mode.NODES_TABLE); } }); } else { button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showMergeColumnsUI(MergeColumnsUI.Mode.EDGES_TABLE); } }); } strip.add(button); columnManipulatorsPanel.add(strip); }
/** * Returns the icon for the specified input stream. * * @param inputStream * Icon input stream. * @param initialDim * Initial dimension of the icon. * @return Icon instance. */ public static ImageWrapperResizableIcon getIcon(InputStream inputStream, Dimension initialDim) { return new ImageWrapperResizableIcon(inputStream, initialDim); }
/** * Create the special Add new column button. */ private void prepareAddColumnButton() { JCommandButtonStrip strip = new JCommandButtonStrip(JCommandButtonStrip.StripOrientation.HORIZONTAL); strip.setDisplayState(CommandButtonDisplayState.BIG); JCommandButton button = new JCommandButton(NbBundle.getMessage(DataTableTopComponent.class, "DataTableTopComponent.addColumnButton.text"), ImageWrapperResizableIcon.getIcon(ImageUtilities.loadImage("org/gephi/desktop/datalab/resources/table-insert-column.png", true), new Dimension(16, 16))); button.setCommandButtonKind(JCommandButton.CommandButtonKind.ACTION_ONLY); button.setDisplayState(CommandButtonDisplayState.BIG); if (isShowingNodesTable()) { button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showAddColumnUI(AddColumnUI.Mode.NODES_TABLE); } }); } else { button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showAddColumnUI(AddColumnUI.Mode.EDGES_TABLE); } }); } strip.add(button); columnManipulatorsPanel.add(strip); }
/** * Returns the icon for the specified URL. * * @param location * Icon URL. * @param initialDim * Initial dimension of the icon. * @return Icon instance. */ public static ImageWrapperResizableIcon getIcon(URL location, Dimension initialDim) { try { return new ImageWrapperResizableIcon(location.openStream(), initialDim); } catch (IOException ioe) { ioe.printStackTrace(); return null; } }
JCommandButton pluginsButton = new JCommandButton(NbBundle.getMessage(DataTableTopComponent.class, "DataTableTopComponent.general.actions.plugins.button.text"), ImageWrapperResizableIcon.getIcon(ImageUtilities.loadImage("org/gephi/desktop/datalab/resources/puzzle--arrow.png", true), new Dimension(16, 16))); pluginsButton.setDisplayState(CommandButtonDisplayState.MEDIUM); pluginsButton.setCommandButtonKind(JCommandButton.CommandButtonKind.POPUP_ONLY);
/** * Prepare a button for the popup panel for plugin general actions. * * @param m PluginGeneralActionsManipulator for the button * @return JCommandButton for the manipulator */ private JCommandButton preparePluginGeneralActionsButton(final PluginGeneralActionsManipulator m) { JCommandButton button = new JCommandButton(m.getName(), m.getIcon() != null ? ImageWrapperResizableIcon.getIcon(ImageUtilities.icon2Image(m.getIcon()), new Dimension(16, 16)) : null);//Convert icon to Image if it is not null button.setDisplayState(CommandButtonDisplayState.BIG); button.setCommandButtonKind(JCommandButton.CommandButtonKind.ACTION_ONLY); if (m.getDescription() != null && !m.getDescription().isEmpty()) { button.setPopupRichTooltip(new RichTooltip(NbBundle.getMessage(DataTableTopComponent.class, "DataTableTopComponent.RichToolTip.title.text"), m.getDescription())); } if (m.canExecute()) { button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { DataLaboratoryHelper.getDefault().executeManipulator(m); } }); } else { button.setEnabled(false); } return button; }
JCommandButton manipulatorButton; if (acm.getIcon() != null) { manipulatorButton = new JCommandButton(acm.getName(), ImageWrapperResizableIcon.getIcon(acm.getIcon(), new Dimension(16, 16))); } else { manipulatorButton = new JCommandButton(acm.getName());
table.setShowTableLines(true); configureButton = new JCommandButton(ImageWrapperResizableIcon.getIcon(DefaultTablePageComponentsPanel.class.getResource("configure.png"), new Dimension(18, 18))); configureButton.setCommandButtonKind(CommandButtonKind.POPUP_ONLY); configureButton.setDisplayState(CommandButtonDisplayState.MEDIUM); exportCommandButton = new JCommandButton(StaticWidgetHelper.getSynaptixWidgetConstantsBundle().exportEllipsis(), ImageWrapperResizableIcon.getIcon(IconHelper.Icons.EXPORT_EXCEL.getFileURL(), new Dimension(16, 16))); exportCommandButton.addActionListener(new ActionListener() {