public class TLcdBingMapsCopyrightIcon extends Object implements ILcdIcon, ILcdChangeSource
TLcdBingMapsGXYCopyrightProvider
).
Subclasses will typically do this automatically.
Usually the copyright information is displayed in conjunction with the Bing Maps logo itself
(see TLcdBingMapsLogoIcon
).
//The Bing Maps terms of use require to display the icon and copyright information on the map
//Here we add them to the overlay component of an ILspAWTView
TLcdBingMapsLogoIcon logoIcon = new TLcdBingMapsLogoIcon(view);
view.getOverlayComponent().add(logoIcon.asComponent(), TLcdOverlayLayout.Location.NORTH_WEST);
TLspBingMapsCopyrightIcon copyrightIcon = new TLspBingMapsCopyrightIcon(view);
copyrightIcon.setAlignment(ELcdHorizontalAlignment.RIGHT);
view.getOverlayComponent().add(copyrightIcon.asComponent(), TLcdOverlayLayout.Location.NORTH_WEST);
Adding the logo and copyright icon to the overlay panel of an FX view:
TLcdBingMapsLogoIcon logoIcon = new TLcdBingMapsLogoIcon(view);
Node logoNode = new TLcdFXIcon(logoIcon);
TLspBingMapsCopyrightIcon copyrightIcon = new TLspBingMapsCopyrightIcon(view);
Node copyrightNode = new TLcdFXIcon(copyrightIcon);
FXUtil.findOverlayPane(view).ifPresent(overlayPane -> {
HBox box = new HBox(logoNode, copyrightNode);
overlayPane.add(box, TLcdOverlayPane.Location.SOUTH_WEST);
});
Constructor and Description |
---|
TLcdBingMapsCopyrightIcon()
Creates a new bing copyright icon.
|
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(ILcdChangeListener aListener)
Registers the given listener so it will receive change events from this source.
|
JComponent |
asComponent()
Returns a
JComponent representing this icon which can be added to a Swing container. |
Object |
clone()
Makes
Object.clone() public. |
ELcdHorizontalAlignment |
getAlignment()
Returns the current alignment.
|
List<String> |
getCopyright()
Returns an immutable list containing the copyright strings currently displayed by this icon.
|
Font |
getFont()
Returns the font used to display the copyright information.
|
Color |
getFontColor()
Returns the font color used to display the copyright information.
|
int |
getIconHeight()
Returns the fixed height of the icon.
|
int |
getIconWidth()
Returns the fixed width of the icon.
|
int |
getMaxLineWidth()
Returns the maximum line width used to display copyright information.
|
Color |
getShadowColor()
Returns the shadow color used to display the copyright information.
|
void |
paintIcon(Component c,
Graphics g,
int x,
int y)
Draw the
ILcdIcon at the specified location. |
void |
removeChangeListener(ILcdChangeListener aListener)
Removes the specified listener so it is no longer notified.
|
void |
setAlignment(ELcdHorizontalAlignment aAlignment)
Sets the alignment used to display the copyright information.
|
void |
setCopyright(List<String> aCopyright)
Sets the list of strings to be displayed by this icon.
|
void |
setFont(Font aFont)
Sets the font, used to display the copyright information.
|
void |
setFontColor(Color aFontColor)
Sets the font color, used to display the copyright information.
|
void |
setMaxLineWidth(int aMaxLineWidth)
Sets the maximum line width used to display the copyright information.
|
void |
setShadowColor(Color aShadowColor)
Sets the shadow color, used to display the copyright information.
|
public TLcdBingMapsCopyrightIcon()
public void setCopyright(List<String> aCopyright)
aCopyright
- the list of strings to be displayedpublic List<String> getCopyright()
public void paintIcon(Component c, Graphics g, int x, int y)
ILcdIcon
ILcdIcon
at the specified location. ILcdIcon
implementations
may use the Component
argument to get properties useful for
painting, e.g. the foreground or background color.paintIcon
in interface ILcdIcon
c
- a Component to retrieve properties from.g
- the Graphics on which the icon will be painted.x
- the x position where the icon will be painted. x is the first coordinate of the top left
corner point of the icon.y
- the y position where the icon will be painted. y is the second coordinate of the top left
corner point of the icon.public int getIconWidth()
ILcdIcon
getIconWidth
in interface ILcdIcon
public int getIconHeight()
ILcdIcon
getIconHeight
in interface ILcdIcon
public void addChangeListener(ILcdChangeListener aListener)
Registers the given listener so it will receive change events from this source.
In case you need to register a listener which keeps a reference to an object with a shorter life-time than this change source,
you can use a ALcdWeakChangeListener
instance as change listener.
Note that change events might be thrown on another thread then the EDT. If swing components have to be updated, make sure to invoke those changes on EDT.
addChangeListener
in interface ILcdChangeSource
aListener
- The listener to be notified when a change has happened.ILcdChangeSource.removeChangeListener(ILcdChangeListener)
,
ALcdWeakChangeListener
public void removeChangeListener(ILcdChangeListener aListener)
ILcdChangeSource
removeChangeListener
in interface ILcdChangeSource
aListener
- The listener to remove.public Font getFont()
setFont(java.awt.Font)
public void setFont(Font aFont)
aFont
- the font to use.getFont()
public Color getFontColor()
setFontColor(java.awt.Color)
public void setFontColor(Color aFontColor)
aFontColor
- the font color to use.()
public Color getShadowColor()
setShadowColor(java.awt.Color)
public void setShadowColor(Color aShadowColor)
aShadowColor
- the shadow color to use.getShadowColor()
public int getMaxLineWidth()
setMaxLineWidth(int)
public void setMaxLineWidth(int aMaxLineWidth)
aMaxLineWidth
- the maximum line width to use.()
public ELcdHorizontalAlignment getAlignment()
setAlignment(ELcdHorizontalAlignment)
public void setAlignment(ELcdHorizontalAlignment aAlignment)
ELcdHorizontalAlignment.LEFT
aAlignment
- the alignment to use.getAlignment()
public Object clone()
ILcdCloneable
Makes Object.clone()
public.
java.lang.Object
, it can be implemented like this:
public Object clone() {
try {
return super.clone();
} catch ( CloneNotSupportedException e ) {
// Cannot happen: extends from Object and implements Cloneable (see also Object.clone)
throw new RuntimeException( e );
}
}
clone
in interface ILcdCloneable
clone
in class Object
Object.clone()
public final JComponent asComponent()
Returns a JComponent
representing this icon which can be added to a Swing container.
The component will repaint itself each time the copyright information is updated.
Typically this component is added to the overlay panel of the view.
Example usage:
//The Bing Maps terms of use require to display the icon and copyright information on the map
//Here we add them to the overlay component of an ILspAWTView
TLcdBingMapsLogoIcon logoIcon = new TLcdBingMapsLogoIcon(view);
view.getOverlayComponent().add(logoIcon.asComponent(), TLcdOverlayLayout.Location.NORTH_WEST);
TLspBingMapsCopyrightIcon copyrightIcon = new TLspBingMapsCopyrightIcon(view);
copyrightIcon.setAlignment(ELcdHorizontalAlignment.RIGHT);
view.getOverlayComponent().add(copyrightIcon.asComponent(), TLcdOverlayLayout.Location.NORTH_WEST);
JComponent
representing this icon