| java.lang.Object net.refractions.udig.project.ui.internal.LayerGeneratedGlyphDecorator
LayerGeneratedGlyphDecorator | public class LayerGeneratedGlyphDecorator implements ILabelDecorator(Code) | | Generate glyph/title - fetch from WMS or derrive from StyleBlackboard.
This is a complete heavyweight decorator - there is no messing around with this one. It has its
own thread, and will pay attention to events.
Generated Content is placed in layer properties:
- displayName:
- displayGlyph:
Generation only kicks in if getGlyph or getName return null.
author: jgarnett since: 0.7.0 |
Method Summary | |
public void | addListener(ILabelProviderListener listener) | public Image | decorateImage(Image origionalImage, Object element) We are not allowed to block, test if generation is needed and start up the queue.
State Table of Image \ Image Descriptor:
| null | icon
---------+--------------+---------------------+
disposed | queue | image = |
or null | layer | icon.createImage() |
---------+--------------+---------------------+
image | both | image |
+--------------+---------------------+
This attempts to reduce the amount of flicker experienced as the layer figures out its glyph
in the face of many events.
Everyone gives us events - who gives us icons?
- If the user has given the layer an icon we don't need to generate anything.
- piccaso will wait on the queue and generate icons, and refresh the decorator.
- We will get the refresh and generate an Image from the Icon, we can use this image when
we are nexted refreshed.
- A random eclipse code will dispose our Images, and refrsh us (We can still generate our
images from the saved icon).
- The listener *hack* will watch for changes to layer,if any look interesting the icon
will be cleared and we will be refreshed.
| public String | decorateText(String text, Object element) | public void | dispose() | static ImageDescriptor | generateDefaultIcon(Layer layer) Generate icon based on simple layer type information without style. | public static ImageDescriptor | generateIcon(Layer layer) Genearte label and place in label.getProperties().getSTring( GENERATED_NAME ). | public static String | generateLabel(Layer layer) Genearte label.
This is used to generate a value for layer.getProperties().getString( GENERATED_NAME ).
The generated label from Resource.getInfo().getTitle(). | public static ImageDescriptor | generateStyledIcon(Layer layer) Generate icon based on style information.
Will return null if an icom based on the current style could not be generated. | public static ImageDescriptor | generateStyledIcon(Layer layer, Rule rule) | public static LayerGeneratedGlyphDecorator | getInstance() | public boolean | isLabelProperty(Object element, String property) | static String | label(Layer layer) A non null answer when layer has a good label.
Where a good/real means:
| void | refresh(Layer layer) | public void | removeListener(ILabelProviderListener listener) |
listeners | Set<ILabelProviderListener> listeners(Code) | | |
picasso | Job picasso(Code) | | Piccaso generates pcitures for layers in the queue.
This is the sole provider of dynamic artwork for layers. Piccaso will block contacting
external servers and so on.
If this gets to be a pain we may switch to the dutch school model, perhaps even
impressionests based on a sample feature.
Any artwork is provided as an ImageDescriptor using the key GENERATED_ICON. This will be
turned into an Image by the decorateImage method as required.
|
queue | LinkedList<Layer> queue(Code) | | Queue of layers needing to be refreshed.
Does not allow duplicates to be added.
|
LayerGeneratedGlyphDecorator | public LayerGeneratedGlyphDecorator()(Code) | | |
addListener | public void addListener(ILabelProviderListener listener)(Code) | | See Also: org.eclipse.jface.viewers.IBaseLabelProvider.addListener(org.eclipse.jface.viewers.ILabelProviderListener) |
decorateImage | public Image decorateImage(Image origionalImage, Object element)(Code) | | We are not allowed to block, test if generation is needed and start up the queue.
State Table of Image \ Image Descriptor:
| null | icon
---------+--------------+---------------------+
disposed | queue | image = |
or null | layer | icon.createImage() |
---------+--------------+---------------------+
image | both | image |
+--------------+---------------------+
This attempts to reduce the amount of flicker experienced as the layer figures out its glyph
in the face of many events.
Everyone gives us events - who gives us icons?
- If the user has given the layer an icon we don't need to generate anything.
- piccaso will wait on the queue and generate icons, and refresh the decorator.
- We will get the refresh and generate an Image from the Icon, we can use this image when
we are nexted refreshed.
- A random eclipse code will dispose our Images, and refrsh us (We can still generate our
images from the saved icon).
- The listener *hack* will watch for changes to layer,if any look interesting the icon
will be cleared and we will be refreshed. We still have our image so their will be no
downtime while waiting for piccaso to make us a new Icon.
So what happens for a layer that we cannot generate a icon for? We will place it in the queue
every* time. Who knows maybe style or something will change and we can do better then the
default.
See Also: org.eclipse.jface.viewers.ILabelDecorator.decorateImage(org.eclipse.swt.graphics.Imagejava.lang.Object) |
decorateText | public String decorateText(String text, Object element)(Code) | | See Also: org.eclipse.jface.viewers.ILabelDecorator.decorateText(java.lang.Stringjava.lang.Object) |
dispose | public void dispose()(Code) | | See Also: org.eclipse.jface.viewers.IBaseLabelProvider.dispose |
generateDefaultIcon | static ImageDescriptor generateDefaultIcon(Layer layer)(Code) | | Generate icon based on simple layer type information without style.
The following information is checked:
- All WMS resources known to the layer - they often have default icon
- FeatureSoruce known to the layer - icon can be based on FeatureType
- IGeoResourceInfo type information
Parameters: layer - Icon based on layer, null if unavailable |
generateIcon | public static ImageDescriptor generateIcon(Layer layer)(Code) | | Genearte label and place in label.getProperties().getSTring( GENERATED_NAME ).
Label is genrated from Resource.
gernated layer |
generateLabel | public static String generateLabel(Layer layer)(Code) | | Genearte label.
This is used to generate a value for layer.getProperties().getString( GENERATED_NAME ).
The generated label from Resource.getInfo().getTitle(). This method will block and should not
be called from the event thread.
gernated layer, or null if none can be determined |
generateStyledIcon | public static ImageDescriptor generateStyledIcon(Layer layer)(Code) | | Generate icon based on style information.
Will return null if an icom based on the current style could not be generated. You may
consult generateDefaultIcon( layer ) for a second opionion based on just the layer
information.
Parameters: layer - ImageDecriptor for layer, or null in style could not be indicated |
generateStyledIcon | public static ImageDescriptor generateStyledIcon(Layer layer, Rule rule)(Code) | | |
isLabelProperty | public boolean isLabelProperty(Object element, String property)(Code) | | See Also: org.eclipse.jface.viewers.IBaseLabelProvider.isLabelProperty(java.lang.Objectjava.lang.String) |
label | static String label(Layer layer)(Code) | | A non null answer when layer has a good label.
Where a good/real means:
|
removeListener | public void removeListener(ILabelProviderListener listener)(Code) | | See Also: org.eclipse.jface.viewers.IBaseLabelProvider.removeListener(org.eclipse.jface.viewers.ILabelProviderListener) |
|
|