public class IlvChartCSSCustomizerPanel extends JPanel
IlvChartCSSCustomizerPanel
is able to
customize a stylable chart component via modification of CSS (Cascading
Style Sheet rules). In order to use the customizer, the appearance of
the chart must be specified by CSS.
The following example allocates a chart CSS customizer to customize the parameters of the chart area, and adds this customizer to a frame.
IlvChart chart = ... IlvChartCSSCustomizerPanel chartCSSCustomizer = new IlvChartCSSCustomizerPanel(chart); frame.getContentPane().add(chartCSSCustomizer); try { chartCSSCustomizer.setRule("chartArea"); } catch (IlvCustomizerException ex1) { ... } catch (IlvStylingException ex2) { ... }
IlvChart
,
IlvChartCSSAdapter
,
Serialized FormJPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
IlvChartCSSCustomizerPanel()
Creates a new chart CSS customizer.
|
IlvChartCSSCustomizerPanel(IlvChart chart)
Creates a new chart CSS customizer for a chart.
|
IlvChartCSSCustomizerPanel(IlvChartCSSAdapter adapter)
Creates a new chart CSS customizer for a chart CSS adapter.
|
Modifier and Type | Method and Description |
---|---|
void |
addUndoableEditListener(UndoableEditListener listener)
Registers the given listener to start receiving notifications
when undoable edits are made to the document.
|
void |
conditionChanged(String conditionId,
boolean updateValue,
boolean updateEnabled,
boolean updateVisible)
This method must be called whenever an external condition changes
that requires that certain Swing controls become enabled or disabled
and visible or invisible.
|
IlvChartCSSAdapter |
getAdapter()
Returns the chart CSS adapter used by this customizer.
|
IlvChart |
getChart()
Returns the chart of this customizer.
|
URL |
getConfigFileBaseURL()
Returns the base URL under which the default configuration files are
searched.
|
URL |
getConfigurationFile()
Returns the
URL of the configuration file or
null if none. |
URL |
getDefaultConfigFile(IlvRuleCustomizerLogic ruleCustomizerLogic)
Returns the default configuration file to be used for customizing
the provided rule customizer, or
null if there is no default
configuration file for this target. |
IlvRuleCustomizerLogic |
getRuleCustomizerLogic()
Returns the rule customizer logic that is currently displayed or
null if none. |
boolean |
isDeclarationStatusIconEnabled()
Returns
true if the display of declaration
status icons is enabled, and returns false otherwise. |
boolean |
isEditAsTextEnabled()
Returns
true if the editing as text of the values
of CSS expressions is enabled, and returns false otherwise. |
void |
removeUndoableEditListener(UndoableEditListener listener)
Unregisters the given listener from the notification list so it will
no longer receive updates.
|
void |
setAdapter(IlvChartCSSAdapter adapter)
Sets the chart CSS adapter used by this customizer.
|
void |
setChart(IlvChart chart)
Sets the chart of this customizer.
|
void |
setConfigFileBaseURL(URL baseURL)
Sets the base URL under which the default configuration files shall be
searched.
|
void |
setConfigurationFile(URL configFile)
Sets the configuration file to be used for the rule customizer.
|
void |
setDeclarationStatusIconEnabled(boolean enabled,
boolean reload)
Enables or disables the display of declaration status icons.
|
void |
setEditAsTextEnabled(boolean enabled,
boolean reload)
Enables or disables the editing as text of the values
of CSS expressions.
|
void |
setRule(IlvCSSRule rule)
Sets the styling rule that should be customized.
|
void |
setRule(String selector)
Sets the styling rule that should be customized.
|
void |
setRule(String selector,
URL configFile)
Sets the styling rule that should be customized.
|
void |
setRuleCustomizerLogic(IlvRuleCustomizerLogic ruleCustomizerLogic)
Sets the rule customizer logic to be displayed.
|
void |
setRuleCustomizerLogic(IlvRuleCustomizerLogic ruleCustomizerLogic,
URL configFile)
Sets the rule customizer logic to be displayed with the input configuration file.
|
void |
update()
Updates the customizer.
|
void |
update(boolean updateValue,
boolean updateEnabled,
boolean updateVisible)
Updates the customizer.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public IlvChartCSSCustomizerPanel()
public IlvChartCSSCustomizerPanel(IlvChart chart)
public IlvChartCSSCustomizerPanel(IlvChartCSSAdapter adapter)
public IlvChartCSSAdapter getAdapter()
public void setAdapter(IlvChartCSSAdapter adapter)
public IlvChart getChart()
public void setChart(IlvChart chart)
IlvChartCSSAdapter.setChart(ilog.views.chart.IlvChart)
on
the existing chart CSS adapter.
This also cleans the current rule customizer logic and the URL of the
configuration file.public URL getConfigFileBaseURL()
setConfigFileBaseURL(java.net.URL)
public void setConfigFileBaseURL(URL baseURL)
This method is useful when you modified the contents of the XML or
property specifications of the customizers but did not alter the file
names. For more advanced uses, for example to use separate customizers
for different parts of the same rule, see setRule(String, URL)
and setRuleCustomizerLogic(IlvRuleCustomizerLogic, URL)
.
getConfigFileBaseURL()
public URL getDefaultConfigFile(IlvRuleCustomizerLogic ruleCustomizerLogic)
null
if there is no default
configuration file for this target.
This method takes into account the base URL set through
setConfigFileBaseURL(java.net.URL)
.
This method is not used when the configuration file is specified
explicitly, through setRule(String, URL)
or
setRuleCustomizerLogic(IlvRuleCustomizerLogic, URL)
.
ruleCustomizerLogic
- The rule customizer logic to be displayed.setConfigFileBaseURL(java.net.URL)
,
setRule(String, URL)
,
setRuleCustomizerLogic(IlvRuleCustomizerLogic, URL)
public void setRule(String selector) throws IlvCustomizerException, IlvStylingException
"series[name="Y1"]"
or
"chartScale[axisIndex="-1"]"
.
The styling rules refer to different parts of the chart, for example,
series and chart scales.
In order to display the customizer of a certain part of the chart,
you need to pass the selector of the corresponding rule.
If no such rule exists yet, a corresponding rule is created in the CSS
of the chart.
The implementation retrieves the rule customizer logic that corresponds
to this rule, initializes the rule customizer logic with the input rule
and calls setRuleCustomizerLogic(IlvRuleCustomizerLogic, URL)
.
It uses the default configuration file.
If no rule customizer logic exists for the input rule, the customizer panel is cleaned and stays empty.
selector
- The selector string of a rule.IlvCustomizerException
- If an error occurs while building
the contents of the customizer, for instance an error in the
configuration file.IlvStylingException
getAdapter()
,
setRuleCustomizerLogic(IlvRuleCustomizerLogic, URL)
public void setRule(String selector, URL configFile) throws IlvCustomizerException, IlvStylingException
"series[name="Y1"]"
or
"chartScale[axisIndex="-1"]"
.
The styling rules refer to different parts of the chart, for example,
series and chart scales.
In order to display the customizer of a certain part of the chart,
you need to pass the selector of the corresponding rule.
If no such rule exists yet, a corresponding rule is created in the CSS
of the chart.
The implementation retrieves the rule customizer logic that corresponds
to this rule, initializes the rule customizer logic with the input rule
and calls setRuleCustomizerLogic(IlvRuleCustomizerLogic, URL)
.
If no rule customizer logic exists for the input rule, the customizer panel is cleaned and stays empty.
The configuration file is an XML description of the properties that should be displayed in the customizer. In order to filter out certain properties that should not be customized, you can create your own configuration file, for instance by copying the default configuration file and removing the parts that should not be customizable.
This method is an advanced API. It requires that you maintain an
association between selectors and XML description file names. A simpler
approach is to keep the default XML description file names and use
setConfigFileBaseURL(java.net.URL)
and setRule(String)
.
selector
- The selector string of a rule.configFile
- The configuration file that describes which properties
should be displayed in the customizer.
If null
is passed, the default configuration
file is used.IlvCustomizerException
- If an error occurs while building
the contents of the customizer, for instance an error in the
configuration file.IlvStylingException
getAdapter()
,
setRuleCustomizerLogic(IlvRuleCustomizerLogic, URL)
,
setConfigFileBaseURL(java.net.URL)
public void setRule(IlvCSSRule rule) throws IlvCustomizerException
The implementation retrieves the rule customizer logic that corresponds
to this rule, initializes the rule customizer logic with the input rule
and calls setRuleCustomizerLogic(IlvRuleCustomizerLogic, URL)
.
It uses the default configuration file.
If no rule customizer logic exists for the input rule, the customizer panel is cleaned and stays empty.
rule
- The CSS rule.IlvCustomizerException
- If an error occurs while building
the contents of the customizer, for instance an error in the
configuration file.getAdapter()
,
setRuleCustomizerLogic(IlvRuleCustomizerLogic, URL)
public final URL getConfigurationFile()
URL
of the configuration file or
null
if none.public void setConfigurationFile(URL configFile) throws IlvCustomizerException
getRuleCustomizerLogic()
) is
not null
and has a main rule, the customizer is reinitialized
according to the specified configuration file.
IlvCustomizerException
- If an error occurs while building
the contents of the customizer, for instance an error in the
configuration file.setRuleCustomizerLogic(IlvRuleCustomizerLogic, URL)
,
getConfigurationFile()
public IlvRuleCustomizerLogic getRuleCustomizerLogic()
null
if none.public void setRuleCustomizerLogic(IlvRuleCustomizerLogic ruleCustomizerLogic) throws IlvCustomizerException
IlvRuleCustomizerLogic.setMainRule(ilog.views.util.styling.IlvCSSRule)
.
The default configuration file of the rule customizer logic is used.
ruleCustomizerLogic
- The rule customizer logic.IlvCustomizerException
- If an error occurs while building
the contents of the customizer, for instance an error in the
configuration file.public void setRuleCustomizerLogic(IlvRuleCustomizerLogic ruleCustomizerLogic, URL configFile) throws IlvCustomizerException
IlvRuleCustomizerLogic.setMainRule(ilog.views.util.styling.IlvCSSRule)
.
The configuration file is an XML description of the properties that should be displayed in the customizer. In order to filter out certain properties that should not be customized, you can create your own configuration file, for instance by copying the default configuration file and removing the parts that should not be customizable.
This method is an advanced API. It requires that you maintain an
association between selectors or rule customizers and XML description file
names. A simpler approach is to keep the default XML description file
names and use setConfigFileBaseURL(java.net.URL)
and
setRuleCustomizerLogic(IlvRuleCustomizerLogic)
.
ruleCustomizerLogic
- The rule customizer logic.configFile
- The configuration file that describes which properties
should be displayed in the customizer.
If null
is passed, the default configuration
file is used.IlvCustomizerException
- If an error occurs while building
the contents of the customizer, for instance an error in the
configuration file.getRuleCustomizerLogic()
,
getConfigurationFile()
,
setConfigFileBaseURL(java.net.URL)
public boolean isDeclarationStatusIconEnabled()
true
if the display of declaration
status icons is enabled, and returns false
otherwise.public void setDeclarationStatusIconEnabled(boolean enabled, boolean reload) throws IlvCustomizerException
reload
is true
, the contents
of the customizer is reloaded.
The default value is true
.IlvCustomizerException
public boolean isEditAsTextEnabled()
true
if the editing as text of the values
of CSS expressions is enabled, and returns false
otherwise.public void setEditAsTextEnabled(boolean enabled, boolean reload) throws IlvCustomizerException
reload
is true
, the contents
of the customizer is reloaded.
The default value is true
.IlvCustomizerException
public void addUndoableEditListener(UndoableEditListener listener)
listener
- The listener to register.UndoableEditEvent
public void removeUndoableEditListener(UndoableEditListener listener)
listener
- The listener to register.UndoableEditEvent
public final void conditionChanged(String conditionId, boolean updateValue, boolean updateEnabled, boolean updateVisible) throws IlvCustomizerException
<when condition="conditionId"/>
in the XML configuration file.
Depending on the evaluation of the condition, the Swing
control that has this when-clause is enabled or disabled, or set
visible or invisible. This method
forces a re-evaluation of the condition, which will update the
state of the dependent Swing controls.conditionId
- The identifier of the condition that has changed.updateValue
- If true
, updates the value displayed
for properties that depend on the condition.updateEnabled
- If true
, updates the enabled or
disabled state of the property that depend on the condition.updateVisible
- If true
, updates the visibility
state of the property that depend on the condition.IlvCustomizerException
public final void update() throws IlvCustomizerException
update(boolean, boolean, boolean)
passing true
for all arguments.IlvCustomizerException
- If an exception occurs.update(boolean, boolean, boolean)
public final void update(boolean updateValue, boolean updateEnabled, boolean updateVisible) throws IlvCustomizerException
updateValue
, updateEnabled
and updateVisible
are all false
.updateValue
- If true
, updates the value displayed
for properties. The parameter is ignored for groups.updateEnabled
- If true
, updates the enabled or
disabled state of the property or group.updateVisible
- If true
, updates the visibility
state of the property or group.IlvCustomizerException
- If an exception occurs.update()
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.