|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.salespointframework.desktop.renderer.AbstractListViewRenderer
public abstract class AbstractListViewRenderer
this class provides a high performance ListCellRenderer
and its intention is the usage with JListView
it caches cell components to avoid continual reconstruction of them.
Therefore a AbstractListViewRenderer.RenderContext
is established and passed to rendering components to whether build the component
or update components values. The working component can be obtained from AbstractListViewRenderer.RenderContext.component
The AbstractListViewRenderer.RenderComponent
is a subclass of JPanel
which already is set to its destination size.
The renderer differentiates between cells and separators.
Renderer also supports mouse over flag ( AbstractListViewRenderer.RenderContext.isMouseOver
)
take care of the cache key assignment! cache key should always be the same for each item. otherwise you will face rendering
mistakes or large memory leaks.
Nested Class Summary | |
---|---|
static class |
AbstractListViewRenderer.CategoryItem
represents a category item. these items have cacheid as unique identification, because Category can occur more than one time
if sorting doesn't group |
protected static class |
AbstractListViewRenderer.RenderComponent
render component is basically a JPanel which has a AbstractListViewRenderer.RenderContext |
protected static class |
AbstractListViewRenderer.RenderContext
the render context provides information about the current rendering process |
Field Summary | |
---|---|
protected java.util.Map<java.lang.Object,AbstractListViewRenderer.RenderComponent> |
cache
component cache |
protected javax.swing.JPanel |
categoryLine
panel for category line |
protected javax.swing.JLabel |
categoryName
label for category name |
static short |
RENDER_ELEMENT_TYPE_CELL
constant for cell type |
static short |
RENDER_ELEMENT_TYPE_SEPERATOR
constant for separator type |
protected AbstractListViewRenderer.RenderContext |
renderContext
current render context |
protected AbstractListViewRenderer.RenderComponent |
workingComponent
current component that is being rendered |
Constructor Summary | |
---|---|
AbstractListViewRenderer()
|
Method Summary | |
---|---|
protected AbstractListViewRenderer.RenderComponent |
createWorkingComponent()
create a new AbstractListViewRenderer.RenderComponent an initializes its size |
protected java.lang.Object |
getCacheKey(java.lang.Object value)
used for object to cache key mapping. |
protected AbstractListViewRenderer.CategoryItem |
getCategoryItem(AbstractListViewRenderer.RenderContext renderContext)
extracts the category from AbstractListViewRenderer.CategoryItem |
java.awt.Component |
getListCellRendererComponent(javax.swing.JList list,
java.lang.Object value,
int index,
boolean isSelected,
boolean cellHasFocus)
build an return the component |
protected void |
initializeSeperatorComponents()
create components used for seperator |
protected void |
initializeSeperatorComponentValues()
initialize or update component values |
protected abstract void |
render()
renders the component. use renderContext |
protected void |
renderComponent(AbstractListViewRenderer.RenderContext renderContext,
java.awt.Graphics2D g)
This is the drawing function of AbstractListViewRenderer.RenderComponent
draws the component background. |
protected void |
renderSeperator()
renders the separator |
protected void |
renderSeperatorRack()
put components on workingComponent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final short RENDER_ELEMENT_TYPE_CELL
public static final short RENDER_ELEMENT_TYPE_SEPERATOR
protected AbstractListViewRenderer.RenderContext renderContext
protected AbstractListViewRenderer.RenderComponent workingComponent
protected java.util.Map<java.lang.Object,AbstractListViewRenderer.RenderComponent> cache
protected javax.swing.JLabel categoryName
protected javax.swing.JPanel categoryLine
Constructor Detail |
---|
public AbstractListViewRenderer()
Method Detail |
---|
public java.awt.Component getListCellRendererComponent(javax.swing.JList list, java.lang.Object value, int index, boolean isSelected, boolean cellHasFocus)
getListCellRendererComponent
in interface javax.swing.ListCellRenderer
protected java.lang.Object getCacheKey(java.lang.Object value)
value
-
protected abstract void render()
renderContext
protected void renderSeperator()
protected AbstractListViewRenderer.CategoryItem getCategoryItem(AbstractListViewRenderer.RenderContext renderContext)
AbstractListViewRenderer.CategoryItem
renderContext
-
protected void initializeSeperatorComponents()
protected void initializeSeperatorComponentValues()
protected void renderSeperatorRack()
workingComponent
protected void renderComponent(AbstractListViewRenderer.RenderContext renderContext, java.awt.Graphics2D g)
AbstractListViewRenderer.RenderComponent
draws the component background.
renderContext
- render contextg
- graphics contextprotected AbstractListViewRenderer.RenderComponent createWorkingComponent()
AbstractListViewRenderer.RenderComponent
an initializes its size
AbstractListViewRenderer.RenderComponent
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |