private boolean handleNextStep(final PopupStep nextStep, Object parentValue, InputEvent e) { if (nextStep != PopupStep.FINAL_CHOICE) { final Point point = myList.indexToLocation(myList.getSelectedIndex()); SwingUtilities.convertPointToScreen(point, myList); myChild = createPopup(this, nextStep, parentValue); if (myChild instanceof ListPopupImpl) { for (ListSelectionListener listener : myList.getListSelectionListeners()) { ((ListPopupImpl) myChild).addListSelectionListener(listener); } } final JComponent container = getContent(); assert container != null : "container == null"; int y = point.y; if (parentValue != null && getListModel().isSeparatorAboveOf(parentValue)) { SeparatorWithText swt = new SeparatorWithText(); swt.setCaption(getListModel().getCaptionAboveOf(parentValue)); y += swt.getPreferredSize().height - 1; } myChild.show(container, point.x + container.getWidth() - STEP_X_PADDING, y, true); setIndexForShowingChild(myList.getSelectedIndex()); return false; } else { setOk(true); setFinalRunnable(myStep.getFinalRunnable()); disposeAllParents(e); setIndexForShowingChild(-1); return true; } }
protected void onAutoSelectionTimer() { if (myList.getModel().getSize() > 0 && !myList.isSelectionEmpty()) { handleSelect(false); } else { disposeChildren(); setIndexForShowingChild(-1); } }
private boolean _handleSelect(final boolean handleFinalChoices, InputEvent e) { if (myList.getSelectedIndex() == -1) return false; if (getSpeedSearch().isHoldingFilter() && myList.getModel().getSize() == 0) return false; if (myList.getSelectedIndex() == getIndexForShowingChild()) { if (myChild != null && !myChild.isVisible()) setIndexForShowingChild(-1); return false; } final Object[] selectedValues = myList.getSelectedValues(); final ListPopupStep<Object> listStep = getListStep(); if (!listStep.isSelectable(selectedValues[0])) return false; if ((listStep instanceof MultiSelectionListPopupStep<?> && !((MultiSelectionListPopupStep<Object>) listStep) .hasSubstep(Arrays.asList(selectedValues)) || !listStep.hasSubstep(selectedValues[0])) && !handleFinalChoices) return false; disposeChildren(); if (myListModel.getSize() == 0) { setFinalRunnable(myStep.getFinalRunnable()); setOk(true); disposeAllParents(e); setIndexForShowingChild(-1); return true; } valuesSelected(selectedValues); final PopupStep nextStep = listStep instanceof MultiSelectionListPopupStep<?> ? ((MultiSelectionListPopupStep<Object>) listStep) .onChosen(Arrays.asList(selectedValues), handleFinalChoices) : listStep.onChosen(selectedValues[0], handleFinalChoices); return handleNextStep(nextStep, selectedValues.length == 1 ? selectedValues[0] : null, e); }
public void disposeChildren() { setIndexForShowingChild(-1); super.disposeChildren(); }