/** * {@inheritDoc} */ @Override public void setSelectedIndices(int... newSelectedIndices) { if(selectionChangeSupport == null) { selectionChangeSupport = new SelectionChangeSupport(this); } selectionChangeSupport.setSelectedIndices(newSelectedIndices); }
/** * {@inheritDoc} */ @Override public void addSelectionChangeListener(ISelectionChangeListener listener) { if (selectionChangeSupport == null) { selectionChangeSupport = new SelectionChangeSupport(this); } selectionChangeSupport.addSelectionChangeListener(listener); }
/** * {@inheritDoc} */ public void setSelectedIndices(int[] selectedInds, int leadingInd) { this.oldSelectedIndices = this.selectedIndices; this.selectedIndices = selectedInds; this.leadingIndex = leadingInd; fireSelectionChange(); } }
/** * {@inheritDoc} */ @Override public void selectionChange(SelectionChangeEvent evt) { boolean sourceIsScl = evt.getSource() instanceof ISelectionChangeListener; if (sourceIsScl && selectionChangeSupport == null) { selectionChangeSupport = new SelectionChangeSupport(this); } if (sourceIsScl) { selectionChangeSupport.addInhibitedListener((ISelectionChangeListener) evt.getSource()); } try { setSelectedIndices(evt.getNewSelection(), evt.getLeadingIndex()); } finally { if (sourceIsScl) { selectionChangeSupport.removeInhibitedListener((ISelectionChangeListener) evt.getSource()); } } }
/** * {@inheritDoc} */ public void setSelectedIndices(int[] selectedIndices) { int leadingInd = -1; if (selectedIndices != null && selectedIndices.length > 0) { leadingInd = selectedIndices[selectedIndices.length - 1]; } setSelectedIndices(selectedIndices, leadingInd); }
/** * {@inheritDoc} */ @Override public int[] getSelectedIndices() { if (selectionChangeSupport == null) { return new int[0]; } return selectionChangeSupport.getSelectedIndices(); }
/** * {@inheritDoc} */ @Override public void removeSelectionChangeListener(ISelectionChangeListener listener) { if (selectionChangeSupport != null) { selectionChangeSupport.removeSelectionChangeListener(listener); } }
/** * {@inheritDoc} */ @Override public void selectionChange(SelectionChangeEvent evt) { boolean isSourceScl = evt.getSource() instanceof ISelectionChangeListener; if (isSourceScl && selectionChangeSupport == null) { selectionChangeSupport = new SelectionChangeSupport(this); } if (isSourceScl) { selectionChangeSupport .addInhibitedListener((ISelectionChangeListener) evt.getSource()); } try { setSelectedIndices(evt.getNewSelection(), evt.getLeadingIndex()); } finally { if (isSourceScl) { selectionChangeSupport .removeInhibitedListener((ISelectionChangeListener) evt.getSource()); } } }
/** * {@inheritDoc} */ @Override public int[] getSelectedIndices() { if (selectionChangeSupport == null) { return new int[0]; } return selectionChangeSupport.getSelectedIndices(); }
/** * {@inheritDoc} */ @Override public void removeSelectionChangeListener(ISelectionChangeListener listener) { selectionChangeSupport.removeSelectionChangeListener(listener); }
/** * {@inheritDoc} */ @Override public void setSelectedIndices(int[] newSelectedIndices, int leadingIndex) { if(selectionChangeSupport == null) { selectionChangeSupport = new SelectionChangeSupport(this); } selectionChangeSupport.setSelectedIndices(newSelectedIndices, leadingIndex); }
/** * {@inheritDoc} */ @Override public void addSelectionChangeListener(ISelectionChangeListener listener) { if (selectionChangeSupport == null) { selectionChangeSupport = new SelectionChangeSupport(this); } selectionChangeSupport.addSelectionChangeListener(listener); }
/** * Fires a new <code>SelectionChangeEvent</code> built with * <code>source</code> as source and parameters as old and new values. */ public void fireSelectionChange() { SelectionChangeEvent evt = new SelectionChangeEvent(source, oldSelectedIndices, selectedIndices, leadingIndex); fireSelectionChange(evt); }
/** * {@inheritDoc} */ @Override public void setSelectedIndices(int[] selectedIndices, int leadingIndex) { int[] newSelectedIndices = selectedIndices; if (newSelectedIndices != null && newSelectedIndices.length == 0) { newSelectedIndices = null; } int[] oldSelectedIndices = getSelectedIndices(); if (oldSelectedIndices != null && oldSelectedIndices.length == 0) { oldSelectedIndices = null; } if (selectionChangeSupport == null) { selectionChangeSupport = new SelectionChangeSupport(this); } selectionChangeSupport.setSelectedIndices(newSelectedIndices, leadingIndex); if ((oldSelectedIndices == null && newSelectedIndices != null) || (oldSelectedIndices != null && newSelectedIndices == null) || (oldSelectedIndices != null && !Arrays.equals(oldSelectedIndices, newSelectedIndices))) { if (newSelectedIndices == null) { implFireSelectedConnectorChange(null); } else { implFireSelectedConnectorChange(getChildConnector(leadingIndex)); } } }