List of usage examples for javax.swing JButton setToolTipText
@BeanProperty(bound = false, preferred = true, description = "The text to display in a tool tip.") public void setToolTipText(String text)
From source file:org.tinymediamanager.ui.tvshows.settings.TvShowSettingsPanel.java
/** * Instantiates a new tv show settings panel. *///from www. j av a 2 s . c om public TvShowSettingsPanel() { setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow(3)"), })); JPanel panelGeneral = new JPanel(); panelGeneral.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.general"), TitledBorder.LEADING, //$NON-NLS-1$ TitledBorder.TOP, null, null)); add(panelGeneral, "2, 2, fill, fill"); panelGeneral.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, })); lblImageCache = new JLabel(BUNDLE.getString("Settings.imagecacheimport")); panelGeneral.add(lblImageCache, "2, 2"); chckbxImageCache = new JCheckBox(""); panelGeneral.add(chckbxImageCache, "4, 2"); lblImageCacheHint = new JLabel(BUNDLE.getString("Settings.imagecacheimporthint")); //$NON-NLS-1$ panelGeneral.add(lblImageCacheHint, "6, 2, 3, 1"); TmmFontHelper.changeFont(lblImageCacheHint, 0.833); final JSeparator separator = new JSeparator(); panelGeneral.add(separator, "2, 4, 7, 1"); JLabel lblTraktTv = new JLabel(BUNDLE.getString("Settings.trakt"));//$NON-NLS-1$ panelGeneral.add(lblTraktTv, "2, 6"); chckbxTraktTv = new JCheckBox(""); panelGeneral.add(chckbxTraktTv, "4, 6"); btnClearTraktTvShows = new JButton(BUNDLE.getString("Settings.trakt.cleartvshows"));//$NON-NLS-1$ btnClearTraktTvShows.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int confirm = JOptionPane.showOptionDialog(null, BUNDLE.getString("Settings.trakt.cleartvshows.hint"), BUNDLE.getString("Settings.trakt.cleartvshows"), JOptionPane.YES_NO_OPTION, //$NON-NLS-1$ JOptionPane.QUESTION_MESSAGE, null, null, null); if (confirm == JOptionPane.YES_OPTION) { TmmTask task = new ClearTraktTvTask(false, true); TmmTaskManager.getInstance().addUnnamedTask(task); } } }); panelGeneral.add(btnClearTraktTvShows, "6, 6"); JPanel panelBadWords = new JPanel(); panelBadWords.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.tvshow.badwords"), //$NON-NLS-1$ TitledBorder.LEADING, TitledBorder.TOP, null, null)); add(panelBadWords, "4, 2, fill, fill"); panelBadWords.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("50px:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, })); JTextPane txtpntBadWordsHint = new JTextPane(); txtpntBadWordsHint.setBackground(UIManager.getColor("Panel.background")); txtpntBadWordsHint.setText(BUNDLE.getString("Settings.tvshow.badwords.hint")); //$NON-NLS-1$ TmmFontHelper.changeFont(txtpntBadWordsHint, 0.833); panelBadWords.add(txtpntBadWordsHint, "2, 2, 3, 1, fill, default"); JScrollPane scpBadWords = new JScrollPane(); panelBadWords.add(scpBadWords, "2, 4, fill, fill"); listBadWords = new JList<>(); scpBadWords.setViewportView(listBadWords); JButton btnRemoveBadWord = new JButton(IconManager.LIST_REMOVE); btnRemoveBadWord.setToolTipText(BUNDLE.getString("Button.remove")); //$NON-NLS-1$ btnRemoveBadWord.setMargin(new Insets(2, 2, 2, 2)); btnRemoveBadWord.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { int row = listBadWords.getSelectedIndex(); if (row != -1) { String badWord = TvShowModuleManager.SETTINGS.getBadWords().get(row); TvShowModuleManager.SETTINGS.removeBadWord(badWord); } } }); panelBadWords.add(btnRemoveBadWord, "4, 4, default, bottom"); tfAddBadword = new JTextField(); tfAddBadword.setColumns(10); panelBadWords.add(tfAddBadword, "2, 6, fill, default"); JButton btnAddBadWord = new JButton(IconManager.LIST_ADD); btnAddBadWord.setToolTipText(BUNDLE.getString("Button.add")); //$NON-NLS-1$ btnAddBadWord.setMargin(new Insets(2, 2, 2, 2)); btnAddBadWord.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (StringUtils.isNotEmpty(tfAddBadword.getText())) { TvShowModuleManager.SETTINGS.addBadWord(tfAddBadword.getText()); tfAddBadword.setText(""); } } }); panelBadWords.add(btnAddBadWord, "4, 6"); { JPanel panelTvShowDataSources = new JPanel(); panelTvShowDataSources.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.tvshowdatasource"), //$NON-NLS-1$ TitledBorder.LEADING, TitledBorder.TOP, null, null)); add(panelTvShowDataSources, "2, 4, 3, 1, fill, top"); panelTvShowDataSources.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("50dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("200dlu:grow(2)"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("160px:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, })); JLabel lblDataSource = new JLabel(BUNDLE.getString("Settings.source")); //$NON-NLS-1$ panelTvShowDataSources.add(lblDataSource, "2, 2, 5, 1"); JLabel lblSkipFolders = new JLabel(BUNDLE.getString("Settings.ignore"));//$NON-NLS-1$ panelTvShowDataSources.add(lblSkipFolders, "12, 2, 3, 1"); JScrollPane scrollPaneDatasource = new JScrollPane(); panelTvShowDataSources.add(scrollPaneDatasource, "2, 4, 5, 1, fill, fill"); listDatasources = new JList<>(); scrollPaneDatasource.setViewportView(listDatasources); JPanel panelTvShowSourcesButtons = new JPanel(); panelTvShowDataSources.add(panelTvShowSourcesButtons, "8, 4, default, top"); panelTvShowSourcesButtons.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, }, new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, })); JButton btnAdd = new JButton(IconManager.LIST_ADD); btnAdd.setToolTipText(BUNDLE.getString("Button.add")); //$NON-NLS-1$ btnAdd.setMargin(new Insets(2, 2, 2, 2)); btnAdd.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { Path file = TmmUIHelper .selectDirectory(BUNDLE.getString("Settings.tvshowdatasource.folderchooser")); //$NON-NLS-1$ if (file != null && Files.isDirectory(file)) { settings.addTvShowDataSources(file.toAbsolutePath().toString()); } } }); panelTvShowSourcesButtons.add(btnAdd, "1, 1, fill, top"); JButton btnRemove = new JButton(IconManager.LIST_REMOVE); btnRemove.setToolTipText(BUNDLE.getString("Button.remove")); //$NON-NLS-1$ btnRemove.setMargin(new Insets(2, 2, 2, 2)); btnRemove.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { int row = listDatasources.getSelectedIndex(); if (row != -1) { // nothing selected String path = settings.getTvShowDataSource().get(row); String[] choices = { BUNDLE.getString("Button.continue"), //$NON-NLS-1$ BUNDLE.getString("Button.abort") }; int decision = JOptionPane.showOptionDialog(null, String.format(BUNDLE.getString("Settings.tvshowdatasource.remove.info"), path), BUNDLE.getString("Settings.datasource.remove"), JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, null, choices, BUNDLE.getString("Button.abort")); //$NON-NLS-1$ if (decision == 0) { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); settings.removeTvShowDataSources(path); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } } }); panelTvShowSourcesButtons.add(btnRemove, "1, 3, fill, top"); JScrollPane scrollPane = new JScrollPane(); panelTvShowDataSources.add(scrollPane, "12, 4, fill, fill"); listExclude = new JList<>(); scrollPane.setViewportView(listExclude); JPanel panelSkipFolderButtons = new JPanel(); panelTvShowDataSources.add(panelSkipFolderButtons, "14, 4, fill, fill"); panelSkipFolderButtons.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, }, new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, })); JButton btnAddSkipFolder = new JButton(IconManager.LIST_ADD); btnAddSkipFolder.setToolTipText(BUNDLE.getString("Settings.addignore")); //$NON-NLS-1$ btnAddSkipFolder.setMargin(new Insets(2, 2, 2, 2)); btnAddSkipFolder.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Path file = TmmUIHelper.selectDirectory(BUNDLE.getString("Settings.ignore")); //$NON-NLS-1$ if (file != null && Files.isDirectory(file)) { settings.addTvShowSkipFolder(file.toAbsolutePath().toString()); } } }); panelSkipFolderButtons.add(btnAddSkipFolder, "1, 1"); JButton btnRemoveSkipFolder = new JButton(IconManager.LIST_REMOVE); btnRemoveSkipFolder.setToolTipText(BUNDLE.getString("Settings.removeignore")); //$NON-NLS-1$ btnRemoveSkipFolder.setMargin(new Insets(2, 2, 2, 2)); btnRemoveSkipFolder.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int row = listExclude.getSelectedIndex(); if (row != -1) { // nothing selected String ingore = settings.getTvShowSkipFolders().get(row); settings.removeTvShowSkipFolder(ingore); } } }); panelSkipFolderButtons.add(btnRemoveSkipFolder, "1, 3"); JLabel lblDvdOrder = new JLabel(BUNDLE.getString("Settings.dvdorder")); //$NON-NLS-1$ panelTvShowDataSources.add(lblDvdOrder, "2, 6, right, default"); cbDvdOrder = new JCheckBox(""); panelTvShowDataSources.add(cbDvdOrder, "4, 6"); } initDataBindings(); if (!Globals.isDonator()) { chckbxTraktTv.setSelected(false); chckbxTraktTv.setEnabled(false); btnClearTraktTvShows.setEnabled(false); } }
From source file:org.ut.biolab.medsavant.client.view.component.KeyValuePairPanel.java
public static Component getCopyButton(final String key, final KeyValuePairPanel p) { JButton button = ViewUtil .getTexturedButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.COPY)); button.setToolTipText("Copy " + key); button.addActionListener(new ActionListener() { @Override//from w ww . j a v a 2 s. c om public void actionPerformed(ActionEvent ae) { String selection = p.getValue(key); StringSelection data = new StringSelection(selection); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(data, data); DialogUtils.displayMessage("Copied \"" + selection + "\" to clipboard."); } }); return button; }
From source file:org.ut.biolab.medsavant.client.view.dialog.FamilySelector.java
private void initUI() { JPanel p = new JPanel(); ViewUtil.applyVerticalBoxLayout(p);//from w w w. j a va 2s. c om this.add(p); topPanel = ViewUtil.getClearPanel(); middlePanel = ViewUtil.getClearPanel(); bottomPanel = ViewUtil.getClearPanel(); p.add(topPanel); p.add(middlePanel); p.add(bottomPanel); // middle middlePanel.setLayout(new BorderLayout()); retriever = new FamilyReceiver(); stp = new SearchableTablePanel("Individuals", COLUMN_NAMES, COLUMN_CLASSES, HIDDEN_COLUMNS, true, true, Integer.MAX_VALUE, false, SearchableTablePanel.TableSelectionType.ROW, Integer.MAX_VALUE, retriever); stp.setExportButtonVisible(false); middlePanel.add(stp, BorderLayout.CENTER); // bottom ViewUtil.applyVerticalBoxLayout(bottomPanel); numselections = ViewUtil.getTitleLabel("0 families selected"); JPanel text = ViewUtil.getClearPanel(); ViewUtil.applyHorizontalBoxLayout(text); JButton clearIndividuals = ViewUtil .getIconButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.CLOSE)); clearIndividuals.setToolTipText("Clear selections"); clearIndividuals.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { clearSelections(); } }); text.add(numselections); text.add(Box.createHorizontalStrut(5)); text.add(clearIndividuals); bottomPanel.add(ViewUtil.centerHorizontally(text)); final JButton addAllIndividuals = ViewUtil.getSoftButton("Add All"); bottomPanel.add(addAllIndividuals); final JButton addIndividuals = ViewUtil.getSoftButton("Add Selected"); bottomPanel.add(addIndividuals); final JButton removeIndividuals = ViewUtil.getSoftButton("Remove Selected"); bottomPanel.add(removeIndividuals); final JButton removeAllIndividuals = ViewUtil.getSoftButton("Remove All"); bottomPanel.add(removeAllIndividuals); JPanel buttons = ViewUtil.getClearPanel(); ViewUtil.applyHorizontalBoxLayout(buttons); buttons.add(addAllIndividuals); buttons.add(addIndividuals); buttons.add(removeIndividuals); buttons.add(removeAllIndividuals); JPanel windowControlPanel = ViewUtil.getClearPanel(); ViewUtil.applyHorizontalBoxLayout(windowControlPanel); windowControlPanel.add(Box.createHorizontalGlue()); JButton cancel = new JButton("Cancel"); bottomPanel.add(ViewUtil.centerHorizontally(buttons)); ok = new JButton("OK"); bottomPanel.add(ViewUtil.alignRight(ok)); ok.setEnabled(false); windowControlPanel.add(cancel); windowControlPanel.add(ok); bottomPanel.add(windowControlPanel); final JDialog instance = this; ok.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { instance.setVisible(false); setIndividualsChosen(true); } }); cancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { instance.setVisible(false); setIndividualsChosen(false || hasMadeSelections); } }); addIndividuals.setEnabled(false); removeIndividuals.setEnabled(false); stp.getTable().getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent lse) { if (!lse.getValueIsAdjusting()) { int rows[] = stp.getTable().getSelectedRows(); boolean someSelection = rows.length > 0; addIndividuals.setEnabled(someSelection); removeIndividuals.setEnabled(someSelection); if (someSelection) { addIndividuals.setText("Add Selected (" + rows.length + ")"); removeIndividuals.setText("Remove Selected (" + rows.length + ")"); } else { addIndividuals.setText("Add Selected"); removeIndividuals.setText("Remove Selected"); } } } }); stp.getTable().getModel().addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent tme) { //addAllIndividuals.setText("Add All (" + stp.getTable().getModel().getRowCount() + ")"); //removeAllIndividuals.setText("Remove All (" + stp.getTable().getModel().getRowCount() + ")"); } }); ActionListener addAction = new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { addSelections(false); } }; ActionListener addAllAction = new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { addSelections(true); } }; ActionListener removeAction = new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { removeSelections(false); } }; ActionListener removeAllAction = new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { removeSelections(true); } }; addIndividuals.addActionListener(addAction); addAllIndividuals.addActionListener(addAllAction); removeIndividuals.addActionListener(removeAction); removeAllIndividuals.addActionListener(removeAllAction); this.pack(); this.setLocationRelativeTo(MedSavantFrame.getInstance()); }
From source file:org.ut.biolab.medsavant.client.view.dialog.IndividualSelector.java
private void initUI() { JPanel p = new JPanel(); ViewUtil.applyVerticalBoxLayout(p);//www . j ava 2 s. c om this.add(p); topPanel = ViewUtil.getClearPanel(); middlePanel = ViewUtil.getClearPanel(); bottomPanel = ViewUtil.getClearPanel(); p.add(topPanel); p.add(middlePanel); p.add(bottomPanel); // Only display the bottom panel for multiple patient selection if (onlyOnePatient) { bottomPanel.setVisible(false); } // middle middlePanel.setLayout(new BorderLayout()); individualsRetriever = new IndividualsReceiver(); individualsSTP = new SearchableTablePanel("Individuals", COLUMN_NAMES, COLUMN_CLASSES, HIDDEN_COLUMNS, true, true, Integer.MAX_VALUE, false, SearchableTablePanel.TableSelectionType.ROW, Integer.MAX_VALUE, individualsRetriever); individualsSTP.setExportButtonVisible(false); //If patients or cohorts are edited, update the searchabletable. CacheController.getInstance().addListener(new Listener<ModificationType>() { @Override public void handleEvent(ModificationType event) { if (event == ModificationType.PATIENT || event == ModificationType.COHORT) { if (!individualsSTP.isUpdating()) { forceRefresh = true; individualsSTP.forceRefreshData(); } } } }); middlePanel.add(individualsSTP, BorderLayout.CENTER); // bottom ViewUtil.applyVerticalBoxLayout(bottomPanel); numselections = ViewUtil.getTitleLabel("0 individual(s) selected"); JPanel text = ViewUtil.getClearPanel(); ViewUtil.applyHorizontalBoxLayout(text); JButton clearIndividuals = ViewUtil .getIconButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.CLOSE)); clearIndividuals.setToolTipText("Clear selections"); clearIndividuals.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { clearSelections(); } }); text.add(numselections); text.add(Box.createHorizontalStrut(5)); text.add(clearIndividuals); bottomPanel.add(ViewUtil.centerHorizontally(text)); final JButton addAllIndividuals = ViewUtil.getSoftButton("Add All"); bottomPanel.add(addAllIndividuals); final JButton addIndividuals = ViewUtil.getSoftButton("Add Selected"); bottomPanel.add(addIndividuals); final JButton removeIndividuals = ViewUtil.getSoftButton("Remove Selected"); bottomPanel.add(removeIndividuals); final JButton removeAllIndividuals = ViewUtil.getSoftButton("Remove All"); bottomPanel.add(removeAllIndividuals); JPanel buttons = ViewUtil.getClearPanel(); ViewUtil.applyHorizontalBoxLayout(buttons); buttons.add(addAllIndividuals); buttons.add(addIndividuals); buttons.add(removeIndividuals); buttons.add(removeAllIndividuals); JPanel windowControlPanel = ViewUtil.getClearPanel(); ViewUtil.applyHorizontalBoxLayout(windowControlPanel); windowControlPanel.add(Box.createHorizontalGlue()); JButton cancel = new JButton("Cancel"); bottomPanel.add(ViewUtil.centerHorizontally(buttons)); ok = new JButton("OK"); bottomPanel.add(ViewUtil.alignRight(ok)); ok.setEnabled(false); windowControlPanel.add(cancel); windowControlPanel.add(ok); bottomPanel.add(windowControlPanel); final JDialog instance = this; ok.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { instance.setVisible(false); setIndividualsChosen(true); } }); cancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { instance.setVisible(false); setIndividualsChosen(false || hasMadeSelections); } }); addIndividuals.setEnabled(false); removeIndividuals.setEnabled(false); individualsSTP.getTable().getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent lse) { if (!lse.getValueIsAdjusting()) { int rows[] = individualsSTP.getTable().getSelectedRows(); boolean someSelection = rows.length > 0; addIndividuals.setEnabled(someSelection); removeIndividuals.setEnabled(someSelection); if (someSelection) { addIndividuals.setText("Add Selected (" + rows.length + ")"); removeIndividuals.setText("Remove Selected (" + rows.length + ")"); } else { addIndividuals.setText("Add Selected"); removeIndividuals.setText("Remove Selected"); } /* Close the dialog if only a single individual is requested. */ if (onlyOnePatient && rows.length == 1) { selectedRows.clear(); selectedHospitalIDs.clear(); int realRow = individualsSTP.getActualRowAt(rows[0]); selectedRows.add(realRow); Object[] o = individualsRetriever.getIndividuals().get(realRow); selectedHospitalIDs.add(o[INDEX_OF_HOSPITAL_ID].toString()); instance.setVisible(false); setIndividualsChosen(true); individualsSTP.getTable().clearSelection(); // if errors crop up, this line may be causing ListSelectionEvents - can be removed } } } }); individualsSTP.getTable().getModel().addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent tme) { //addAllIndividuals.setText("Add All (" + stp.getTable().getModel().getRowCount() + ")"); //removeAllIndividuals.setText("Remove All (" + stp.getTable().getModel().getRowCount() + ")"); } }); ActionListener addAction = new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { addSelections(false); } }; ActionListener addAllAction = new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { addSelections(true); } }; ActionListener removeAction = new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { removeSelections(false); } }; ActionListener removeAllAction = new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { removeSelections(true); } }; addIndividuals.addActionListener(addAction); addAllIndividuals.addActionListener(addAllAction); removeIndividuals.addActionListener(removeAction); removeAllIndividuals.addActionListener(removeAllAction); this.pack(); this.setLocationRelativeTo(MedSavantFrame.getInstance()); }
From source file:org.ut.biolab.medsavant.client.view.genetics.variantinfo.DetailedVariantSubInspector.java
private Component getFilterButton(final String key) { JButton button = ViewUtil .getTexturedButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.FILTER)); button.setToolTipText("Filter " + key); button.addActionListener(new ActionListener() { @Override/*from w ww .java2 s. c o m*/ public void actionPerformed(ActionEvent ae) { } }); return button; }
From source file:org.ut.biolab.medsavant.client.view.genetics.variantinfo.DetailedVariantSubInspector.java
private Component getNCBIButton(final String key) { JButton ncbiButton = ViewUtil.getTexturedButton("", IconFactory.getInstance().getIcon(IconFactory.StandardIcon.LINKOUT)); //LinkButton ncbiButton = new LinkButton("NCBI"); ncbiButton.setToolTipText("Lookup " + key + " at NCBI"); ncbiButton.addActionListener(new ActionListener() { String baseUrl = "http://www.ncbi.nlm.nih.gov/SNP/snp_ref.cgi?searchType=adhoc_search&rs="; @Override// w ww .j a v a 2s. c om public void actionPerformed(ActionEvent ae) { try { URL url = new URL(baseUrl + URLEncoder.encode(p.getValue(key), URL_CHARSET)); java.awt.Desktop.getDesktop().browse(url.toURI()); } catch (Exception ex) { ClientMiscUtils.reportError("Problem launching NCBI website: %s", ex); } } }); return ncbiButton; }
From source file:org.ut.biolab.medsavant.client.view.genetics.variantinfo.DetailedVariantSubInspector.java
@Override public JPanel getInfoPanel() { if (p == null) { p = new KeyValuePairPanel(4); p.addKey(KEY_DNAID);/*from w w w .ja v a2 s. c om*/ p.addKey(KEY_ZYGOSITY); p.addKey(KEY_QUAL); p.addKey(KEY_DBSNP); p.addKey(KEY_INFO); JButton genomeBrowserButton = ViewUtil .getTexturedButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.BROWSER)); genomeBrowserButton.setToolTipText("View region in genome browser"); genomeBrowserButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { LocationController.getInstance().setLocation(selectedVariant.getChrom(), new Range((int) (selectedVariant.getStartPosition() - 20), (int) (selectedVariant.getEndPosition() + 21))); AppDirectory.launchApp(AppDirectory.BuiltInApp.GENOME_BROWSER); } }); JButton bamButton = ViewUtil .getTexturedButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.BAMFILE)); bamButton.setToolTipText("<html>Load read alignments for this<br/> sample in genome browser</html>"); bamButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { Set<AppCommHandler> handlers = AppCommRegistry.getInstance() .getHandlersForEvent(BAMFileComm.class); if (handlers.isEmpty()) { return; } String dnaID = selectedVariant.getDnaID(); String bamPath; try { bamPath = MedSavantClient.PatientManager.getReadAlignmentPathForDNAID( LoginController.getSessionID(), ProjectController.getInstance().getCurrentProjectID(), dnaID); if (bamPath != null && !bamPath.equals("")) { AppCommHandler<BAMFileComm> handler = handlers.iterator().next(); handler.handleCommEvent(new BAMFileComm(null, new URL(bamPath))); //BrowserPage.getInstance().addTrackFromURLString(bamPath, DataFormat.ALIGNMENT); //DialogUtils.displayMessage("Read alignments have been loaded into Browser. Click 'Browser' at left to view."); } } catch (Exception ex) { ClientMiscUtils.reportError("Unable to load BAM file: %s", ex); } } }); JButton geneInspectorButton = ViewUtil .getTexturedButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.INSPECTOR)); geneInspectorButton.setToolTipText("Inspect this gene"); geneInspectorButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { StaticGeneInspector.getInstance().setGene((Gene) (geneBox).getSelectedItem()); StaticInspectorPanel.getInstance().switchToGeneInspector(); } }); JLabel l = new JLabel("This will eventually show a chart"); //p.setDetailComponent(KEY_QUAL, l); final JToggleButton button = ViewUtil.getTexturedToggleButton("SHOW"); ViewUtil.makeSmall(button); button.setToolTipText("Toggle Info"); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { p.toggleDetailVisibility(KEY_INFO); button.setText(button.isSelected() ? "HIDE" : "SHOW"); } }); p.setValue(KEY_INFO, button); int col = 0; p.setAdditionalColumn(KEY_DNAID, col, KeyValuePairPanel.getCopyButton(KEY_DNAID, p)); p.setAdditionalColumn(KEY_DBSNP, col, KeyValuePairPanel.getCopyButton(KEY_DBSNP, p)); //p.setAdditionalColumn(KEY_QUAL, col, getChartButton(KEY_QUAL)); col++; p.setAdditionalColumn(KEY_DBSNP, col, getNCBIButton(KEY_DBSNP)); p.setAdditionalColumn(KEY_DNAID, col, bamButton); } return p; }
From source file:org.ut.biolab.medsavant.client.view.genetics.variantinfo.GeneManiaSubInspector.java
protected JButton[] getRowButtons(final Gene finalGene, final String kvpKey) { JButton geneInspectorButton = ViewUtil .getTexturedButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.INSPECTOR)); geneInspectorButton.setToolTipText("Inspect this gene"); geneInspectorButton.addActionListener(new ActionListener() { @Override/*from w w w. j a v a 2 s . c o m*/ public void actionPerformed(ActionEvent ae) { if (geneListener != null) { geneListener.handleEvent(finalGene); } } }); final JButton addToRegionListButton = ViewUtil .getTexturedButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.ADDKVP)); addToRegionListButton.setToolTipText("Add to Region List"); addToRegionListButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { getRegionSetsMenu(finalGene).show(addToRegionListButton, 0, addToRegionListButton.getHeight()); } }); EntrezButton geneLinkButton = new EntrezButton(finalGene.getName()); return new JButton[] { geneInspectorButton, addToRegionListButton, geneLinkButton }; }
From source file:org.ut.biolab.medsavant.client.view.notify.NotificationsPanel.java
private void refreshButtonIcons() { if (isHidden) { for (JButton menuButton : menuButtons) { menuButton.setIcon(inactiveButtonIcon); menuButton.setToolTipText("Show notifications"); }//from w w w. ja v a2 s .c om } else { for (JButton menuButton : menuButtons) { menuButton.setIcon(activeButtonIcon); menuButton.setToolTipText("Hide notifications"); } } }
From source file:org.ut.biolab.medsavant.client.view.variants.BrowserPage.java
private void setupToolbarButtons(Savant savantInstance) { // Removed temporarily 06-08-2013, in preparation for 1.1 release. /*/*w w w . j a v a2 s. co m*/ JButton button = new JButton(IconFactory.getInstance().getIcon(StandardIcon.FILTER)); button.setToolTipText("Restrict DNA IDs"); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { gsc.setLocationRelativeTo(view); gsc.setVisible(true); } }); */ JPanel pluginToolbar = savantInstance.getPluginToolbar(); // Removed temporarily 06-08-2013, in preparation for 1.1 release. // pluginToolbar.add(button); try { String buttonStyle = "segmentedCapsule"; JButton dnaButton = new JButton(IconFactory.getInstance().getIcon(StandardIcon.BAMFILE)); dnaButton.setToolTipText("Open BAM File(s)"); dnaButton.putClientProperty("JButton.buttonType", buttonStyle); dnaButton.putClientProperty("JButton.segmentPosition", "only"); dnaButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { if (isDoneMappingIdsToBAMURLs) { GenericStringChooser bamFileChooser = new GenericStringChooser(sampleIdsHavingBams, "Open BAM File(s)"); bamFileChooser.setLocationRelativeTo(view); bamFileChooser.addListener(new Listener<SelectableListView.SelectionEvent>() { @Override public void handleEvent(SelectableListView.SelectionEvent event) { List selections = event.getSelections(); for (Object o : selections) { String url = dnaIDToURLMap.get(o.toString()); addTrackFromURLString(url, DataFormat.ALIGNMENT); } } }); bamFileChooser.setVisible(true); } else { DialogUtils.displayMessage("Still collecting alignment file URLs, try again soon."); } } }); pluginToolbar.add(dnaButton); pluginToolbar.setVisible(true); } catch (Exception e) { LOG.error("ERROR ", e); } }