public boolean isActive() { if (this == ComponentState.ENABLED) return false; if (!this.isFacetActive(ComponentStateFacet.ENABLE)) return false; return true; }
/** * Checks whether this state is disabled. A disabled state has * {@link ComponentStateFacet#ENABLE} facet in its <code>off</code> set. * * @return <code>true</code> if this state is disabled, <code>false</code> * otherwise. */ public boolean isDisabled() { return !this.isFacetActive(ComponentStateFacet.ENABLE); }
public boolean isActive() { if (this == ComponentState.ENABLED) return false; if (!this.isFacetActive(ComponentStateFacet.ENABLE)) return false; return true; }
/** * Checks whether this state is disabled. A disabled state has * {@link ComponentStateFacet#ENABLE} facet in its <code>off</code> set. * * @return <code>true</code> if this state is disabled, <code>false</code> * otherwise. */ public boolean isDisabled() { return !this.isFacetActive(ComponentStateFacet.ENABLE); }
public float getFacetStrength(ComponentStateFacet stateFacet) { float result = 0.0f; for (Map.Entry<ComponentState, StateContributionInfo> activeEntry : this.modelStateInfo.stateContributionMap .entrySet()) { ComponentState activeState = activeEntry.getKey(); if (activeState.isFacetActive(stateFacet)) { result += activeEntry.getValue().getContribution(); } } return result; }
@Override public void focusLost(FocusEvent e) { if (focusedCellId == null) return; ComponentState cellState = getCellState(focusedCellId); StateTransitionTracker tracker = getTracker(focusedCellId, cellState.isFacetActive(ComponentStateFacet.ROLLOVER), cellState.isFacetActive(ComponentStateFacet.SELECTION)); tracker.setFocusState(false); focusedCellId = null; }
public float getFacetStrength(ComponentStateFacet stateFacet) { float result = 0.0f; for (Map.Entry<ComponentState, StateContributionInfo> activeEntry : this.modelStateInfo.stateContributionMap .entrySet()) { ComponentState activeState = activeEntry.getKey(); if (activeState.isFacetActive(stateFacet)) { result += activeEntry.getValue().getContribution(); } } return result; }
@Override public void focusLost(FocusEvent e) { if (focusedCellId == null) return; ComponentState cellState = getCellState(focusedCellId); StateTransitionTracker tracker = getTracker(focusedCellId, cellState.isFacetActive(ComponentStateFacet.ROLLOVER), cellState.isFacetActive(ComponentStateFacet.SELECTION)); tracker.setFocusState(false); focusedCellId = null; }
/** * Initiates the fade out effect on the specific day. */ private void fadeOutDay() { if (rolloverDateId == null) return; StateTransitionTracker tracker = getDayTracker(rolloverDateId, true, getDayState(rolloverDateId.day, rolloverDateId.month, rolloverDateId.year).isFacetActive( ComponentStateFacet.SELECTION)); tracker.getModel().setRollover(false); }
/** * Initiates the fade out effect. */ private void fadeOutRollover(TableCellId tableCellId) { if (rolledOverIndices.contains(tableCellId)) { // System.out // .println("Getting rollover/out tracker for " + cellId); StateTransitionTracker tracker = getTracker(tableCellId, true, getCellState(tableCellId).isFacetActive( ComponentStateFacet.SELECTION)); tracker.getModel().setRollover(false); } }
/** * Initiates the fade out effect. */ private void fadeOutRollover(TableCellId tableCellId) { if (rolledOverIndices.contains(tableCellId)) { // System.out // .println("Getting rollover/out tracker for " + cellId); StateTransitionTracker tracker = getTracker( tableCellId, true, getCellState(tableCellId).isFacetActive( ComponentStateFacet.SELECTION)); tracker.getModel().setRollover(false); } }
/** * Initiates the fade out effect on the specific month. */ private void fadeOutMonth() { if (rolloverDateId == null) return; StateTransitionTracker tracker = getMonthTracker(new MonthId( rolloverDateId.month, rolloverDateId.year), true, getMonthState(rolloverDateId.month, rolloverDateId.year) .isFacetActive(ComponentStateFacet.SELECTION)); tracker.getModel().setRollover(false); } }
private SubstanceColorScheme getColorSchemeForState(JList list, int index, SubstanceListUI listUI, ComponentState state) { boolean toUseHighlightKindForCurrState = (index >= 0) && (state.isFacetActive(ComponentStateFacet.ROLLOVER) || state .isFacetActive(ComponentStateFacet.SELECTION)); UpdateOptimizationInfo updateOptimizationInfo = listUI .getUpdateOptimizationInfo(); if (toUseHighlightKindForCurrState) { if (updateOptimizationInfo == null) { return SubstanceColorSchemeUtilities.getColorScheme(list, ColorSchemeAssociationKind.HIGHLIGHT, state); } else { return updateOptimizationInfo.getHighlightColorScheme(state); } } else { if (updateOptimizationInfo == null) { return SubstanceColorSchemeUtilities .getColorScheme(list, state); } else { return updateOptimizationInfo.getDefaultScheme(); } } }
@Override public void focusGained(FocusEvent e) { int rowLead = table.getSelectionModel().getLeadSelectionIndex(); int colLead = table.getColumnModel().getSelectionModel() .getLeadSelectionIndex(); if ((rowLead >= 0) && (colLead >= 0)) { TableCellId toFocus = new TableCellId(rowLead, colLead); if (toFocus.equals(focusedCellId)) return; ComponentState cellState = getCellState(toFocus); StateTransitionTracker tracker = getTracker( toFocus, cellState .isFacetActive(ComponentStateFacet.ROLLOVER), cellState .isFacetActive(ComponentStateFacet.SELECTION)); tracker.setFocusState(true); focusedCellId = toFocus; } } };
private SubstanceColorScheme getColorSchemeForState(JList list, int index, SubstanceListUI listUI, ComponentState state) { boolean toUseHighlightKindForCurrState = (index >= 0) && (state.isFacetActive(ComponentStateFacet.ROLLOVER) || state .isFacetActive(ComponentStateFacet.SELECTION)); UpdateOptimizationInfo updateOptimizationInfo = listUI .getUpdateOptimizationInfo(); if (toUseHighlightKindForCurrState) { if (updateOptimizationInfo == null) { return SubstanceColorSchemeUtilities.getColorScheme(list, ColorSchemeAssociationKind.HIGHLIGHT, state); } else { return updateOptimizationInfo.getHighlightColorScheme(state); } } else { if (updateOptimizationInfo == null) { return SubstanceColorSchemeUtilities .getColorScheme(list, state); } else { return updateOptimizationInfo.getDefaultScheme(); } } }
@Override public void focusGained(FocusEvent e) { int rowLead = table.getSelectionModel().getLeadSelectionIndex(); int colLead = table.getColumnModel().getSelectionModel() .getLeadSelectionIndex(); if ((rowLead >= 0) && (colLead >= 0)) { TableCellId toFocus = new TableCellId(rowLead, colLead); if (toFocus.equals(focusedCellId)) return; ComponentState cellState = getCellState(toFocus); StateTransitionTracker tracker = getTracker( toFocus, cellState .isFacetActive(ComponentStateFacet.ROLLOVER), cellState .isFacetActive(ComponentStateFacet.SELECTION)); tracker.setFocusState(true); focusedCellId = toFocus; } } };
private ComponentState getDayState(int dayIndex, int monthIndex, int yearIndex) { DateId dateId = new DateId(dayIndex, monthIndex, yearIndex); boolean isEnabled = this.monthView.isEnabled(); StateTransitionTracker tracker = this.dayStateTransitionMultiTracker .getTracker(dateId); if (tracker == null) { boolean isRollover = dateId.equals(this.rolloverDateId); boolean isSelected = this.selectedDates.contains(dateId); return ComponentState.getState(isEnabled, isRollover, isSelected); } else { ComponentState fromTracker = tracker.getModelStateInfo() .getCurrModelState(); return ComponentState.getState(isEnabled, fromTracker .isFacetActive(ComponentStateFacet.ROLLOVER), fromTracker .isFacetActive(ComponentStateFacet.SELECTION)); } }
/** * Returns the current state for the specified tab. * * @param tabIndex * Tab index. * @return The current state for the specified tab. */ protected ComponentState getTabState(int tabIndex) { boolean isEnabled = this.tabPane.isEnabledAt(tabIndex); StateTransitionTracker tracker = this.stateTransitionMultiTracker .getTracker(tabIndex); if (tracker == null) { boolean isRollover = this.getRolloverTabIndex() == tabIndex; boolean isSelected = this.tabPane.getSelectedIndex() == tabIndex; return ComponentState.getState(isEnabled, isRollover, isSelected); } else { ComponentState fromTracker = tracker.getModelStateInfo() .getCurrModelState(); return ComponentState.getState(isEnabled, fromTracker .isFacetActive(ComponentStateFacet.ROLLOVER), fromTracker .isFacetActive(ComponentStateFacet.SELECTION)); } }
/** * Returns the current state for the specified tab. * * @param tabIndex * Tab index. * @return The current state for the specified tab. */ protected ComponentState getTabState(int tabIndex) { boolean isEnabled = this.tabPane.isEnabledAt(tabIndex); StateTransitionTracker tracker = this.stateTransitionMultiTracker .getTracker(tabIndex); if (tracker == null) { boolean isRollover = this.getRolloverTabIndex() == tabIndex; boolean isSelected = this.tabPane.getSelectedIndex() == tabIndex; return ComponentState.getState(isEnabled, isRollover, isSelected); } else { ComponentState fromTracker = tracker.getModelStateInfo() .getCurrModelState(); return ComponentState.getState(isEnabled, fromTracker .isFacetActive(ComponentStateFacet.ROLLOVER), fromTracker .isFacetActive(ComponentStateFacet.SELECTION)); } }
private ComponentState getMonthState(int monthIndex, int yearIndex) { MonthId monthId = new MonthId(monthIndex, yearIndex); boolean isEnabled = this.monthView.isEnabled(); StateTransitionTracker tracker = this.monthStateTransitionMultiTracker .getTracker(monthId); if (tracker == null) { boolean isRollover = (this.rolloverDateId != null) && (this.rolloverDateId.month == monthIndex) && (this.rolloverDateId.year == yearIndex); return ComponentState.getState(isEnabled, isRollover, false); } else { ComponentState fromTracker = tracker.getModelStateInfo() .getCurrModelState(); return ComponentState.getState(isEnabled, fromTracker .isFacetActive(ComponentStateFacet.ROLLOVER), fromTracker .isFacetActive(ComponentStateFacet.SELECTION)); } }