private void onMouseClicked(@NotNull MouseEvent e) { if (myRow < 0) { return; } Point locationOnScreen = e.getLocationOnScreen(); for (ArrangementUiComponent component : myComponents.values()) { Rectangle screenBounds = component.getScreenBounds(); if (screenBounds == null || !screenBounds.contains(locationOnScreen)) { continue; } if (component.isEnabled()) { if (component.isSelected()) { removeCondition(component); } else { addCondition(component); } } apply(); return; } }
@Nullable private Pair<ArrangementMatchCondition, ArrangementSettingsToken> buildCondition() { List<ArrangementMatchCondition> conditions = ContainerUtilRt.newArrayList(); ArrangementSettingsToken orderType = null; for (ArrangementUiComponent component : myComponents.values()) { if (!component.isEnabled() || !component.isSelected()) { continue; } ArrangementSettingsToken token = component.getToken(); if (token != null && StdArrangementTokens.Order.is(token)) { orderType = token; } else { conditions.add(component.getMatchCondition()); } } if (orderType != null && !conditions.isEmpty()) { return Pair.create( ArrangementUtil.combine( conditions.toArray(new ArrangementMatchCondition[conditions.size()])), orderType); } else { return null; } }