Java Code Examples for javax.swing.event.ListSelectionEvent#getValueIsAdjusting()

The following examples show how to use javax.swing.event.ListSelectionEvent#getValueIsAdjusting() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CSearchOutputPanel.java    From binnavi with Apache License 2.0 6 votes vote down vote up
@Override
public void valueChanged(final ListSelectionEvent event) {
  if (event.getValueIsAdjusting()) {
    return;
  }

  final int selectedIndex = m_table.getSelectedRow();

  if (selectedIndex == -1) {
    return;
  }

  final CSearchResult result = getTableModel().getResult(selectedIndex);

  m_hexView.uncolorizeAll();

  m_hexView.colorize(5, result.m_offset, result.m_length, Color.BLACK, Color.YELLOW);

  m_hexView.gotoOffset(result.m_offset);
}
 
Example 2
Source File: YWorklistGUI.java    From yawl with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Called whenever the value of the selection changes.
 * @param e the event that characterizes the change.
 */
public void valueChanged(ListSelectionEvent e) {
    //Ignore extra messages.
    if (e.getValueIsAdjusting()) return;
    ListSelectionModel lsm =
            (ListSelectionModel) e.getSource();
    if (!lsm.isSelectionEmpty()) {
        int selectedRow = lsm.getMinSelectionIndex();
        //selectedRow is selected
        String caseID = (String) _activeTable.getValueAt(selectedRow, 0);
        String taskID = (String) _activeTable.getValueAt(selectedRow, 1);
        if (_worklistModel.allowsDynamicInstanceCreation(caseID, taskID)) {
            _newInstanceButton.setEnabled(true);
        } else {
            _newInstanceButton.setEnabled(false);
        }
    }
}
 
Example 3
Source File: NoteTableTab.java    From dsworkbench with Apache License 2.0 6 votes vote down vote up
@Override
public void valueChanged(ListSelectionEvent e) {
    if (e.getValueIsAdjusting()) {
        int selectionCount = 0;
        if (jxNoteTable.getSelectionModel().equals(e.getSource())) {
            selectionCount = jxNoteTable.getSelectedRowCount();
            if (selectionCount != 0) {
                showInfo(selectionCount + ((selectionCount == 1) ? " Notiz gewählt" : " Notizen gewählt"));
            }
        } else {
            selectionCount = jxVillageList.getSelectedValuesList().size();
            if (selectionCount != 0) {
                showInfo(selectionCount + ((selectionCount == 1) ? " Dorf gewählt" : " Dörfer gewählt"));
            }
        }
    } else {
        if (jxNoteTable.getSelectionModel().equals(e.getSource())) {
            updateVillageList();
        }
    }
}
 
Example 4
Source File: AbilityChooserTab.java    From pcgen with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void valueChanged(ListSelectionEvent e)
{
	if (!e.getValueIsAdjusting())
	{
		int index = categoryTable.getSelectionModel().getMinSelectionIndex();
		if (index != -1)
		{
			abilityCat = (AbilityCategory) categoryTable.getValueAt(index, 0);
			this.setEnabled(abilityCat.isEditable());
			this.putValue(SHORT_DESCRIPTION,
				abilityCat.isEditable() ? null : LanguageBundle.getString("in_abCatNotEditable"));
		}

	}
}
 
Example 5
Source File: TubesConfigPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void valueChanged(ListSelectionEvent e) {
    if (!e.getValueIsAdjusting()) {
        int selectedRow = getSelectedRow();
        if (selectedRow == 0) {
            upBtn.setEnabled(false);
        } else {
            if (!upBtn.isEnabled()) {
                upBtn.setEnabled(true);
            }
        }
        if (selectedRow == tubeTableModel.getRowCount() - 1) {
            downBtn.setEnabled(false);
        } else {
            if (!downBtn.isEnabled()) {
                downBtn.setEnabled(true);
            }
        }
    }
}
 
Example 6
Source File: GrammarRulesPanel.java    From grammarviz2_src with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void valueChanged(ListSelectionEvent arg) {

  if (!arg.getValueIsAdjusting() && this.acceptListEvents) {
    int[] rows = sequiturTable.getSelectedRows();
    LOGGER.debug("Selected ROWS: " + Arrays.toString(rows));
    ArrayList<String> rules = new ArrayList<String>(rows.length);
    for (int i = 0; i < rows.length; i++) {
      int ridx = rows[i];
      String rule = String.valueOf(
          sequiturTable.getValueAt(ridx, GrammarvizRulesTableColumns.RULE_NUMBER.ordinal()));
      rules.add(rule);
    }
    this.firePropertyChange(FIRING_PROPERTY, this.selectedRules, rules);
    this.selectedRules = rules;
  }
}
 
Example 7
Source File: JListNavigator.java    From nordpos with GNU General Public License v3.0 6 votes vote down vote up
public void valueChanged(ListSelectionEvent evt) {
    
    if (!evt.getValueIsAdjusting()) {
        int i = m_jlist.getSelectedIndex();
        if (i >= 0) {
            if (!m_bd.isAdjusting()) {

                try {
                    m_bd.moveTo(i);
                } catch (BasicException eD) {
                    MessageInf msg = new MessageInf(MessageInf.SGN_NOTICE, LocalRes.getIntString("message.nomove"), eD);
                    msg.show(this);
                    // Y ahora tendriamos que seleccionar silenciosamente el registro donde estabamos.
                }
            }
            // Lo hago visible...
            Rectangle oRect = m_jlist.getCellBounds(i, i);
            m_jlist.scrollRectToVisible(oRect);       
        }
    }
}
 
Example 8
Source File: EventStreamView.java    From zap-extensions with Apache License 2.0 6 votes vote down vote up
protected ListSelectionListener getListSelectionListener() {
    return new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            // only display events when there are no more selection changes.
            if (!e.getValueIsAdjusting()) {
                int rowIndex = view.getSelectedRow();
                if (rowIndex < 0) {
                    // selection got filtered away
                    return;
                }

                EventStreamViewModel model = (EventStreamViewModel) view.getModel();

                // as we use a JTable here, that can be sorted, we have to
                // transform the row index to the appropriate model row
                int modelRow = view.convertRowIndexToModel(rowIndex);
                final ServerSentEvent event = model.getServerSentEvent(modelRow);
                readAndDisplay(event);
            }
        }
    };
}
 
Example 9
Source File: DSWorkbenchChurchFrame.java    From dsworkbench with Apache License 2.0 5 votes vote down vote up
@Override
public void valueChanged(ListSelectionEvent e) {
    if (e.getValueIsAdjusting()) {
        int selectionCount = jChurchTable.getSelectedRowCount();
        if (selectionCount != 0) {
            showInfo(selectionCount + ((selectionCount == 1) ? " Kirche gewählt" : " Kirchen gewählt"));
        }
    }
}
 
Example 10
Source File: SampleAnalysisWorkflowManagerIDTIMS.java    From ET_Redux with Apache License 2.0 5 votes vote down vote up
public void valueChanged(ListSelectionEvent evt) {
    // When the user release the mouse button and completes the selection,
    // getValueIsAdjusting() becomes false

    if (!evt.getValueIsAdjusting()) {
        JList list = (JList) evt.getSource();
        aliquotName_text.setText((String) list.getSelectedValue());

        // decide if empty else process aliquot by name
        AliquotInterface aliquot = mySample.getAliquotByName((String) list.getSelectedValue());
        if (aliquot != null) {
            if (myCurrentAliquot != null) {
                saveAliquot(myCurrentAliquot);
            }
            myCurrentAliquot = aliquot;
            initAliquot(aliquot);
            addAliquot_button.setEnabled(false);
            editAliquot_button.setEnabled(false);
        } else {
            // we got no aliquots
            fastEdits_panel.removeAll();
            fastEdits_panel.repaint();
            aliquotName_text.setText("Aliquot Name");
            addAliquot_button.setEnabled(true);
            editAliquot_button.setEnabled(false);
        }
    }
}
 
Example 11
Source File: DSWorkbenchTagFrame.java    From dsworkbench with Apache License 2.0 5 votes vote down vote up
@Override
public void valueChanged(ListSelectionEvent e) {
    if (e.getValueIsAdjusting()) {
        int selectionCount = jTagsTable.getSelectedRowCount();

        if (selectionCount != 0) {
            showInfo(selectionCount + ((selectionCount == 1) ? " Gruppe gewählt" : " Gruppen gewählt"));
        }
        updateVillageList();
    }
}
 
Example 12
Source File: AbstractSelectionNavigationAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
public void valueChanged(ListSelectionEvent e) {
	if (e.getValueIsAdjusting()) {
		return;
	}

	if (table.getSelectedRowCount() != 1) {
		return;
	}

	navigate();
}
 
Example 13
Source File: CategoryTotalPanel.java    From javamoney-examples with Apache License 2.0 5 votes vote down vote up
public
void
valueChanged(ListSelectionEvent event)
{
  if(event.getValueIsAdjusting() == false && getTable().getSelectedRow() != -1)
  {
    IncomeExpenseTotal total = getTable().get(getTable().getSelectedRow());

    // Create a new total of the same type. The identifier is not needed.
    total = new IncomeExpenseTotal(total.getType(), "");

    // Sum the selected totals.
    for(int row : getTable().getSelectedRows())
    {
      IncomeExpenseTotal temp = getTable().get(row);

      if(temp.getType().isSummary() == false)
      {
        total.setAmount(total.getAmount() + temp.getAmount());
        total.getTransactionDetails().addAll(temp.getTransactionDetails());
      }
    }

    getPieChartPanel().updateView(total);
    getTransactionDetailPanel().updateView(total.getTransactionDetails());
  }
}
 
Example 14
Source File: ToolConnectionPanel.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
public void valueChanged(ListSelectionEvent e) {
	toolDialog.setStatusText("");
	toolDialog.setConnectAllEnabled(false);
	toolDialog.setDisconnectAllEnabled(false);

	if (e.getValueIsAdjusting()) {
		return;
	}
	processSelection();
}
 
Example 15
Source File: ResultsSelectionListener.java    From HBaseClient with GNU General Public License v3.0 5 votes vote down vote up
public void valueChanged(ListSelectionEvent e) 
{
    JTable v_JTable = (JTable)XJava.getObject("xtDataList");
    
	// 如果事件非快速连续事件之一
	if ( !e.getValueIsAdjusting() )
	{
		int [] v_RowIndexArr = v_JTable.getSelectedRows();
		
		if ( v_RowIndexArr.length == 1 )
		{
		    ((JTextComponent)XJava.getObject("Edit_RowKey"))     .setText(        v_JTable.getValueAt(v_RowIndexArr[0] ,1).toString());
		    ((JComboBox)     XJava.getObject("Edit_ColumnName")) .setSelectedItem(v_JTable.getValueAt(v_RowIndexArr[0] ,3).toString());
		    ((JTextComponent)XJava.getObject("Edit_ColumnValue")).setText(        v_JTable.getValueAt(v_RowIndexArr[0] ,4).toString());
		    ((JButton)       XJava.getObject("xbCopy"))          .setEnabled(false);
		    
	        // 设置列族名下拉列表框
	        String    v_FamilyName    = v_JTable.getValueAt(v_RowIndexArr[0] ,2).toString();
	        JComboBox v_FamilyNameObj = (JComboBox)XJava.getObject("Edit_FamilyName");
	        for (int i=0; i<v_FamilyNameObj.getItemCount(); i++)
	        {
	            if ( v_FamilyNameObj.getItemAt(i).toString().equals(v_FamilyName) )
	            {
	                v_FamilyNameObj.setSelectedIndex(i);
	                return;
	            }
	        }
		}
		else
		{
		    // 多行选择的情况
		    ((JTextComponent)XJava.getObject("Edit_RowKey"))     .setText("");
		    ((JComboBox)     XJava.getObject("Edit_FamilyName")) .setSelectedIndex(0);
               ((JComboBox)     XJava.getObject("Edit_ColumnName")) .setSelectedIndex(0);
               ((JTextComponent)XJava.getObject("Edit_ColumnValue")).setText("");
               ((JButton)       XJava.getObject("xbCopy"))          .setEnabled(this.getAppFrame().getSelectColCount() >= 2);
		}
	}
}
 
Example 16
Source File: VillageSelectionPanel.java    From dsworkbench with Apache License 2.0 5 votes vote down vote up
@Override
public void valueChanged(ListSelectionEvent e) {
    if (active && (e == null || !e.getValueIsAdjusting())) {
        outputList.setListData(filter());
        updateOutputSelection();
    }
}
 
Example 17
Source File: AndroidPlatformCustomizer.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
@Override
public void valueChanged(ListSelectionEvent e) {
    if (!e.getValueIsAdjusting()) {
        AndroidPlatformInfo.PathRecord selectedValue1 = (AndroidPlatformInfo.PathRecord) sourcesList.getSelectedValue();
        removeSources.setEnabled(selectedValue1 == null ? false : selectedValue1.isUserRecord());
    }
}
 
Example 18
Source File: TaskPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void valueChanged (ListSelectionEvent e) {
    if (!e.getValueIsAdjusting() && e.getSource() == component) {
        fieldModified();
    }
}
 
Example 19
Source File: ArrangementMatchingRulesControl.java    From consulo with Apache License 2.0 4 votes vote down vote up
private void onSelectionChange(@Nonnull ListSelectionEvent e) {
  if (mySkipSelectionChange || e.getValueIsAdjusting()) {
    return;
  }
  refreshEditor();
}
 
Example 20
Source File: RevisionDialogController.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void valueChanged (ListSelectionEvent e) {
    if (!e.getValueIsAdjusting() && e.getSource() == panel.lstBranches) {
        selectedBranchChanged();
    }
}