List of usage examples for javax.swing.event ListSelectionListener ListSelectionListener
ListSelectionListener
From source file:nz.govt.natlib.ndha.manualdeposit.bulkupload.BulkUploadPresenter.java
public void addJobListTableModelAndHandlers(final JTable jobListTable, final JLabel lblNoOfFiles) { theJobListTable = jobListTable;/*from ww w. j a va2 s . c o m*/ noOfFilesLabel = lblNoOfFiles; final BulkUploadTableModel resultsTableModel = new BulkUploadTableModel(); theJobListTable.setModel(resultsTableModel); theJobListTable.setSurrendersFocusOnKeystroke(true); theJobListTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); theJobListTable.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); theJobListTable.setColumnSelectionAllowed(false); theJobListTable.setRowSelectionAllowed(true); setupColumns(); final ListSelectionModel listSelectionModel = theJobListTable.getSelectionModel(); listSelectionModel.addListSelectionListener(new ListSelectionListener() { public void valueChanged(final ListSelectionEvent e) { tableRowSelected(e); } }); theJobListTable.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(final java.awt.event.MouseEvent evt) { tableMouseClicked(evt); } public void mouseReleased(final java.awt.event.MouseEvent evt) { tblJobListMouseReleased(evt); } }); try { bulkUploadManager = BulkUploadQueueManagement.create(theAppProperties, theJobListTable, uploadFrame, manualDepositParent, this); } catch (Exception ex) { uploadFrame.showError("Error creating bulk upload manager", " An error occurred while creating the bulk upload manager", ex); } }
From source file:nz.govt.natlib.ndha.manualdeposit.CMSSearchResultsPresenter.java
public void addResultsTableModelAndHandlers(final JTable theTable) { theResultsTable = theTable;//from ww w . j a v a 2 s .c o m if (theSearchType.equals(ILSQueryType.eServerType.CMS2)) { theResultsTableModel = new ResultsTableModel(CMS_2_RESULTS_COLUMN_NAMES, theSearchType); } else { theResultsTableModel = new ResultsTableModel(CMS_1_RESULTS_COLUMN_NAMES, theSearchType); } theResultsTable.setModel(theResultsTableModel); theResultsTable.setSurrendersFocusOnKeystroke(true); theResultsTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); theResultsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); theResultsTable.setColumnSelectionAllowed(false); theResultsTable.setRowSelectionAllowed(true); final ListSelectionModel theListSelectionModel = theResultsTable.getSelectionModel(); theListSelectionModel.addListSelectionListener(new ListSelectionListener() { public void valueChanged(final ListSelectionEvent e) { tableRowSelected(e); } }); theResultsTable.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(final java.awt.event.MouseEvent evt) { tableMouseClicked(evt); } }); }
From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositPresenter.java
private void loadProducersList() { try {//from w ww .j a v a 2 s .c om LOG.debug("loadProducersList, start"); DefaultListModel model; if (theProducerList.getModel() instanceof DefaultListModel) { model = (DefaultListModel) theProducerList.getModel(); model.clear(); } else { model = new DefaultListModel(); } LOG.debug("loadProducersList, Before create deposit"); IDeposit deposit = applicationProperties.getApplicationData().getDeposit(); producers = deposit.getProducers(applicationProperties.getLoggedOnUser()); LOG.debug("loadProducersList, After get list"); for (Producer data : producers) { model.addElement(data); } theProducerList.setModel(model); theProducerList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(javax.swing.event.ListSelectionEvent evt) { lstProducersValueChanged(evt); } }); theProducerList.repaint(); LOG.debug("loadProducersList, end"); } catch (Exception ex) { manualDepositFrame.showError("Error loading producers", "Unable to load producer list", ex); reportException(ex); } }
From source file:nz.govt.natlib.ndha.manualdeposit.metadata.MetaDataConfiguratorPresenter.java
public void addUserGroupHandlers(JLabel lblCleanupDirectory, JLabel lblDelay, JTextField txtCleanupDelay, JComboBox cmbCleanupType, JList lstCharacterTranslations, JComboBox cmbCharacterPosition, JTextField txtTranslateFrom, JTextField txtTranslateTo, JComboBox cmbUserGroupDesc) { theLblCleanupDirectory = lblCleanupDirectory; theLblDelay = lblDelay;/* www. ja v a2 s . c om*/ theTxtCleanupDelay = txtCleanupDelay; theCmbCleanupType = cmbCleanupType; theLstCharacterTranslations = lstCharacterTranslations; theCmbCharacterPosition = cmbCharacterPosition; theTxtTranslateFrom = txtTranslateFrom; theTxtTranslateTo = txtTranslateTo; DefaultComboBoxModel model = new DefaultComboBoxModel(); for (UserGroupData.ECleanupType cleanupType : UserGroupData.ECleanupType.values()) { model.addElement(cleanupType); } theCmbCleanupType.setModel(model); theCmbCleanupType.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmbCleanupTypeActionPerformed(evt); } }); theCmbUserGroupDesc = cmbUserGroupDesc; model = new DefaultComboBoxModel(); for (UserGroupData.UserGroupDesc userGroupDesc : UserGroupData.UserGroupDesc.values()) { model.addElement(userGroupDesc); } theCmbUserGroupDesc.setModel(model); theCmbCharacterPosition = cmbCharacterPosition; model = new DefaultComboBoxModel(); for (UserGroupData.ECharacterPosition charPosition : UserGroupData.ECharacterPosition.values()) { model.addElement(charPosition); } theCmbCharacterPosition.setModel(model); DefaultListModel translationModel = new DefaultListModel(); theLstCharacterTranslations.setModel(translationModel); loadTranslations(); theLstCharacterTranslations.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { characterTranslationValueChanged(evt); } }); theTxtTranslateFrom.addCaretListener(new javax.swing.event.CaretListener() { public void caretUpdate(javax.swing.event.CaretEvent evt) { userGroupCaretUpdate(evt); } }); theTxtTranslateTo.addCaretListener(new javax.swing.event.CaretListener() { public void caretUpdate(javax.swing.event.CaretEvent evt) { userGroupCaretUpdate(evt); } }); checkCleanupItems(); }
From source file:nz.govt.natlib.ndha.manualdeposit.metadata.MetaDataConfiguratorPresenter.java
public void addSipStatusHandlers(JList sipList) { theSipList = sipList;/*from w w w. java 2 s . co m*/ DefaultListModel model = new DefaultListModel(); theSipList.setModel(model); theSipList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { sipListValueChanged(evt); } }); }
From source file:nz.govt.natlib.ndha.manualdeposit.metadata.MetaDataConfiguratorPresenter.java
public void addMetaDataHandlers(JList dataList, JComboBox dataTypeCombo, JPanel dataLookupFrame, JList dataTypeListItems, JList cmsMappingsList, JComboBox cmsFieldCombo, JList dnxTypeList, JList dnxDetailList, JList dcTypeList, JList dcXsiList, JList dcTermsTypeList, JTabbedPane dnxDcPane) { theDataList = dataList;//from ww w. j av a 2 s .c o m theDataList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { dataListValueChanged(evt); } }); theCmbDataType = dataTypeCombo; DefaultComboBoxModel model = new DefaultComboBoxModel(); for (EDataType dataType : EDataType.values()) { model.addElement(dataType); } theCmbDataType.setModel(model); theCmbDataType.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { cmbDataTypeActionPerformed(evt); } }); theDataLookupFrame = dataLookupFrame; theDataLookupList = dataTypeListItems; DefaultListModel listModel = new DefaultListModel(); theDataLookupList.setModel(listModel); theDataLookupList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { dataLookupListValueChanged(evt); } }); theCmsMappingsList = cmsMappingsList; listModel = new DefaultListModel(); theCmsMappingsList.setModel(listModel); theCmsMappingsList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { cmsMappingListValueChanged(evt); } }); theDnxTypeList = dnxTypeList; theDnxTypeList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { dnxTypeListValueChanged(evt); } }); theCmsFieldCombo = cmsFieldCombo; tehDnxDetailList = dnxDetailList; tehDnxDetailList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { dnxDetailListValueChanged(evt); } }); theDcTypeList = dcTypeList; theDcTypeList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { dcTypeListValueChanged(evt); } }); theDcXsiList = dcXsiList; theDcXsiList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { dcXsiListValueChanged(evt); } }); theDcTermsTypeList = dcTermsTypeList; theDcTermsTypeList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { dcTermsTypeListValueChanged(evt); } }); theDnxDcPane = dnxDcPane; theDnxDcPane.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { tabDnxDcStateChanged(evt); } }); try { loadDNXValues(); } catch (Exception ex) { configuratorFrame.showError("Error loading DNX values", ex.getMessage()); } loadDCValues(); loadDCXsiValues(); loadDCTermsValues(); loadCMSFields(); }
From source file:nz.govt.natlib.ndha.manualdeposit.StructMapFileDescMgmtPresenter.java
private void addEventHandlers() { ActionListener actionDataChangedListener = new ActionListener() { public void actionPerformed(final ActionEvent evt) { dataChanged();//from w w w . j a v a2 s . c o m } }; CaretListener caretDataChangedListener = new CaretListener() { public void caretUpdate(final CaretEvent evt) { dataChanged(); } }; ItemListener itemDataChangedListener = new ItemListener() { public void itemStateChanged(final ItemEvent evt) { dataChanged(); } }; jlstDescription.addListSelectionListener(new ListSelectionListener() { public void valueChanged(final ListSelectionEvent evt) { descriptionListValueChanged(evt); } }); bttnMoveUp.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent evt) { moveItem(true); } }); bttnMoveDown.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent evt) { moveItem(false); } }); bttnAddNew.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent evt) { addItem(); } }); bttnDelete.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent evt) { deleteItem(); } }); bttnSave.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent evt) { saveFileTypes(); } }); bttnCancel.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent evt) { final int index = jlstDescription.getSelectedIndex(); loadData(index); } }); bttnClose.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent evt) { saveIfRequired(); theStructForm.closeForm(); } }); bttnGenMainDesc.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent evt) { generateMainDescription(); } }); textfldDescription.addCaretListener(caretDataChangedListener); textfldDescriptionMain.addCaretListener(caretDataChangedListener); textfldFilePrefix.addCaretListener(caretDataChangedListener); checkAllowMultiples.addActionListener(actionDataChangedListener); checkExtraLayers.addActionListener(actionDataChangedListener); checkMandatory.addActionListener(actionDataChangedListener); cmboPosition.addItemListener(itemDataChangedListener); for (Entry<String, JComponent> element : extraLayers.entrySet()) { // If name starts with "Allow" then it is a checkbox if (element.getKey().startsWith("Allow")) { JCheckBox field = (JCheckBox) element.getValue(); field.addActionListener(actionDataChangedListener); } else { JTextField field = (JTextField) element.getValue(); field.addCaretListener(caretDataChangedListener); } } }
From source file:op.care.med.structure.PnlMed.java
private java.util.List<Component> addFilters() { java.util.List<Component> list = new ArrayList<Component>(); tbIDs = GUITools.getNiceToggleButton("misc.msg.showIDs"); tbIDs.addItemListener(new ItemListener() { @Override//from w w w . ja v a 2 s .c o m public void itemStateChanged(ItemEvent e) { reload(); } }); tbIDs.setHorizontalAlignment(SwingConstants.LEFT); list.add(tbIDs); txtSuche = new JXSearchField("Suchen"); txtSuche.setFont(SYSConst.ARIAL14); txtSuche.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { txtSucheActionPerformed(actionEvent); } }); txtSuche.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent focusEvent) { SYSTools.markAllTxt(txtSuche); } }); list.add(txtSuche); lstPraep = new JList(new DefaultListModel()); lstPraep.setCellRenderer(MedProductsTools.getMedProdukteRenderer()); lstPraep.setFont(SYSConst.ARIAL14); lstPraep.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent listSelectionEvent) { lstPraepValueChanged(listSelectionEvent); } }); lstPraep.setFixedCellWidth(200); list.add(new JScrollPane(lstPraep)); return list; }
From source file:op.controlling.DlgQMSPlan.java
/** * This method is called from within the constructor to * initialize the form.//from w w w .j a v a 2s. co m * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the PrinterForm Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { pnlLeft = new JPanel(); lblTitle = new JLabel(); txtTitle = new JTextField(); lblNotify = new JideLabel(); cmbNotify = new JComboBox(); jScrollPane3 = new JScrollPane(); txtDescription = new JTextArea(); lblDescription = new JideLabel(); scrollPane1 = new JScrollPane(); lstNotify = new JList(); lblTags = new JLabel(); panel1 = new JPanel(); btnCancel = new JButton(); btnSave = new JButton(); //======== this ======== setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); Container contentPane = getContentPane(); contentPane.setLayout(new FormLayout("14dlu, $lcgap, pref:grow, $ugap, pref", "fill:14dlu, $lgap, fill:default:grow, $rgap, pref, $lgap, 14dlu")); //======== pnlLeft ======== { pnlLeft.setLayout(new FormLayout("pref, $lcgap, default:grow, $lcgap, pref, $lcgap, default:grow", "default, $lgap, fill:default, $rgap, fill:default:grow, $lgap, 40dlu, $rgap, default")); //---- lblTitle ---- lblTitle.setFont(new Font("Arial", Font.PLAIN, 18)); lblTitle.setText("Stichwort"); lblTitle.setHorizontalAlignment(SwingConstants.CENTER); pnlLeft.add(lblTitle, CC.xy(3, 1)); //---- txtTitle ---- txtTitle.setFont(new Font("Arial", Font.PLAIN, 20)); txtTitle.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { txtTitleFocusGained(e); } }); pnlLeft.add(txtTitle, CC.xy(3, 3)); //---- lblNotify ---- lblNotify.setText("text"); lblNotify.setOrientation(1); lblNotify.setFont(new Font("Arial", Font.PLAIN, 18)); lblNotify.setHorizontalAlignment(SwingConstants.CENTER); lblNotify.setClockwise(false); pnlLeft.add(lblNotify, CC.xywh(5, 3, 1, 3)); //---- cmbNotify ---- cmbNotify.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { cmbNotifyItemStateChanged(e); } }); pnlLeft.add(cmbNotify, CC.xy(7, 3)); //======== jScrollPane3 ======== { //---- txtDescription ---- txtDescription.setColumns(20); txtDescription.setLineWrap(true); txtDescription.setRows(5); txtDescription.setWrapStyleWord(true); txtDescription.setFont(new Font("Arial", Font.PLAIN, 14)); txtDescription.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { txtDescriptionFocusGained(e); } }); jScrollPane3.setViewportView(txtDescription); } pnlLeft.add(jScrollPane3, CC.xy(3, 5)); //---- lblDescription ---- lblDescription.setFont(new Font("Arial", Font.PLAIN, 18)); lblDescription.setText("Situation"); lblDescription.setOrientation(1); lblDescription.setClockwise(false); pnlLeft.add(lblDescription, CC.xy(1, 5, CC.DEFAULT, CC.CENTER)); //======== scrollPane1 ======== { //---- lstNotify ---- lstNotify.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); lstNotify.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { lstNotifyValueChanged(e); } }); scrollPane1.setViewportView(lstNotify); } pnlLeft.add(scrollPane1, CC.xy(7, 5)); //---- lblTags ---- lblTags.setFont(new Font("Arial", Font.PLAIN, 18)); lblTags.setText("Markierung"); lblTags.setHorizontalAlignment(SwingConstants.CENTER); pnlLeft.add(lblTags, CC.xywh(3, 9, 5, 1)); } contentPane.add(pnlLeft, CC.xy(3, 3)); //======== panel1 ======== { panel1.setLayout(new HorizontalLayout(5)); //---- btnCancel ---- btnCancel.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/cancel.png"))); btnCancel.setText(null); btnCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnCancelActionPerformed(e); } }); panel1.add(btnCancel); //---- btnSave ---- btnSave.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png"))); btnSave.setText(null); btnSave.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnSaveActionPerformed(e); } }); panel1.add(btnSave); } contentPane.add(panel1, CC.xy(3, 5, CC.RIGHT, CC.DEFAULT)); setSize(710, 495); setLocationRelativeTo(getOwner()); }
From source file:org.accretegb.modules.phenotype.PhenotypeInfoPanel.java
/** * populates field table data// ww w .j a va 2 s .c o m */ public void populateFieldTable() { try { List<Object[]> results = FieldDAO.getInstance().findByLocation(); getFieldTablePanel().getTable().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); if (results.size() > 0) { Utils.removeAllRowsFromTable((DefaultTableModel) getFieldTablePanel().getTable().getModel()); } DefaultTableModel model = (DefaultTableModel) getFieldTablePanel().getTable().getModel(); for (Object[] obj : results) { obj[0] = new Boolean(false); obj[1] = Integer.toString((Integer) obj[1]); model.addRow(obj); } getFieldTablePanel().getTable().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); getFieldTablePanel().getTable().setSingleSelection(true); getFieldTablePanel().getTable().setModel(model); getFieldTablePanel().getTable().getSelectionModel() .addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting() && getFieldTablePanel().getTable().getSelectedRow() != -1) { subsetListComboBox.setSelectedIndex(0); tagname.setText(""); } } }); } catch (Exception e) { } }