| /*=============================================================================# |
| # Copyright (c) 2012, 2021 Original NatTable authors and others. |
| # |
| # This program and the accompanying materials are made available under the |
| # terms of the Eclipse Public License 2.0 which is available at |
| # https://www.eclipse.org/legal/epl-2.0. |
| # |
| # SPDX-License-Identifier: EPL-2.0 |
| # |
| # Contributors: |
| # Original NatTable authors and others - initial API and implementation |
| #=============================================================================*/ |
| |
| package org.eclipse.statet.ecommons.waltable.config; |
| |
| import java.util.List; |
| |
| import org.eclipse.statet.ecommons.waltable.style.ConfigAttribute; |
| import org.eclipse.statet.ecommons.waltable.style.DisplayMode; |
| import org.eclipse.statet.ecommons.waltable.style.IDisplayModeLookupStrategy; |
| |
| |
| /** |
| * Holds all the settings, bindings and other configuration for NatTable. |
| * <p> |
| * See ConfigRegistryTest for a better understanding. |
| * @see ConfigRegistry |
| */ |
| public interface IConfigRegistry { |
| |
| /** |
| * If retrieving registered values |
| * <p> |
| * Example 1: |
| * <p>configRegistry.getConfigAttribute(attribute, DisplayMode.EDIT);</p> |
| * <ol> |
| * <li>It will look for an attribute registered using the EDIT display mode</li> |
| * <li>If it can't find that it will try and find an attribute under the NORMAL mode</li> |
| * <li>If it can't find one it will try and find one registered without a display mode {@link #registerConfigAttribute(ConfigAttribute, Object)}</li> |
| * </ol> |
| * Example 2: |
| * <p>configRegistry.getConfigAttribute(attribute, DisplayMode.NORMAL, "testLabel", "testLabel_1");</p> |
| * <ol> |
| * <li>It will look for an attribute registered by display mode NORMAL and "testLabel"</li> |
| * <li>It will look for an attribute registered by display mode NORMAL and "testLabel_1"</li> |
| * </ol> |
| * @param <T> Type of the attribute |
| * @param configAttribute to be registered |
| * @param targetDisplayMode display mode the cell needs to be in, for this attribute to be returned |
| * @param configLabels the cell needs to have, for this attribute to be returned |
| * @return the configAttribute, if the display mode and the configLabels match |
| */ |
| <T> T getConfigAttribute(ConfigAttribute<T> configAttribute, DisplayMode targetDisplayMode, String...configLabels); |
| |
| /** |
| * @see #getConfigAttribute(ConfigAttribute, DisplayMode, String...) |
| */ |
| <T> T getConfigAttribute(ConfigAttribute<T> configAttribute, DisplayMode targetDisplayMode, List<String> configLabels); |
| |
| /** |
| * @see #getConfigAttribute(ConfigAttribute, DisplayMode, String...) |
| */ |
| <T> T getSpecificConfigAttribute(ConfigAttribute<T> configAttribute, DisplayMode displayMode, String configLabel); |
| |
| |
| /** |
| * Register a configuration attribute |
| */ |
| <T> void registerConfigAttribute(ConfigAttribute<T> configAttribute, T attributeValue); |
| |
| /** |
| * Register an attribute against a {@link DisplayMode}. |
| */ |
| <T> void registerConfigAttribute(ConfigAttribute<T> configAttribute, T attributeValue, DisplayMode targetDisplayMode); |
| |
| /** |
| * Register an attribute against a {@link DisplayMode} and configuration label (applied to cells) |
| */ |
| <T> void registerConfigAttribute(ConfigAttribute<T> configAttribute, T attributeValue, DisplayMode targetDisplayMode, String configLabel); |
| |
| <T> void unregisterConfigAttribute(ConfigAttribute<T> configAttributeType, DisplayMode displayMode, String configLabel); |
| |
| IDisplayModeLookupStrategy getDisplayModeOrdering(); |
| |
| } |