use of javax.swing.JPopupMenu in project knime-core by knime.
the class AggregationColumnPanel method createTablePopupMenu.
/**
* {@inheritDoc}
*/
@Override
protected JPopupMenu createTablePopupMenu() {
final JPopupMenu menu = new JPopupMenu();
if (getNoOfTableRows() == 0) {
// the table contains no rows
final JMenuItem item = new JMenuItem("No column(s) available");
item.setEnabled(false);
menu.add(item);
return menu;
}
createColumnSelectionMenu(menu);
menu.addSeparator();
appendMissingValuesEntry(menu);
menu.addSeparator();
createAggregationSection(menu);
return menu;
}
use of javax.swing.JPopupMenu in project vcell by virtualcell.
the class PDEDataViewer method getImagejPopupMenu.
private javax.swing.JPopupMenu getImagejPopupMenu() {
if (imagejPopupMenu == null) {
try {
imagejPopupMenu = new JPopupMenu();
imagejPopupMenu.add(getSendTimePointImageMenuItem());
imagejPopupMenu.add(getSendDomainImageMenuItem());
imagejPopupMenu.add(getsendTimeSeriesImageMenuItem());
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return imagejPopupMenu;
}
use of javax.swing.JPopupMenu in project vcell by virtualcell.
the class DefaultScrollTableActionManager method constructPopupMenu.
protected void constructPopupMenu() {
TableModel tableModel = ownerTable.getModel();
int numColumns = tableModel.getColumnCount();
boolean[] bEditable = new boolean[numColumns];
boolean bTableEditable = false;
for (int c = 0; c < numColumns; c++) {
for (int r = 0; r < selectedRows.length; r++) {
if (tableModel.isCellEditable(selectedRows[r], c)) {
bEditable[c] = true;
bTableEditable = true;
break;
}
}
}
if (!bTableEditable) {
return;
}
if (popupMenu == null) {
popupMenu = new JPopupMenu();
columnMenus = new JMenu[numColumns];
popupLabel = new javax.swing.JLabel();
popupLabel.setText(" Specify Column Value for Selected Row(s)");
}
popupMenu.removeAll();
popupMenu.add(popupLabel);
int[] uniqueColumns = getUniqueColumns();
for (int c = 0; c < numColumns; c++) {
String columnName = tableModel.getColumnName(c);
if (disabledColumnPopups.contains(c)) {
continue;
}
if (columnName.equalsIgnoreCase("name")) {
continue;
}
boolean bUnique = false;
if (uniqueColumns != null) {
for (int uc : uniqueColumns) {
if (uc == c) {
bUnique = true;
break;
}
}
}
if (bUnique) {
continue;
}
if (bEditable[c]) {
if (columnMenus[c] == null) {
Class<?> columnClass = tableModel.getColumnClass(c);
Component editorComponent = null;
TableCellEditor cellEditor = ownerTable.getColumnModel().getColumn(c).getCellEditor();
if (cellEditor == null) {
cellEditor = ownerTable.getDefaultEditor(columnClass);
}
if (cellEditor instanceof DefaultCellEditor) {
editorComponent = ((DefaultCellEditor) cellEditor).getComponent();
}
if (editorComponent == null || !(editorComponent instanceof JCheckBox) && !(editorComponent instanceof JTextField)) {
continue;
}
ScrollTableCellEditorType editorType = editorComponent instanceof JCheckBox ? ScrollTableCellEditorType.jcheckbox : ScrollTableCellEditorType.jtextfield;
columnMenus[c] = new JMenu(columnName);
switch(editorType) {
case jcheckbox:
JMenuItem menuItemCheckSelected = new JMenuItem("Checked");
menuItemCheckSelected.addActionListener(this);
columnActionComponentList.add(new ColumnActionComponent(c, menuItemCheckSelected, true));
JMenuItem menuItemUncheckSelected = new JMenuItem("Unchecked");
menuItemUncheckSelected.addActionListener(this);
columnActionComponentList.add(new ColumnActionComponent(c, menuItemUncheckSelected, false));
columnMenus[c].add(menuItemCheckSelected);
columnMenus[c].add(menuItemUncheckSelected);
break;
case jtextfield:
JTextField textField = new JTextField(5);
textField.addActionListener(this);
textField.setBorder(BorderFactory.createCompoundBorder(new EmptyBorder(2, 4, 2, 4), textField.getBorder()));
columnActionComponentList.add(new ColumnActionComponent(c, textField));
JLabel label = new JLabel(" (Press Enter to commit) ");
label.setFont(label.getFont().deriveFont(label.getFont().getSize2D() - 1));
columnMenus[c].add(textField);
columnMenus[c].add(label);
break;
}
}
columnMenus[c].setEnabled(true);
} else {
if (columnMenus[c] != null) {
columnMenus[c].setEnabled(false);
}
}
if (columnMenus[c] != null) {
popupMenu.add(columnMenus[c]);
}
}
}
use of javax.swing.JPopupMenu in project vcell by virtualcell.
the class LWButton method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
JPopupMenu popup = new JPopupMenu();
for (JMenuItem mi : LWTopFrame.activeMenuItems()) {
popup.add(mi);
}
Insets insets = owner.getInsets();
popup.show(owner, getX() + insets.left, getY() + insets.top);
}
use of javax.swing.JPopupMenu in project vcell by virtualcell.
the class BioModelEditorPathwayDiagramPanel method getPopupMenu.
private JPopupMenu getPopupMenu() {
if (popupMenu == null) {
popupMenu = new JPopupMenu();
deleteMenuItem = new JMenuItem("Delete");
deleteMenuItem.addActionListener(eventHandler);
popupMenu.add(deleteMenuItem);
selectAllMenuItem = new JMenuItem("Select All");
selectAllMenuItem.addActionListener(eventHandler);
popupMenu.add(selectAllMenuItem);
popupMenu.addSeparator();
showPhysiologyLinksMenuItem1 = new JMenuItem("Show Linked Physiology Objects");
showPhysiologyLinksMenuItem1.addActionListener(eventHandler);
editPhysiologyLinksMenuItem1 = new JMenuItem("Edit Physiology Links...");
editPhysiologyLinksMenuItem1.addActionListener(eventHandler);
importIntoModelMenuItem1 = new JMenuItem("Import into Physiology...");
importIntoModelMenuItem1.addActionListener(eventHandler);
popupMenu.add(showPhysiologyLinksMenuItem1);
popupMenu.add(editPhysiologyLinksMenuItem1);
popupMenu.add(importIntoModelMenuItem1);
popupMenu.addSeparator();
collapseMenuItem1 = new JMenuItem("Collapse");
collapseMenuItem1.addActionListener(eventHandler);
expandMenuItem1 = new JMenuItem("Expand");
expandMenuItem1.addActionListener(eventHandler);
groupMenuItem1 = new JMenuItem("Group");
groupMenuItem1.addActionListener(eventHandler);
ungroupMenuItem1 = new JMenuItem("Ungroup");
ungroupMenuItem1.addActionListener(eventHandler);
popupMenu.add(collapseMenuItem1);
popupMenu.add(expandMenuItem1);
popupMenu.add(groupMenuItem1);
popupMenu.add(ungroupMenuItem1);
}
refreshButtons();
return popupMenu;
}
Aggregations