List of usage examples for java.awt.event MouseEvent getClickCount
public int getClickCount()
From source file:self.philbrown.javaQuery.$.java
/** * Invokes the given Function every time each view in the current selection is long-clicked. * The only parameter passed to the given function a javaQuery instance with the long-clicked view. * @param function the function to call when this view is long-clicked * @return this/*from www . java2 s .com*/ */ public $ dblclick(final Function function) { for (final Component view : this.views) { view.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) function.invoke($.with(view)); } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } }); } return this; }
From source file:self.philbrown.javaQuery.$.java
/** * Invokes the given Function for long-click events on the views in the current selection. * The function will receive two arguments: * <ol>/*from w w w . j ava2 s. com*/ * <li>a javaQuery containing the long-clicked view * <li>{@code eventData} * </ol> * @param eventData the second argument to pass to the {@code function} * @param function the function to invoke * @return */ public $ dblclick(final Object eventData, final Function function) { for (final Component view : this.views) { view.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) function.invoke($.with(view), eventData); } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } }); } return this; }
From source file:GUI.MainWindow.java
private void VulnTreeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_VulnTreeMouseClicked // Do nothing Object obj = VulnTree.getLastSelectedPathComponent(); if (obj == null) // No vulns selected so no interaction required {/*from w w w. j a va 2 s .co m*/ return; } if (evt.getButton() == MouseEvent.BUTTON3) { // At least one vuln was selected so we need to see how many and modify the context menu if (VulnTree.getSelectionCount() == 1) { // User cannot merge because they don't have two selected MergeButton.setEnabled(false); } else { MergeButton.setEnabled(true); } VulnTreeContextMenu.show(VulnTree, evt.getX(), evt.getY()); } else if (evt.getButton() == MouseEvent.BUTTON1 && evt.getClickCount() == 2) { showNotes(); } }
From source file:com.projity.pm.graphic.spreadsheet.SpreadSheet.java
public void setModel(SpreadSheetModel spreadSheetModel, SpreadSheetColumnModel spreadSheetColumnModel) { makeCustomTableHeader(spreadSheetColumnModel); TableModel oldModel = getModel(); setModel(spreadSheetModel);//w w w . ja v a 2 s .co m if (spreadSheetColumnModel != null) { //System.out.println("creating new ColModel"); setColumnModel(spreadSheetColumnModel); selection = new SpreadSheetSelectionModel(this); selection.setRowSelection(new SpreadSheetListSelectionModel(selection, true)); selection.setColumnSelection(new SpreadSheetListSelectionModel(selection, false)); setSelectionModel(selection.getRowSelection()); createDefaultColumnsFromModel(spreadSheetModel.getFieldArray()); //Consume memory getColumnModel().setSelectionModel(selection.getColumnSelection()); } registerEditors(); //Consume memory initRowHeader(spreadSheetModel); initModel(); initListeners(); GraphicConfiguration config = GraphicConfiguration.getInstance(); //fix for substance setTableHeader(createDefaultTableHeader()); JTableHeader header = getTableHeader(); header.setPreferredSize( new Dimension((int) header.getPreferredSize().getWidth(), config.getColumnHeaderHeight())); header.addMouseListener(new HeaderMouseListener(this)); addMouseListener(new MouseAdapter() { // Cursor oldCursor = null; // public void mouseEntered(MouseEvent e) { // Point p = e.getPoint(); // int col = columnAtPoint(p); // Field field = ((SpreadSheetModel) getModel()).getFieldInNonTranslatedColumn(col + 1); // System.out.println("mouse entered field " + field); // if (field != null && field.isHyperlink()) { // oldCursor = getCursor(); // setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); // System.out.println("setting new cursor to " + Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) + " old is " + oldCursor); // } else // super.mouseEntered(e); // // } // // public void mouseExited(MouseEvent e) { // Point p = e.getPoint(); // int col = columnAtPoint(p); // Field field = ((SpreadSheetModel) getModel()).getFieldInNonTranslatedColumn(col + 1); // System.out.println("mouse exited field " + field); // if (field != null && field.isHyperlink()) { // setCursor(oldCursor); // System.out.println("setting old cursor to " + oldCursor); // e.consume(); // } else // super.mouseEntered(e); // } public void mousePressed(MouseEvent e) { // changed to mousePressed instead of mouseClicked() for snappier handling 17/5/04 hk Point p = e.getPoint(); int row = rowAtPoint(p); int col = columnAtPoint(p); SpreadSheetPopupMenu popup = getPopup(); if (SwingUtilities.isLeftMouseButton(e)) { SpreadSheetColumnModel columnModel = (SpreadSheetColumnModel) getColumnModel(); Field field = ((SpreadSheetModel) getModel()).getFieldInNonTranslatedColumn(col + 1); SpreadSheetModel model = (SpreadSheetModel) getModel(); if (field.isNameField()) { // if (col == columnModel.getNameIndex()) { GraphicNode node = model.getNode(row); if (isOnIcon(e)) { if (model.getCellProperties(node).isCompositeIcon()) { finishCurrentOperations(); selection.getRowSelection().clearSelection(); boolean change = true; if (!node.isFetched()) // for subprojects change = node.fetch(); if (change) model.changeCollapsedState(row); e.consume(); // prevent dbl click treatment below // because editor may have already been // installed we // have to update its collapsed state // updateNameCellEditor(node); // editCellAt(row,model.findGraphicNodeRow(node)); } } } else if (field != null && field.isHyperlink()) { Hyperlink link = (Hyperlink) model.getValueAt(row, col + 1); if (link != null) { BrowserControl.displayURL(link.getAddress()); e.consume(); // prevent dbl click treatment below } } if (!e.isConsumed()) { if (e.getClickCount() == 2) // if above code didn't treat and is dbl click doDoubleClick(row, col); else doClick(row, col); } } else if (popup != null && SwingUtilities.isRightMouseButton(e)) { // e.isPopupTrigger() can be used too // selection.getRowSelection().clearSelection(); // selection.getRowSelection().addSelectionInterval(row, row); popup.setRow(row); popup.setCol(col); popup.show(SpreadSheet.this, e.getX(), e.getY()); } } }); if (oldModel != spreadSheetModel && oldModel instanceof CommonSpreadSheetModel) ((CommonSpreadSheetModel) getModel()).getCache().removeNodeModelListener(this); spreadSheetModel.getCache().addNodeModelListener(this); // getColumnModel().addColumnModelListener(new TableColumnModelListener(){ // public void columnAdded(TableColumnModelEvent e) { // // TODO Auto-generated method stub // // } // public void columnMarginChanged(ChangeEvent e) { // // TODO Auto-generated method stub // // } // public void columnMoved(TableColumnModelEvent e) { // // TODO Auto-generated method stub // // } // public void columnRemoved(TableColumnModelEvent e) { // // TODO Auto-generated method stub // // } // public void columnSelectionChanged(ListSelectionEvent e) { // System.out.println(((e.getValueIsAdjusting())?"lse=":"LSE=")+e.getFirstIndex()+", "+e.getLastIndex()); // SpreadSheet.this.revalidate(); // //SpreadSheet.this.paintImmediately(0, 0, getWidth(), GraphicConfiguration.getInstance().getColumnHeaderHeight()); // } // }); }
From source file:com.mirth.connect.client.ui.browsers.message.MessageBrowser.java
/** * Sets the properties and adds the listeners for the Mappings Table. No data is loaded at this * point./*from ww w .ja v a 2 s. c o m*/ */ private void makeMappingsTable() { updateMappingsTable(null, true); // listen for trigger button and double click to edit channel. mappingsTable.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { if (mappingsTable.rowAtPoint(new Point(evt.getX(), evt.getY())) == -1) { return; } if (evt.getClickCount() >= 2) { new ViewContentDialog((String) mappingsTable.getModel() .getValueAt(mappingsTable.convertRowIndexToModel(mappingsTable.getSelectedRow()), 2)); } } }); mappingsTable.setSelectionMode(0); mappingsTable.getColumnExt(SCOPE_COLUMN_NAME).setMinWidth(UIConstants.MIN_WIDTH); mappingsTable.getColumnExt(SCOPE_COLUMN_NAME).setMaxWidth(UIConstants.MAX_WIDTH); // Disable HTML in a column. DefaultTableCellRenderer noHTMLRenderer = new DefaultTableCellRenderer(); noHTMLRenderer.putClientProperty("html.disable", Boolean.TRUE); mappingsTable.getColumnExt(VALUE_COLUMN_NAME).setCellRenderer(noHTMLRenderer); mappingsPane.setViewportView(mappingsTable); }
From source file:edu.ku.brc.specify.Specify.java
/** * Shows the About dialog.//from w w w. j a v a 2s. co m */ public void doAbout() { AppContextMgr acm = AppContextMgr.getInstance(); boolean showDetailedAbout = acm.hasContext() && acm.getClassObject(Division.class) != null && acm.getClassObject(Discipline.class) != null && acm.getClassObject(Collection.class) != null; int baseNumRows = 14; String serverName = AppPreferences.getLocalPrefs().get("login.servers_selected", null); if (serverName != null) { baseNumRows++; } CellConstraints cc = new CellConstraints(); PanelBuilder infoPB = new PanelBuilder(new FormLayout("p,6px,f:p:g", "p,4px,p,4px," + UIHelper.createDuplicateJGoodiesDef("p", "2px", baseNumRows))); JLabel iconLabel = new JLabel(IconManager.getIcon("SpecifyLargeIcon"), SwingConstants.CENTER); //$NON-NLS-1$ PanelBuilder iconPB = new PanelBuilder(new FormLayout("p", "20px,t:p,f:p:g")); iconPB.add(iconLabel, cc.xy(1, 2)); if (showDetailedAbout) { final ArrayList<String> values = new ArrayList<String>(); DBTableIdMgr tableMgr = DBTableIdMgr.getInstance(); boolean hasReged = !RegisterSpecify.isAnonymous() && RegisterSpecify.hasInstitutionRegistered(); int y = 1; infoPB.addSeparator(getResourceString("Specify.SYS_INFO"), cc.xyw(1, y, 3)); y += 2; JLabel lbl = UIHelper.createLabel(databaseName); addLabel(values, infoPB, UIHelper.createI18NFormLabel("Specify.DB"), cc.xy(1, y)); addLabel(values, infoPB, lbl, cc.xy(3, y)); y += 2; lbl.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openLocalPrefs(); } } }); int instId = Institution.getClassTableId(); addLabel(values, infoPB, UIHelper.createFormLabel(tableMgr.getTitleForId(instId)), cc.xy(1, y)); addLabel(values, infoPB, lbl = UIHelper.createLabel(acm.getClassObject(Institution.class).getName()), cc.xy(3, y)); y += 2; addLabel(values, infoPB, UIHelper.createFormLabel(getGUIDTitle(instId)), cc.xy(1, y)); String noGUID = "<No GUID>"; String guidStr = acm.getClassObject(Institution.class).getGuid(); addLabel(values, infoPB, lbl = UIHelper.createLabel(guidStr != null ? guidStr : noGUID), cc.xy(3, y)); y += 2; lbl.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openRemotePrefs(); } } }); addLabel(values, infoPB, UIHelper.createFormLabel(tableMgr.getTitleForId(Division.getClassTableId())), cc.xy(1, y)); addLabel(values, infoPB, lbl = UIHelper.createLabel(acm.getClassObject(Division.class).getName()), cc.xy(3, y)); y += 2; lbl.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openGlobalPrefs(); } } }); addLabel(values, infoPB, UIHelper.createFormLabel(tableMgr.getTitleForId(Discipline.getClassTableId())), cc.xy(1, y)); addLabel(values, infoPB, UIHelper.createLabel(acm.getClassObject(Discipline.class).getName()), cc.xy(3, y)); y += 2; addLabel(values, infoPB, UIHelper.createFormLabel(tableMgr.getTitleForId(Collection.getClassTableId())), cc.xy(1, y)); addLabel(values, infoPB, UIHelper.createLabel(acm.getClassObject(Collection.class).getCollectionName()), cc.xy(3, y)); y += 2; addLabel(values, infoPB, UIHelper.createFormLabel(getGUIDTitle(Collection.getClassTableId())), cc.xy(1, y)); guidStr = acm.getClassObject(Collection.class).getGuid(); addLabel(values, infoPB, UIHelper.createLabel(guidStr != null ? guidStr : noGUID), cc.xy(3, y)); y += 2; //addLabel(values, infoPB, UIHelper.createI18NFormLabel("Specify.BLD"), cc.xy(1, y)); //addLabel(values, infoPB, UIHelper.createLabel(appBuildVersion),cc.xy(3, y)); y += 2; addLabel(values, infoPB, UIHelper.createI18NFormLabel("Specify.BLD"), cc.xy(1, y)); UIRegistry.loadAndPushResourceBundle("bld"); addLabel(values, infoPB, UIHelper.createLabel(getResourceString("build")), cc.xy(3, y)); y += 2; addLabel(values, infoPB, UIHelper.createI18NFormLabel("Specify.BLD_TM"), cc.xy(1, y)); addLabel(values, infoPB, UIHelper.createLabel(getResourceString("buildtime")), cc.xy(3, y)); y += 2; UIRegistry.popResourceBundle(); addLabel(values, infoPB, UIHelper.createI18NFormLabel("Specify.REG"), cc.xy(1, y)); addLabel(values, infoPB, UIHelper.createI18NLabel(hasReged ? "Specify.HASREG" : "Specify.NOTREG"), cc.xy(3, y)); y += 2; String isaNumber = RegisterSpecify.getISANumber(); addLabel(values, infoPB, UIHelper.createI18NFormLabel("Specify.ISANUM"), cc.xy(1, y)); addLabel(values, infoPB, UIHelper.createLabel(StringUtils.isNotEmpty(isaNumber) ? isaNumber : ""), cc.xy(3, y)); y += 2; if (serverName != null) { addLabel(values, infoPB, UIHelper.createI18NFormLabel("Specify.SERVER"), cc.xy(1, y)); addLabel(values, infoPB, UIHelper.createLabel(StringUtils.isNotEmpty(serverName) ? serverName : ""), cc.xy(3, y)); y += 2; } if (StringUtils.contains(DBConnection.getInstance().getConnectionStr(), "mysql")) { Vector<Object[]> list = BasicSQLUtils.query("select version() as ve"); if (list != null && list.size() > 0) { addLabel(values, infoPB, UIHelper.createFormLabel("MySQL Version"), cc.xy(1, y)); addLabel(values, infoPB, UIHelper.createLabel(list.get(0)[0].toString()), cc.xy(3, y)); y += 2; } } addLabel(values, infoPB, UIHelper.createFormLabel("Java Version"), cc.xy(1, y)); addLabel(values, infoPB, UIHelper.createLabel(System.getProperty("java.version")), cc.xy(3, y)); y += 2; JButton copyCBBtn = createIconBtn("ClipboardCopy", IconManager.IconSize.Std24, "Specify.CPY_ABT_TO_TT", null); //copyCBBtn.setBackground(Color.WHITE); //copyCBBtn.setOpaque(true); //copyCBBtn.setBorder(BorderFactory.createEtchedBorder()); copyCBBtn.setEnabled(true); PanelBuilder cbPB = new PanelBuilder(new FormLayout("f:p:g,p", "p")); cbPB.add(copyCBBtn, cc.xy(2, 1)); copyCBBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // Copy to Clipboard StringBuilder sb = new StringBuilder(); for (int i = 0; i < values.size(); i++) { sb.append(String.format("%s = %s\n", values.get(i), values.get(i + 1))); i++; } UIHelper.setTextToClipboard(sb.toString()); UIRegistry.displayInfoMsgDlgLocalized("Specify.CPY_ABT_TO_MSG"); } }); infoPB.add(cbPB.getPanel(), cc.xy(3, y)); y += 2; } String txt = getAboutText(appName, appVersion); JLabel txtLbl = createLabel(txt); txtLbl.setFont(UIRegistry.getDefaultFont()); final JEditorPane txtPane = new JEditorPane("text/html", txt); txtPane.setEditable(false); txtPane.setBackground(new JPanel().getBackground()); PanelBuilder pb = new PanelBuilder(new FormLayout("p,20px,f:min(400px;p):g,10px,8px,10px,p:g", "f:p:g")); pb.add(iconPB.getPanel(), cc.xy(1, 1)); pb.add(txtPane, cc.xy(3, 1)); Color bg = getBackground(); if (showDetailedAbout) { pb.add(new VerticalSeparator(bg.darker(), bg.brighter()), cc.xy(5, 1)); pb.add(infoPB.getPanel(), cc.xy(7, 1)); } pb.setDefaultDialogBorder(); String title = getResourceString("Specify.ABOUT");//$NON-NLS-1$ CustomDialog aboutDlg = new CustomDialog(topFrame, title + " " + appName, true, CustomDialog.OK_BTN, //$NON-NLS-1$ pb.getPanel()); String okLabel = getResourceString("Specify.CLOSE");//$NON-NLS-1$ aboutDlg.setOkLabel(okLabel); aboutDlg.createUI(); aboutDlg.pack(); // for some strange reason I can't get the dialog to size itself correctly Dimension size = aboutDlg.getSize(); size.height += 120; aboutDlg.setSize(size); txtPane.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent event) { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { try { AttachmentUtils.openURI(event.getURL().toURI()); } catch (Exception e) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); } } } }); UIHelper.centerAndShow(aboutDlg); }
From source file:stainingestimation.StainingEstimation.java
private void jXTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jXTable1MouseClicked if (evt.getClickCount() == 1) { int row = jXTable1.getSelectedRow(); if (row >= 0) { row = jXTable1.convertRowIndexToModel(row); setParam_ColorChannel((String) jXTable1.getModel().getValueAt(row, 1)); manager.setLabelRadius((int) jXTable1.getModel().getValueAt(row, 2)); setParam_tolerance((int) jXTable1.getModel().getValueAt(row, 3)); setParam_blur((int) jXTable1.getModel().getValueAt(row, 4)); setParam_t_hema((int) jXTable1.getModel().getValueAt(row, 5)); setParam_t_dab((int) jXTable1.getModel().getValueAt(row, 6)); doStainingEstimation(false); calculateFScore();/*from w w w. j a va 2s. com*/ } } }
From source file:com.diversityarrays.kdxplore.curate.TrialDataEditor.java
public TrialDataEditor(CurationData cd, WindowOpener<JFrame> windowOpener, MessageLogger messageLogger, KdxploreDatabase kdxdb, IntFunction<Trait> traitProvider, SampleType[] sampleTypes) throws IOException { super(new BorderLayout()); this.traitProvider = traitProvider; this.windowOpener = windowOpener; this.curationData = cd; this.curationData.setChangeManager(changeManager); this.curationData.setKDSmartDatabase(kdxdb.getKDXploreKSmartDatabase()); inactiveTagFilterIcon = KDClientUtils.getIcon(ImageId.TAG_FILTER_24); activeTagFilterIcon = KDClientUtils.getIcon(ImageId.TAG_FILTER_ACTIVE_24); inactivePlotOrSpecimenFilterIcon = KDClientUtils.getIcon(ImageId.FILTER_PLOT_SPEC_INACTIVE); activePlotFilterIcon = KDClientUtils.getIcon(ImageId.FILTER_PLOT_ACTIVE); activeSpecimenFilterIcon = KDClientUtils.getIcon(ImageId.FILTER_SPEC_ACTIVE); updatePlotSpecimenIcon();/*from ww w .j a v a 2 s .c o m*/ TraitColorProvider traitColourProvider = new TraitColorProvider(false); this.curationData.setTraitColorProvider(traitColourProvider); curationData.addCurationDataChangeListener(new CurationDataChangeListener() { @Override public void plotActivationChanged(Object source, boolean activated, List<Plot> plots) { updateRowFilter(); if (toolController != null) { toolController.plotActivationsChanged(activated, plots); } } @Override public void editedSamplesChanged(Object source, List<CurationCellId> curationCellIds) { if (toolController != null) { toolController.editedSamplesChanged(); } } }); this.selectedValueStore = new SelectedValueStore(curationData.getTrial().getTrialName()); this.messageLogger = messageLogger; smallFont = KDClientUtils.makeSmallFont(this); // undockViewAction.putValue(Action.SHORT_DESCRIPTION, "Click to undock // this view"); KDClientUtils.initAction(ImageId.HELP_24, curationHelpAction, Msg.TOOLTIP_HELP_DATA_CURATION(), false); KDClientUtils.initAction(ImageId.SAVE_24, saveChangesAction, Msg.TOOLTIP_SAVE_CHANGES(), true); KDClientUtils.initAction(ImageId.EXPORT_24, exportCuratedData, Msg.TOOLTIP_EXPORT(), true); KDClientUtils.initAction(ImageId.UNDO_24, undoAction, Msg.TOOLTIP_UNDO(), true); KDClientUtils.initAction(ImageId.REDO_24, redoAction, Msg.TOOLTIP_REDO(), true); KDClientUtils.initAction(ImageId.FIELD_VIEW_24, showFieldViewAction, Msg.TOOLTIP_FIELD_VIEW(), false); KDClientUtils.initAction(ImageId.GET_TRIALINFO_24, importCuratedData, Msg.TOOLTIP_IMPORT_DATA(), true); Function<TraitInstance, List<KdxSample>> sampleProvider = new Function<TraitInstance, List<KdxSample>>() { @Override public List<KdxSample> apply(TraitInstance ti) { return curationData.getSampleMeasurements(ti); } }; tivrByTi = VisToolUtil.buildTraitInstanceValueRetrieverMap(curationData.getTrial(), curationData.getTraitInstances(), sampleProvider); // = = = = = = = = boolean readOnly = false; // FIXME work out if the Trial can be edited or not curationTableModel = new CurationTableModel(curationData, readOnly); // See FIXME comment in CurationTableModel.isReadOnly() curationTableSelectionModel = new CurationTableSelectionModelImpl(selectedValueStore, curationTableModel); curationTableSelectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); curationTable = new CurationTable("CurationTable-" + (++UNIQUE_CURATION_TABLE_ID), //$NON-NLS-1$ curationTableModel, curationTableSelectionModel); curationTable.setCellSelectionEnabled(true); curationTable.setAutoCreateRowSorter(true); // = = = = = = = = this.sampleSourcesTablePanel = new SampleSourcesTablePanel(curationData, curationTableModel, handler); @SuppressWarnings("unchecked") TableRowSorter<CurationTableModel> rowSorter = (TableRowSorter<CurationTableModel>) curationTable .getRowSorter(); rowSorter.setSortsOnUpdates(true); rowSorter.addRowSorterListener(rowSorterListener); curationCellRenderer = new CurationTableCellRenderer(curationTableModel, colorProviderFactory, curationTableSelectionModel); curationTable.setDefaultRenderer(Object.class, curationCellRenderer); curationTable.setDefaultRenderer(Integer.class, curationCellRenderer); curationTable.setDefaultRenderer(String.class, curationCellRenderer); curationTable.setDefaultRenderer(CurationCellValue.class, curationCellRenderer); curationTable.setDefaultRenderer(Double.class, curationCellRenderer); curationTable.setDefaultRenderer(TraitValue.class, curationCellRenderer); // If either the rows selected change or the columns selected change // then we // need to inform the visualisation tools. curationTable.getSelectionModel().addListSelectionListener(curationTableCellSelectionListener); curationTable.getColumnModel().addColumnModelListener(curationTableCellSelectionListener); fieldLayoutView = new InterceptFieldLayoutView(); this.curationCellEditor = new CurationCellEditorImpl(curationTableModel, fieldLayoutView, curationData, refreshFieldLayoutView, kdxdb, traitProvider, sampleTypes); SuppressionInfoProvider suppressionInfoProvider = new SuppressionInfoProvider(curationData, curationTableModel, curationTable); suppressionHandler = new SuppressionHandler(curationContext, curationData, curationCellEditor, suppressionInfoProvider); loadVisualisationTools(); curationMenuProvider = new CurationMenuProvider(curationContext, curationData, messages, visualisationTools, suppressionHandler); curationMenuProvider.setSuppressionInfoProvider(suppressionInfoProvider); fieldLayoutView.addTraitInstanceSelectionListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (ItemEvent.SELECTED == e.getStateChange()) { TraitInstance traitInstance = fieldLayoutView.getActiveTraitInstance(true); if (traitInstance == null) { curationCellEditor.setCurationCellValue(null); } else { // startEdit(HowStarted.FIELD_VIEW_CHANGED_ACTIVE_TRAIT_INSTANCE); } fieldLayoutView.updateSamplesSelectedInTable(); } } }); // = = = = = = = curationData.addUnsavedChangesListener(new UnsavedChangesListener() { @Override public void unsavedChangesExist(Object source, int nChanges) { int unsavedCount = curationData.getUnsavedChangesCount(); saveChangesAction.setEnabled(unsavedCount > 0); if (unsavedCount > 0) { statusInfoLine.setMessage("Unsaved changes: " + unsavedCount); } else { statusInfoLine.setMessage("No Unsaved changes"); } } }); // curationData.addEditedSampleChangeListener(new ChangeListener() { // @Override // public void stateChanged(ChangeEvent e) { // handleEditedSampleChanges(); // } // }); saveChangesAction.setEnabled(false); changeManager.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { updateUndoRedoActions(); } }); undoAction.setEnabled(false); redoAction.setEnabled(false); // = = = = = = = = // TODO provide one of these for each relevant device type DeviceType deviceTypeForSamples = null; StatsData statsData = curationData.getStatsData(deviceTypeForSamples); TIStatsTableModel statsTableModel = new TIStatsTableModel2(curationData, statsData, deviceTypeForSamples); traitColourProvider.generateColorMap(statsData.getTraitInstancesWithData()); Set<Integer> instanceNumbers = statsData.getInstanceNumbers(); String nonHtmlLabel; if (instanceNumbers.size() > 1) { tAndIpanelLabel = "<HTML><i>Plot Info</i> & Trait Instances"; nonHtmlLabel = "Plot Info & Trait Instances"; } else { tAndIpanelLabel = "<HTML><i>Plot Info</i> & Traits"; nonHtmlLabel = "Plot Info & Traits"; } traitsAndInstancesPanel = new TraitsAndInstancesPanel2(curationContext, smallFont, statsTableModel, instanceNumbers.size() > 1, statsData.getInvalidRuleCount(), nonHtmlLabel, curationMenuProvider, outlierConsumer); traitsAndInstancesPanel.addTraitInstanceStatsItemListener(new ItemListener() { boolean busy; @Override public void itemStateChanged(ItemEvent e) { // NOTE: we want to process both SELECTED and DESELECTED // variants if (busy) { Shared.Log.d(TAG, "***** LOOPED in traitsAndInstancesPanel.ItemListener"); //$NON-NLS-1$ } else { Shared.Log.d(TAG, "traitsAndInstancesPanel.ItemListener BEGIN"); //$NON-NLS-1$ busy = true; try { updateViewedTraitInstances(e); // !!!!! } finally { busy = false; Shared.Log.d(TAG, "traitsAndInstancesPanel.ItemListener END\n"); //$NON-NLS-1$ } } } }); // = = = = = = = = plotCellChoicesPanel = new PlotCellChoicesPanel(curationContext, curationData, deviceTypeForSamples, tAndIpanelLabel, curationMenuProvider, colorProviderFactory); // plotCellChoicesPanel.setData( // curationData.getPlotAttributes(), // traitsAndInstancesPanel.getTraitInstancesWithData()); plotCellChoicesPanel.addPlotCellChoicesListener(new PlotCellChoicesListener() { @Override public void traitInstanceChoicesChanged(Object source, boolean choiceAdded, TraitInstance[] choice, Map<Integer, Set<TraitInstance>> traitInstancesByTraitId) { traitsAndInstancesPanel.changeTraitInstanceChoice(choiceAdded, choice); } @Override public void plotAttributeChoicesChanged(Object source, List<ValueRetriever<?>> vrList) { curationTableModel.setSelectedPlotAttributes(vrList); } }); // = = = = = = = = statsAndSamplesSplit = createStatsAndSamplesTable(traitsAndInstancesPanel.getComponent()); mainTabbedPane.addTab(TAB_SAMPLES, samplesTableIcon, statsAndSamplesSplit, Msg.TOOLTIP_SAMPLES_TABLE()); // = = = = = = = = checkForInvalidTraits(); leftSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, createCurationCellEditorComponent(), plotCellChoicesPanel); leftSplit.setResizeWeight(0.5); // traitToDoTaskPaneContainer); // rightSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, // traitsAndInstancesPanel, fieldViewAndPlots); // rightSplit.setResizeWeight(0.5); // rightSplit.setOneTouchExpandable(true); leftAndRightSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftSplit, mainTabbedPane); leftAndRightSplit.setOneTouchExpandable(true); mainVerticalSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, messages, leftAndRightSplit); mainVerticalSplit.setOneTouchExpandable(true); mainVerticalSplit.setResizeWeight(0.0); add(statusInfoLine, BorderLayout.NORTH); add(mainVerticalSplit, BorderLayout.CENTER); fieldLayoutView.addCellSelectionListener(fieldViewCellSelectionListener); curationTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent me) { if (SwingUtilities.isRightMouseButton(me) && 1 == me.getClickCount()) { me.consume(); displayPopupMenu(me); } } }); }
From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositMain.java
private void treeEntitiesMouseClicked(java.awt.event.MouseEvent evt) { if (evt.getClickCount() > 1) { TreePath path = treeEntities.getSelectionPath(); DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); depositPresenter.openFile(node); }//from www .j a va 2 s.com }
From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositMain.java
private void treeFileSystemMouseClicked(java.awt.event.MouseEvent evt) { if (evt.getClickCount() > 1) { TreePath path = treeFileSystem.getSelectionPath(); if (path != null) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); depositPresenter.openFile(node); }/*ww w .j a va 2 s . co m*/ stopEditingTree(); } }