List of usage examples for javax.swing.event ListSelectionEvent getValueIsAdjusting
public boolean getValueIsAdjusting()
From source file:jboost.visualization.HistogramFrame.java
private JScrollPane getJScrollPane1() { if (jScrollPane1 == null) { jScrollPane1 = new JScrollPane(); jList1 = new JList(infoParser.iterNoList); jList1.setLayout(new FlowLayout()); jList1.setFocusable(false);//from ww w. ja v a 2 s.c o m jList1.setIgnoreRepaint(false); jList1.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { if (!evt.getValueIsAdjusting()) { JList list = (JList) evt.getSource(); iter = list.getSelectedIndex(); loadIteration(iter); } } }); jScrollPane1.getViewport().add(jList1); } return jScrollPane1; }
From source file:com.ibm.soatf.gui.SOATestingFrameworkGUI.java
private void jlInterfacesValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jlInterfacesValueChanged if (evt.getValueIsAdjusting()) { return;// ww w . jav a2 s. c o m } interfaceSelection(evt); }
From source file:edu.ku.brc.specify.tasks.subpane.LocalityMapperSubPane.java
/** * *///from w w w . ja va2 s . c o m protected void createUI() { kmlGen = new CollectingEventLocalityKMLGenerator(); this.collectingEvents = new ArrayList<CollectingEvent>(); CollectingEvent startCE = null; CollectingEvent endCE = null; Vector<Locality> localities = new Vector<Locality>(); Vector<String> labels = new Vector<String>(); for (Object obj : colEvents) { CollectingEvent collectingEvent = (CollectingEvent) obj; Locality locality = collectingEvent.getLocality(); if (locality == null || locality.getLatitude1() == null || locality.getLongitude1() == null) { continue; } collectingEvents.add(collectingEvent); kmlGen.addDataObj(collectingEvent, ""); if (collectingEvents.size() == 1) { startCE = collectingEvent; endCE = collectingEvent; } // XXX TODO FIX ME! if (startCE == null || endCE == null) { return; } // There may be an End Date that is further out than than the End Date of the last item // with the latest Start Date if (startCE.getStartDate().compareTo(collectingEvent.getStartDate()) > 1) { startCE = collectingEvent; } Calendar leftCal = endCE.getEndDate() != null ? endCE.getEndDate() : endCE.getStartDate(); Calendar rightCal = collectingEvent.getEndDate() != null ? collectingEvent.getEndDate() : collectingEvent.getStartDate(); if (leftCal.compareTo(rightCal) < 0) { endCE = collectingEvent; } Hashtable<String, Object> map = new Hashtable<String, Object>(); Set<CollectionObject> colObjs = collectingEvent.getCollectionObjects(); map.put("startDate", collectingEvent.getStartDate()); map.put("endDate", collectingEvent.getEndDate()); Set<Object> taxonNames = new HashSet<Object>(); for (CollectionObject co : colObjs) { for (Determination d : co.getDeterminations()) { if (d.isCurrentDet()) { //System.out.println(d.getTaxon().getName() + "("+co.getCountAmt()+")"); Taxon taxon = d.getPreferredTaxon(); if (taxon != null) { taxonNames.add(taxon.getName() + (co.getCountAmt() != null ? " (" + co.getCountAmt() + ")" : "")); if (taxon.getRankId() == 220) { Taxon genus = taxon.getParent(); if (genus.getRankId() == 180) { ImageGetter imgGetter = new ImageGetter(imageGetterList, imageMap, imageURLs, genus.getName(), taxon.getName()); imageGetterList.add(imgGetter); } } } break; } } } map.put("taxonItems", taxonNames); map.put("latitude1", locality.getLatitude1()); map.put("longitude1", locality.getLongitude1()); /* Calendar cal = collectingEvent.getStartDate(); if (cal != null) { labels.add(scrDateFormat.format(cal.getTime())); } else if (collectingEvent.getVerbatimDate() != null) { labels.add(collectingEvent.getVerbatimDate()); } else { labels.add(Integer.toString(collectingEvent.getCollectingEventId())); } */ labels.add(Integer.toString(collectingEvents.size())); localities.add(locality); valueList.add(map); } // XXX Fix me shouldn't be hard coded here to make it work localityMapper.setMaxMapWidth(515); localityMapper.setMaxMapHeight(375); Color arrow = new Color(220, 220, 220); localityMapper.setArrowColor(arrow); localityMapper.setDotColor(Color.WHITE); localityMapper.setDotSize(4); localityMapper.setLabelColor(Color.RED); int inx = 0; for (Locality locality : localities) { localityMapper.addLocationAndLabel(locality, labels != null ? labels.get(inx) : null); inx++; } localityMapper.setCurrentLoc(localities.get(0)); localityMapper.setCurrentLocColor(Color.RED); // XXX DEMO (Hard Coded 'null' means everyone would have one which may not be true) // "null" ViewSet name means it should use the default ViewIFace view = AppContextMgr.getInstance().getView("LocalityMapper"); // TODO WHERE's the ERROR checking ! multiView = new MultiView(null, null, view, AltViewIFace.CreationMode.VIEW, MultiView.NO_OPTIONS); multiView.setBorder( BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(new Color(138, 128, 128)), BorderFactory.createEmptyBorder(4, 4, 4, 4))); formViewObj = multiView.getCurrentViewAsFormViewObj(); formViewObj.getUIComponent().setBackground(Color.WHITE); imageJList = formViewObj.getCompById("taxonItems"); imageJList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { String nameStr = (String) imageJList.getSelectedValue(); if (nameStr != null) { int index = nameStr.indexOf(" ("); if (index > -1) { nameStr = nameStr.substring(0, index); } } //System.out.println("Getting["+name+"]"); Image img = null; if (StringUtils.isNotEmpty(nameStr)) { img = imageMap.get(nameStr); // might return null ImageDisplay imgDisplay = formViewObj.getCompById("image"); if (img != null) { imgDisplay.setImage(new ImageIcon(img)); } else { imgDisplay.setImage((Image) null); } } } } }); // XXX TODO FIX ME! if (startCE == null || endCE == null) { return; } String startDateStr = scrDateFormat.format(startCE.getStartDate().getTime()); String endDateStr = scrDateFormat .format((endCE.getEndDate() != null ? endCE.getEndDate() : endCE.getStartDate()).getTime()); Formatter formatter = new Formatter(); titleLabel.setText(formatter .format(getResourceString("LocalityMapperTitle"), new Object[] { startDateStr, endDateStr }) .toString()); Font font = titleLabel.getFont(); titleLabel.setFont(new Font(font.getFontName(), Font.BOLD, font.getSize() + 2)); recordSetController = new ResultSetController(null, false, false, false, null, collectingEvents.size(), true); recordSetController.addListener(this); recordSetController.getPanel().setBackground(Color.WHITE); controlPanel = new ControlBarPanel(getBackground()); controlPanel.add(recordSetController.getPanel()); controlPanel.setRecordSetController(recordSetController); controlPanel.setBackground(Color.WHITE); googleBtn = new JButton(IconManager.getIcon("GoogleEarth", IconManager.STD_ICON_SIZE)); googleBtn.setMargin(new Insets(1, 1, 1, 1)); googleBtn.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); googleBtn.setSize(new Dimension(18, 18)); googleBtn.setPreferredSize(new Dimension(18, 18)); googleBtn.setMaximumSize(new Dimension(18, 18)); googleBtn.setFocusable(false); googleBtn.setBackground(Color.WHITE); controlPanel.addButtons(new JButton[] { googleBtn }, false); googleBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { try { UIRegistry.displayStatusBarText("Exporting Collecting Events in KML."); // XXX I18N kmlGen.setSpeciesToImageMapper(imageURLs); kmlGen.outputToFile(System.getProperty("user.home") + File.separator + "specify.kml"); } catch (Exception ex) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(LocalityMapperSubPane.class, ex); ex.printStackTrace(); } } }); addMouseMotionListener(new MouseMotionListener() { public void mouseDragged(MouseEvent e) { // nothing } public void mouseMoved(MouseEvent e) { checkMouseLocation(e.getPoint(), false); } }); addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { checkMouseLocation(e.getPoint(), true); } }); SwingUtilities.invokeLater(new Runnable() { public void run() { getLocalityMap(); } }); }
From source file:com.diversityarrays.kdxplore.importdata.ImportSourceChoiceDialog.java
public ImportSourceChoiceDialog(SourceChoice sc, Window owner, KdxploreDatabase kdxdb, MessagePrinter mp, Closure<List<Trial>> onTrialsLoaded, BackgroundRunner backgroundRunner) throws IOException, KdxploreConfigException { super(owner, "Load Trial Data", ModalityType.APPLICATION_MODAL); this.sourceChoice = sc; this.kdxDatabase = kdxdb; this.databaseDeviceIdentifier = kdxDatabase.getDatabaseDeviceIdentifier(); this.database = kdxDatabase.getKDXploreKSmartDatabase(); this.backgroundRunner = backgroundRunner; this.messagePrinter = new CompoundMessagePrinter(mp, messagePanel); this.onTrialsLoaded = onTrialsLoaded; DevicesAndOperators devsAndOps = new DevicesAndOperators(System.getProperty("user.name")); //$NON-NLS-1$ devAndOpPanel = new DeviceAndOperatorPanel(kdxdb, devsAndOps, true); devAndOpPanel.addChangeListener(devAndOpChangeListener); // Note: devAndOpPanel.initialise() is done in WindowListener.windowOpened() below StringBuilder sb = new StringBuilder("Drag/Drop "); ImportType[] tmp = null;//from ww w . j a v a 2 s . c om switch (sourceChoice) { case CSV: predicate = new Predicate<DeviceIdentifier>() { @Override public boolean evaluate(DeviceIdentifier devid) { return devid != null && DeviceIdentifier.PLEASE_SELECT_DEVICE_TYPE != devid.getDeviceType(); } }; sb.append("CSV"); tmp = new ImportType[] { ImportType.CSV }; break; case KDX: predicate = new Predicate<DeviceIdentifier>() { @Override public boolean evaluate(DeviceIdentifier devid) { if (devid == null || DeviceIdentifier.PLEASE_SELECT_DEVICE_TYPE == devid.getDeviceType()) { return false; } return DeviceType.KDSMART.equals(devid.getDeviceType()); } }; sb.append(".KDX"); tmp = new ImportType[] { ImportType.KDX }; break; case XLS: devAndOpPanel.disableAddDevice(); predicate = new Predicate<DeviceIdentifier>() { @Override public boolean evaluate(DeviceIdentifier devid) { if (devid == null || DeviceIdentifier.PLEASE_SELECT_DEVICE_TYPE == devid.getDeviceType()) { return false; } return DeviceType.DATABASE.equals(devid.getDeviceType()); } }; sb.append("Excel"); tmp = new ImportType[] { ImportType.KDXPLORE_EXCEL, ImportType.BMS_EXCEL }; break; case DATABASE: default: throw new IllegalStateException("sourceChoice=" + sourceChoice.name()); } importTypes = tmp; if (importTypes == null) { throw new IllegalArgumentException(sourceChoice.name()); } sb.append(" files here"); String prompt = sb.toString(); setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); Container cp = getContentPane(); PromptScrollPane pscrollPane = new PromptScrollPane(fileImportTable, prompt); pscrollPane.setTransferHandler(flth); fileImportTable.setTransferHandler(flth); fileImportTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // fileImportTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); fileImportTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { updateImportAction(); } } }); final JSplitPane vSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, pscrollPane, messagePanel); updateImportAction(); Box buttons = Box.createHorizontalBox(); buttons.add(Box.createHorizontalStrut(4)); buttons.add(new JButton(importAction)); buttons.add(Box.createHorizontalGlue()); buttons.add(errorMessage); buttons.add(Box.createHorizontalGlue()); buttons.add(new JButton(browseAction)); buttons.add(Box.createHorizontalStrut(4)); errorMessage.setForeground(Color.RED); JPanel top = new JPanel(); GBH gbh = new GBH(top, 2, 2, 2, 2); int y = 0; gbh.add(0, y, 1, 1, GBH.BOTH, 1, 1, GBH.CENTER, devAndOpPanel); ++y; if (RunMode.getRunMode().isDeveloper()) { // Only Developer gets to see the Excel options panel (for now). gbh.add(0, y, 3, 1, GBH.BOTH, 2, 2, GBH.CENTER, bmsOptionsPanel); ++y; } gbh.add(0, y, 3, 1, GBH.HORZ, 1, 1, GBH.CENTER, buttons); ++y; cp.add(top, BorderLayout.NORTH); cp.add(vSplit, BorderLayout.CENTER); pack(); GuiUtil.centreOnOwner(ImportSourceChoiceDialog.this); addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent e) { vSplit.setDividerLocation(0.5); // NO_BMS bmsOptionsPanel.setVisible(false /* SourceChoice.XLS == sourceChoice */); List<Pair<String, Exception>> errors = devAndOpPanel.initialise(predicate); if (errors.isEmpty()) { List<String> kdxFileNamesWithoutSuffix = new ArrayList<>(); for (int rowIndex = fileImportTableModel.getRowCount(); --rowIndex >= 0;) { File file = fileImportTableModel.getFileAt(rowIndex); String fname = file.getName(); int dotpos = fname.lastIndexOf('.'); if (dotpos > 0) { String sfx = fname.substring(dotpos); if (ExportFor.KDX_SUFFIX.equalsIgnoreCase(sfx)) { kdxFileNamesWithoutSuffix.add(fname.substring(0, dotpos)); } } } if (!kdxFileNamesWithoutSuffix.isEmpty()) { devAndOpPanel.selectInitialDeviceIdentifier(kdxFileNamesWithoutSuffix); } } else { for (Pair<String, Exception> pair : errors) { messagePrinter.println(pair.first + ":"); messagePrinter.println(pair.second.getMessage()); } } } @Override public void windowClosing(WindowEvent e) { if (busy) { GuiUtil.beep(); } else { dispose(); } } }); }
From source file:edu.ku.brc.ui.tmanfe.SearchReplacePanel.java
/** * detects when a table changes has been made and changes the next, previous buttons, as well as * clears the status label. //w w w. j ava 2 s . c o m */ public void handleTableSelections() { listSelectionListener = new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { nextButton.setEnabled(true); previousButton.setEnabled(true); updateStatusLabel(-1, false); } } }; table.getSelectionModel().addListSelectionListener(listSelectionListener); }
From source file:de.tor.tribes.ui.views.DSWorkbenchDoItYourselfAttackPlaner.java
@Override public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) { int selectionCount = jAttackTable.getSelectedRowCount(); if (selectionCount != 0) { showInfo(selectionCount + ((selectionCount == 1) ? " Angriff gewhlt" : " Angriffe gewhlt")); }/*from w w w . j av a 2s . c o m*/ } }
From source file:edu.ku.brc.specify.plugins.ipadexporter.iPadDBExporterPlugin.java
/** * //from w w w . j a va 2s.c o m */ private void removeDataset() { Institution inst = iPadDBExporter.getCurrentInstitution(); List<Pair<String, String>> list = iPadCloud.getDatasetList(inst.getGuid()); if (list != null && list.size() > 0) { CellConstraints cc = new CellConstraints(); final JList<String> dsList = new JList<String>(new DSListModel(list)); PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g", "p,4px,f:p:g")); pb.add(UIHelper.createI18NLabel("Choose a Dataset to remove"), cc.xy(1, 1)); pb.add(dsList, cc.xy(1, 3)); pb.setDefaultDialogBorder(); final CustomDialog dlg = new CustomDialog((Frame) getMostRecentWindow(), "Remove Collection", true, pb.getPanel()); dsList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { dlg.getOkBtn().setEnabled(!dsList.isSelectionEmpty()); } } }); dlg.setPreferredSize(new Dimension(300, 400)); dlg.createUI(); dlg.getOkBtn().setEnabled(false); centerAndShow(dlg, 300, 400); if (!dlg.isCancelled()) { String collectionGUID = list.get(dsList.getSelectedIndex()).first; if (StringUtils.isNotEmpty(collectionGUID)) { if (iPadCloud.removeDataSet(collectionGUID)) { enableRemoveDatasetBtn(); UIRegistry.writeTimedSimpleGlassPaneMsg("The dataset was removed."); } else { UIRegistry.writeTimedSimpleGlassPaneMsg("The dataset was not removed."); } } } return; } UIRegistry.showError("You do not have Datasets to remove."); // should not get here }
From source file:com.floreantpos.ui.views.order.OrderView.java
private void addActionButtonPanel() { ticketView.getTicketViewerTable().getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override//w w w .ja va 2 s. co m public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { handleTicketItemSelection(); } } }); btnDone.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { ticketView.doFinishOrder(); } catch (StaleObjectStateException x) { POSMessageDialog.showError(Application.getPosWindow(), Messages.getString("TicketView.22")); //$NON-NLS-1$ return; } catch (PosException x) { POSMessageDialog.showError(x.getMessage()); } catch (Exception x) { POSMessageDialog.showError(Application.getPosWindow(), POSConstants.ERROR_MESSAGE, x); } } }); btnCancel.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { if (ticketView.isCancelable()) { ticketView.doCancelOrder(); return; } int result = POSMessageDialog.showYesNoQuestionDialog(null, "Items have been sent to kitchen, are you sure to cancel this ticket?", "Confirm"); if (result != JOptionPane.YES_OPTION) { return; } ticketView.doCancelOrder(); ticketView.setAllowToLogOut(true); } }); btnSend.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { ticketView.sendTicketToKitchen(); ticketView.updateView(); POSMessageDialog.showMessage("Items sent to kitchen"); } catch (StaleObjectStateException x) { POSMessageDialog.showError(Application.getPosWindow(), Messages.getString("TicketView.22")); //$NON-NLS-1$ return; } catch (PosException x) { POSMessageDialog.showError(x.getMessage()); } catch (Exception x) { POSMessageDialog.showError(Application.getPosWindow(), POSConstants.ERROR_MESSAGE, x); } } }); btnOrderType.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { // doViewOrderInfo(); //doChangeOrderType(); fix } }); btnCustomer.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { doAddEditCustomer(); } }); btnMisc.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { doInsertMisc(evt); } }); btnGuestNo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnCustomerNumberActionPerformed(); } }); btnSeatNo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { doAddSeatNumber(); } }); btnTableNumber.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { updateTableNumber(); } }); btnCookingInstruction.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doAddCookingInstruction(); } }); btnHold.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { OrderType orderType = currentTicket.getOrderType(); if (orderType.isShowTableSelection() && orderType.isRequiredCustomerData()//fix && !Application.getCurrentUser().hasPermission(UserPermission.HOLD_TICKET)) { // String password = PasswordEntryDialog.show(Application.getPosWindow(), "Please enter privileged password"); if (StringUtils.isEmpty(password)) { return; } User user2 = UserDAO.getInstance().findUserBySecretKey(password); if (user2 == null) { POSMessageDialog.showError(Application.getPosWindow(), "No user found with that secret key"); return; } else { if (!user2.hasPermission(UserPermission.HOLD_TICKET)) { POSMessageDialog.showError(Application.getPosWindow(), "No permission"); return; } } } if (!currentTicket.isBarTab() && (ticketView.getTicket().getTicketItems() == null || ticketView.getTicket().getTicketItems().size() == 0)) { POSMessageDialog.showError(com.floreantpos.POSConstants.TICKET_IS_EMPTY_); return; } ticketView.doHoldOrder(); ticketView.setAllowToLogOut(true); } }); // btnAddOn.addActionListener(new ActionListener() { // @Override // public void actionPerformed(ActionEvent e) { // doAddAddOn(); // } // }); btnDiscount.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { addDiscount(); } }); actionButtonPanel.add(btnOrderType); actionButtonPanel.add(btnCustomer); actionButtonPanel.add(btnTableNumber); actionButtonPanel.add(btnGuestNo); actionButtonPanel.add(btnSeatNo); actionButtonPanel.add(btnCookingInstruction); // actionButtonPanel.add(btnAddOn); actionButtonPanel.add(btnMisc); actionButtonPanel.add(btnHold); actionButtonPanel.add(btnSend); actionButtonPanel.add(btnCancel); actionButtonPanel.add(btnDone); btnCookingInstruction.setEnabled(false); // btnAddOn.setEnabled(false); }
From source file:com.diversityarrays.kdxplore.specgroup.SpecimenGroupEditor.java
private JComponent createTopComponent(Action extraAction) { // refreshSpecimenList.setEnabled(false); loadAction.setEnabled(true);/*from w w w .ja v a 2s .co m*/ Box specimenGroupControls = Box.createHorizontalBox(); specimenGroupControls.add(downloadGroupsButton); if (extraAction != null) { specimenGroupControls.add(new JButton(extraAction)); } specimenGroupControls.add(new JSeparator(JSeparator.VERTICAL)); // specimenGroupControls.add(new JButton(refreshSpecimenList)); specimenGroupControls.add(new JButton(loadAction)); specimenGroupTableModel = new SpecimenGroupTableModel(); specimenGroupTable = new JTable(specimenGroupTableModel); specimenGroupTable.setAutoCreateRowSorter(true); TableTransferHandler tth = TableTransferHandler.initialiseForCopySelectAll(specimenGroupTable, true); specimenGroupTable.setTransferHandler(tth); PromptScrollPane pane = new PromptScrollPane("No Specimen Groups Found"); pane.add(specimenGroupTable); specimenGroupTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); specimenGroupTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { List<Specimen> list = null; int vrow = specimenGroupTable.getSelectedRow(); if (vrow >= 0) { int mrow = specimenGroupTable.convertRowIndexToModel(vrow); if (mrow >= 0) { list = specimenGroupTableModel.getSpecimensAt(mrow); } } specimenTableModel.setData(list); } } }); JPanel containerPanel = new JPanel(new BorderLayout()); containerPanel.add(specimenGroupControls, BorderLayout.NORTH); containerPanel.add(new TitledTablePanel("Specimen Groups", specimenGroupTable, "No Specimen Groups Loaded"), BorderLayout.CENTER); return containerPanel; }
From source file:com.github.lindenb.jvarkit.tools.bamviewgui.BamFileRef.java
BamInternalFrame(BamFileRef ref) { super(ref.bamFile.getName(), true, false, true, true); this.ref = ref; JPanel mainPane = new JPanel(new BorderLayout(5, 5)); setContentPane(mainPane);//w ww . j a v a2 s .c o m JTabbedPane tabbedPane = new JTabbedPane(); mainPane.add(tabbedPane, BorderLayout.CENTER); JPanel pane = new JPanel(new BorderLayout(5, 5)); tabbedPane.addTab("BAM", pane); this.tableModel = new BamTableModel(); this.jTable = createTable(tableModel); this.jTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); this.jTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane scroll1 = new JScrollPane(this.jTable); this.infoTableModel = new FlagTableModel(); JTable tInfo = createTable(this.infoTableModel); this.genotypeTableModel = new SAMTagAndValueModel(); JTable tGen = createTable(this.genotypeTableModel); this.groupTableModel = new ReadGroupTableModel(); JTable tGrp = createTable(this.groupTableModel); JPanel splitH = new JPanel(new GridLayout(1, 0, 5, 5)); splitH.add(new JScrollPane(tInfo)); splitH.add(new JScrollPane(tGen)); splitH.add(new JScrollPane(tGrp)); JSplitPane splitVert = new JSplitPane(JSplitPane.VERTICAL_SPLIT, scroll1, splitH); this.jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) return; int row = jTable.getSelectedRow(); SAMRecord ctx; if (row == -1 || (ctx = tableModel.getElementAt(row)) == null) { infoTableModel.setContext(null); genotypeTableModel.setContext(null); groupTableModel.setContext(null); } else { infoTableModel.setContext(ctx); genotypeTableModel.setContext(ctx); groupTableModel.setContext(ctx); } } }); pane.add(splitVert); //header as text pane = new JPanel(new BorderLayout(5, 5)); tabbedPane.addTab("Header", pane); JTextArea area = new JTextArea(String.valueOf(ref.header.getTextHeader())); area.setCaretPosition(0); area.setEditable(false); pane.add(new JScrollPane(area), BorderLayout.CENTER); //dict pane = new JPanel(new BorderLayout(5, 5)); tabbedPane.addTab("Reference", pane); JTable dictTable = createTable(new SAMSequenceDictionaryTableModel(ref.header.getSequenceDictionary())); dictTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); pane.add(new JScrollPane(dictTable), BorderLayout.CENTER); this.selList = new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) return; listSelectionChanged(); } }; this.addInternalFrameListener(new InternalFrameAdapter() { @Override public void internalFrameActivated(InternalFrameEvent e) { jTable.getSelectionModel().addListSelectionListener(selList); } @Override public void internalFrameDeactivated(InternalFrameEvent e) { jTable.getSelectionModel().removeListSelectionListener(selList); } }); }