blob: a1c82e8bf86426c377ef52ba789ab9e8641c59f6 [file] [log] [blame]
/*=============================================================================#
# 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.style.editor;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.statet.ecommons.waltable.config.CellConfigAttributes;
import org.eclipse.statet.ecommons.waltable.config.IConfigRegistry;
import org.eclipse.statet.ecommons.waltable.grid.cell.AlternatingRowConfigLabelAccumulator;
import org.eclipse.statet.ecommons.waltable.style.CellStyleAttributes;
import org.eclipse.statet.ecommons.waltable.style.DisplayMode;
import org.eclipse.statet.ecommons.waltable.style.IStyle;
public class GridStyleParameterObject {
public Font tableFont;
public Color evenRowColor;
public Color oddRowColor;
public Color selectionColor;
public IStyle evenRowStyle;
public IStyle oddRowStyle;
public IStyle selectionStyle;
public IStyle tableStyle;
private final IConfigRegistry configRegistry;
public GridStyleParameterObject(final IConfigRegistry configRegistry) {
this.configRegistry= configRegistry;
init(configRegistry);
}
private void init(final IConfigRegistry configRegistry) {
this.evenRowStyle= configRegistry.getConfigAttribute(
CellConfigAttributes.CELL_STYLE,
DisplayMode.NORMAL,
AlternatingRowConfigLabelAccumulator.EVEN_ROW_CONFIG_TYPE);
this.evenRowColor= this.evenRowStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR);
this.oddRowStyle= configRegistry.getConfigAttribute(
CellConfigAttributes.CELL_STYLE,
DisplayMode.NORMAL,
AlternatingRowConfigLabelAccumulator.ODD_ROW_CONFIG_TYPE);
this.oddRowColor= this.oddRowStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR);
this.selectionStyle= configRegistry.getConfigAttribute(CellConfigAttributes.CELL_STYLE, DisplayMode.SELECT);
this.selectionColor= this.selectionStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR);
this.tableStyle= configRegistry.getConfigAttribute(CellConfigAttributes.CELL_STYLE, DisplayMode.NORMAL);
this.tableFont= this.tableStyle.getAttributeValue(CellStyleAttributes.FONT);
}
public IConfigRegistry getConfigRegistry() {
return this.configRegistry;
}
}