public void valueChanged(ListSelectionEvent lse) {
   final String S_ProcName = "valueChanged";
   ICFBamId64GenObj selectedObj;
   if (lse.getValueIsAdjusting()) {
     return;
   }
   if (dataTable == null) {
     return;
   }
   int dataRow = dataTable.getSelectedRow();
   int modelIndex = dataTable.convertRowIndexToModel(dataRow);
   PickerTableModel tblDataModel = getDataModel();
   Object selectedRowData = tblDataModel.getValueAt(modelIndex, COLID_ROW_HEADER);
   if (selectedRowData != null) {
     if (selectedRowData instanceof ICFBamId64GenObj) {
       int selectedCount = dataTable.getSelectedRowCount();
       if (selectedCount <= 0) {
         selectedObj = null;
       } else if (selectedCount == 1) {
         selectedObj = (ICFBamId64GenObj) selectedRowData;
       } else {
         selectedObj = null;
       }
     } else {
       selectedObj = null;
       throw CFLib.getDefaultExceptionFactory()
           .newUnsupportedClassException(
               getClass(), S_ProcName, "selectedRowData", selectedRowData, "ICFBamId64GenObj");
     }
   } else {
     selectedObj = null;
   }
   setSwingFocus(selectedObj);
   adjustFeedback();
 }
 public void valueChanged(ListSelectionEvent e) {
   if (e.getValueIsAdjusting() == false) {
     Object[] tcs = list.getSelectedValues();
     typeCodes = new ArrayList<String>();
     for (int i = 0; i < tcs.length; i++) {
       String typeCode = (String) tcs[i];
       typeCodes.add(typeCode);
     }
   }
 }
コード例 #3
0
ファイル: CallManager.java プロジェクト: ymatlashenko/olyo
  /**
   * Implements ListSelectionListener.valueChanged. Enables or disables call and hangup buttons
   * depending on the selection in the contactlist.
   */
  public void valueChanged(ListSelectionEvent e) {
    Object o = mainFrame.getContactListPanel().getContactList().getSelectedValue();

    if ((e.getFirstIndex() != -1 || e.getLastIndex() != -1) && (o instanceof MetaContact)) {
      setCallMetaContact(true);

      // Switch automatically to the appropriate pps in account selector
      // box and enable callButton if telephony is supported.
      Contact contact = ((MetaContact) o).getDefaultContact(OperationSetBasicTelephony.class);

      if (contact != null) {
        callButton.setEnabled(true);

        if (contact.getProtocolProvider().isRegistered())
          getAccountSelectorBox().setSelected(contact.getProtocolProvider());
      } else {
        callButton.setEnabled(false);
      }
    } else if (phoneNumberCombo.isComboFieldEmpty()) {
      callButton.setEnabled(false);
    }
  }
 public void valueChanged(ListSelectionEvent lse) {
   final String S_ProcName = "valueChanged";
   ICFSecurityISOTimezoneObj selectedObj;
   if (lse.getValueIsAdjusting()) {
     return;
   }
   if (dataTable == null) {
     return;
   }
   int dataRow = dataTable.getSelectedRow();
   int modelIndex = dataTable.convertRowIndexToModel(dataRow);
   FinderTableModel tblDataModel = getDataModel();
   Object selectedRowData = tblDataModel.getValueAt(modelIndex, COLID_ROW_HEADER);
   if (selectedRowData != null) {
     if (selectedRowData instanceof ICFSecurityISOTimezoneObj) {
       int selectedCount = dataTable.getSelectedRowCount();
       if (selectedCount <= 0) {
         selectedObj = null;
       } else if (selectedCount == 1) {
         selectedObj = (ICFSecurityISOTimezoneObj) selectedRowData;
       } else {
         selectedObj = null;
       }
     } else {
       selectedObj = null;
       throw CFLib.getDefaultExceptionFactory()
           .newUnsupportedClassException(
               getClass(),
               S_ProcName,
               "selectedRowData",
               selectedRowData,
               "ICFSecurityISOTimezoneObj");
     }
   } else {
     selectedObj = null;
   }
   Container cont = getParent();
   while ((cont != null) && (!(cont instanceof CFJInternalFrame))) {
     cont = cont.getParent();
   }
   if (cont != null) {
     CFJInternalFrame frame = (CFJInternalFrame) cont;
     if (frame instanceof ICFSecuritySwingISOTimezoneJPanelCommon) {
       ICFSecuritySwingISOTimezoneJPanelCommon jpanelCommon =
           (ICFSecuritySwingISOTimezoneJPanelCommon) frame;
       jpanelCommon.setSwingFocus(selectedObj);
     }
   }
 }