Search this API

y.view
Class DefaultLabelConfiguration

java.lang.Object
  extended by y.view.DefaultLabelConfiguration
All Implemented Interfaces:
YLabel.BoundsProvider, YLabel.Layout, YLabel.Painter

public class DefaultLabelConfiguration
extends java.lang.Object
implements YLabel.Painter, YLabel.Layout, YLabel.BoundsProvider

Helper class for use in configuration implementations that can be used in YLabel.Factory.addConfiguration(String, java.util.Map) to serve as a basic implementation. This implementation mimics the default behavior of a YLabel instance.

 

Constructor Summary
DefaultLabelConfiguration()
           
 
Method Summary
 void calculateContentSize(YLabel label, java.awt.font.FontRenderContext frc)
          Delegating method of YLabel.calculateSize(java.awt.font.FontRenderContext)
 void calcUnionRect(YLabel label, java.awt.geom.Rectangle2D r)
          Delegating method of YLabel.calcUnionRect(java.awt.geom.Rectangle2D)
 boolean contains(YLabel label, double x, double y)
          Delegating method of YLabel.contains(double, double)
 OrientedRectangle getIconBox(YLabel label)
          Delegating method of YLabel.getIconBox().
 OrientedRectangle getTextBox(YLabel label)
          Delegating method of YLabel.getTextBox().
 boolean isAutoFlippingEnabled()
          Determines whether or not this painter should automatically flip label content depending on the label's rotation angle.
 void paint(YLabel label, java.awt.Graphics2D gfx)
          Delegating method of YLabel.paint(java.awt.Graphics2D)
 void paintBox(YLabel label, java.awt.Graphics2D gfx, double x, double y, double width, double height)
          Delegating method of YLabel.paintBox(java.awt.Graphics2D, double, double, double, double)
 void paintContent(YLabel label, java.awt.Graphics2D gfx, double x, double y, double width, double height)
          Delegating method of YLabel.paintContent(java.awt.Graphics2D, double, double, double, double)
 void setAutoFlippingEnabled(boolean enabled)
          Specifies whether or not this painter should automatically flip label content depending on the label's rotation angle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLabelConfiguration

public DefaultLabelConfiguration()
Method Detail

calcUnionRect

public void calcUnionRect(YLabel label,
                          java.awt.geom.Rectangle2D r)
Description copied from interface: YLabel.BoundsProvider
Delegating method of YLabel.calcUnionRect(java.awt.geom.Rectangle2D)

Specified by:
calcUnionRect in interface YLabel.BoundsProvider
Parameters:
label - the label context
r - the bounds to update

paint

public void paint(YLabel label,
                  java.awt.Graphics2D gfx)
Description copied from interface: YLabel.Painter
Delegating method of YLabel.paint(java.awt.Graphics2D)

Specified by:
paint in interface YLabel.Painter
Parameters:
label - the label context

paintContent

public void paintContent(YLabel label,
                         java.awt.Graphics2D gfx,
                         double x,
                         double y,
                         double width,
                         double height)
Description copied from interface: YLabel.Painter
Delegating method of YLabel.paintContent(java.awt.Graphics2D, double, double, double, double)

Specified by:
paintContent in interface YLabel.Painter
Parameters:
label - the label context

paintBox

public void paintBox(YLabel label,
                     java.awt.Graphics2D gfx,
                     double x,
                     double y,
                     double width,
                     double height)
Description copied from interface: YLabel.Painter
Delegating method of YLabel.paintBox(java.awt.Graphics2D, double, double, double, double)

Specified by:
paintBox in interface YLabel.Painter
Parameters:
label - the label context

getTextBox

public OrientedRectangle getTextBox(YLabel label)
Description copied from interface: YLabel.Painter
Delegating method of YLabel.getTextBox().

Note: This method is not used to calculate the text placement in the painter, but rather provides a means to query the painter for text position and orientation.

Specified by:
getTextBox in interface YLabel.Painter
Parameters:
label - the label context

getIconBox

public OrientedRectangle getIconBox(YLabel label)
Description copied from interface: YLabel.Painter
Delegating method of YLabel.getIconBox().

Note: This method is not used to calculate the icon placement in the painter, but rather provides a means to query the painter for icon position and orientation.

Specified by:
getIconBox in interface YLabel.Painter
Parameters:
label - the label context

calculateContentSize

public void calculateContentSize(YLabel label,
                                 java.awt.font.FontRenderContext frc)
Description copied from interface: YLabel.Layout
Delegating method of YLabel.calculateSize(java.awt.font.FontRenderContext)

Specified by:
calculateContentSize in interface YLabel.Layout
Parameters:
label - the label context
frc - the font render context.

contains

public boolean contains(YLabel label,
                        double x,
                        double y)
Description copied from interface: YLabel.Layout
Delegating method of YLabel.contains(double, double)

Specified by:
contains in interface YLabel.Layout
Parameters:
label - the label context.

isAutoFlippingEnabled

public boolean isAutoFlippingEnabled()
Determines whether or not this painter should automatically flip label content depending on the label's rotation angle.

By default, this property is set to false.

Returns:
true if this painter automatically flips label content depending on the label's rotation angle and false otherwise.
See Also:
setAutoFlippingEnabled(boolean)

setAutoFlippingEnabled

public void setAutoFlippingEnabled(boolean enabled)
Specifies whether or not this painter should automatically flip label content depending on the label's rotation angle.

By default, this property is set to false.

Parameters:
enabled - if true, this painter will automatically flip label content depending on the label's rotation angle.
See Also:
isAutoFlippingEnabled()

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.