|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gishur.gui2.DrawAtom
DrawAtom
is the basis class for all classes in the rendering hierachy.
DrawAtoms
can be used to build a hierachy. The following points yield
for parent DrawAtoms
and their members:
DrawAtom
needs to be recalculated / repainted, all it's members will be
recalculated / repaintedDrawAtom
is unvisible, all member DrawAtoms
are unvisible regardless of
their own visibility information (they will not be hidden!)
Field Summary | |
protected static java.lang.String |
BLOCK_REPAINT
|
protected static java.lang.String |
MARK_RECALC
|
protected static java.lang.String |
MARK_REPAINT
|
protected static java.lang.String |
MARK_SIZE
|
protected static java.lang.String |
REPAINT
|
protected static java.lang.String |
UNBLOCK_REPAINT
|
static int |
USER_STATES_FIRST
The first bit in the user states mask. |
static int |
USER_STATES_MASK
Mask of users states. |
Method Summary | |
void |
addProperties(DrawProperties properties)
Adds the given properties list to this DrawAtoms
properties list. |
List |
collectHits(int x,
int y,
List l)
Collects all DrawAtoms rekursively that were hitted by the point
(x,y) and stores them together with their locate(int, int) -value
in the List l . |
protected void |
dispatchEvent(java.awt.AWTEvent e)
Dispatches the given event e .
{ |
protected DisplayManager |
displayManager()
Returns the DisplayManager that manages the redrawing. |
protected abstract void |
draw(java.awt.Graphics g,
RenderContext context)
Draws this DrawAtom to the given
Graphics g .
|
java.awt.Component |
drawComponent()
Returns the component where all DrawAtoms draw on. |
protected RectangleShape |
getBounds()
Returns the bounds of the DrawAtom in absolute screen coordinates. |
java.lang.Object |
getLocalProperty(java.lang.String key)
Returns the value to which the specified key is mapped
in the properties list of this DrawAtom . |
java.lang.Object |
getProperty(java.lang.String key)
Returns the value to which the specified key is mapped
in the properties list of this DrawAtom or (if no properties list is
assigned or the key is not contained) of the parent DrawAtom . |
java.lang.Object |
getProperty(java.lang.String key,
java.lang.Object default_value)
Returns the value to which the specified key is mapped
in the properties list of this DrawAtom or (if no properties list is
assigned or the key is not contained) of the parent DrawAtom . |
java.lang.Object |
getRequiredProperty(java.lang.String key)
Returns the value to which the specified key is mapped
in the properties list of this DrawAtom or (if no properties list is
assigned or the key is not contained) of the parent DrawAtom . |
java.lang.String |
locate(int x,
int y)
Locates the point (x,y) . |
protected void |
prepeareRenderContext(RenderContext context)
Prepeares the RenderContext before recalulation or drawing
via a call to recalculate(gishur.gui2.RenderContext) /draw(Graphics,RenderContext) . |
protected void |
preprocessEvent(int id,
DrawAtom sender)
Preprocesses the event specified via its id sent by the given source. |
protected java.lang.Object |
processMessage(java.lang.String id_string,
java.lang.Object argument)
Processes a given message. |
DrawProperties |
properties()
Returns the DrawProperties object of this DrawAtom . |
protected abstract void |
recalculate(RenderContext context)
Forces the DrawAtom to recalculate its representation.
|
java.lang.Object |
removeProperty(java.lang.String key)
Removes the key (and its corresponding value) from this
DrawAtom's properties lies. |
protected void |
sendEvent(int id)
Sends an event to all dependend DrawAtoms . |
protected java.lang.Object |
sendMessage(java.lang.String id_string,
java.lang.Object argument)
Sends a message with a given id-string up the drawing hierachy. |
protected void |
setBounds(int x,
int y,
int w,
int h)
Sets the bounds of the DrawAtom in absolute screen coordinates.
|
void |
setPropertiesTo(DrawProperties properties)
Sets the DrawProperties object for this DrawAtom . |
void |
setProperty(java.lang.String key,
boolean value)
Maps the specified key to the specified value in this
DrawAtom's properties list. |
void |
setProperty(java.lang.String key,
double value)
Maps the specified key to the specified value in this
DrawAtom's properties list. |
void |
setProperty(java.lang.String key,
int value)
Maps the specified key to the specified value in this
DrawAtom's properties list. |
java.lang.Object |
setProperty(java.lang.String key,
java.lang.Object value)
Maps the specified key to the specified value in this
DrawAtom's properties list. |
java.lang.String |
toString()
Returns a string representation of the object. |
java.lang.String |
toString(boolean ddata,
boolean odata,
boolean pdata,
int level)
Returns a string representation of the object. |
java.lang.String |
toStringDetail()
Returns a string representation of the object, excluding class name and details of the base DrawAtom (like properties or members list).
|
java.lang.String |
toTreeString()
Returns a String-Representation of the drawing hierachy rooted by this DrawAtom (for debugging reasons). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected static final java.lang.String MARK_RECALC
protected static final java.lang.String MARK_REPAINT
protected static final java.lang.String MARK_SIZE
protected static final java.lang.String REPAINT
protected static final java.lang.String BLOCK_REPAINT
protected static final java.lang.String UNBLOCK_REPAINT
public static final int USER_STATES_MASK
public static final int USER_STATES_FIRST
Method Detail |
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(boolean ddata, boolean odata, boolean pdata, int level)
ddata
- return detailed data of this objectodata
- return basic data of this objectpdata
- return properties data of this objectlevel
- member level (<0
for all members,
==0
for no members)public java.lang.String toStringDetail()
DrawAtom
(like properties or members list).
This method will be called by #toString(boolean,boolean,int)
and
toString()
.public java.lang.String toTreeString()
this
DrawAtom
(for debugging reasons).protected final java.lang.Object sendMessage(java.lang.String id_string, java.lang.Object argument)
processMessage(java.lang.String, java.lang.Object)
will be called. If this
method returns true
, the message will be consumed
andno longer propagated along the drawing hierachy.id_string
- the id Stringargument
- the message argumentprotected java.lang.Object processMessage(java.lang.String id_string, java.lang.Object argument)
sendMessage(java.lang.String, java.lang.Object)
.
If the returned value is not null
, the message will be consumed and
no longer send up the drawing hierachy.id_string
- the id Stringargument
- the message argument!=null
, the object will be sent back as responseprotected final void sendEvent(int id)
DrawAtoms
.id
- the event idDrawEvent
protected void preprocessEvent(int id, DrawAtom sender)
DrawAtom
itself
and by DrawAtom
where this
depends from. The method
will be called before events are filtered out.
This implementation of the method answers to the events
DrawEvent.DIRTY
,DrawEvent.HIDE
,DrawEvent.SHOW
sent
by other DrawAtoms
with the appropriate action
on this
DrawAtom
. To avoid that, simply overwrite this
method.id
- the event idsender
- the source of the eventDrawEvent
protected void dispatchEvent(java.awt.AWTEvent e)
e
.
DrawAtoms
deliver their events simply to their parent DrawAtoms
e
- event to dispatchprotected final RectangleShape getBounds()
DrawAtom
in absolute screen coordinates.DrawAtom
.protected final void setBounds(int x, int y, int w, int h)
DrawAtom
in absolute screen coordinates.
If the area is empty or negative, the DrawAtom
will have noprotected abstract void recalculate(RenderContext context)
DrawAtom
to recalculate its representation.
This method will only be called, if it became dirty via a call
to the #makeDirty_int
method (and #repaint
) or something
has happened, that causes all DrawAtoms
to recalculate
their representation.
This method should only be called by the render system.context
- the RenderContext
to useprotected void prepeareRenderContext(RenderContext context)
RenderContext
before recalulation or drawing
via a call to recalculate(gishur.gui2.RenderContext)
/draw(Graphics,RenderContext)
.context
- RenderContext
to prepeareprotected abstract void draw(java.awt.Graphics g, RenderContext context)
this
DrawAtom
to the given
Graphics
g
.
This method should only be called by the render system.g
- Graphics for drawingcontext
- the RenderContext
to useDrawException
- if invalid call to this methodpublic java.lang.String locate(int x, int y)
(x,y)
. If the point lies outside
of the DrawAtom's
bounds null
will be returned,
otherwise a String value will be returned that identifies
the part that hits the given point.
In this implementation of locate, simply a non-null String will
be returned if the point lies inside the boundaries of the object.
Overwrite this method in order to get more useful resultats.x,y
- point to locatenull
for no hit, otherwise the name of the
element that hits the point.public final List collectHits(int x, int y, List l)
DrawAtoms
rekursively that were hitted by the point
(x,y)
and stores them together with their locate(int, int)
-value
in the List
l
. The order in the list represents
the visibility order (the last painted object on top).x,y
- point to testl
- List where to store hitted DrawAtoms
(and their locate value)l
public java.awt.Component drawComponent()
DrawAtoms
draw on.DrawAtoms
draw onto.protected DisplayManager displayManager()
DisplayManager
that manages the redrawing.DisplayManager
.public final DrawProperties properties()
DrawProperties
object of this DrawAtom
.DrawAtom
.public final void setPropertiesTo(DrawProperties properties)
DrawProperties
object for this DrawAtom
.properties
- the new properties list for this DrawAtom
public final void addProperties(DrawProperties properties)
this
DrawAtoms
properties list. Already defined key were overwritten by this
operation.properties
- the properties list to add to this DrawAtom
public final java.lang.Object getProperty(java.lang.String key)
key
is mapped
in the properties list of this DrawAtom
or (if no properties list is
assigned or the key is not contained) of the parent DrawAtom
.key
- a key in the properties listnull
if the key
is not mapped to any value
in the properties lists of this object and parent object(s).public final java.lang.Object getProperty(java.lang.String key, java.lang.Object default_value)
key
is mapped
in the properties list of this DrawAtom
or (if no properties list is
assigned or the key is not contained) of the parent DrawAtom
. If
this properties is not set (on this DrawAtom
and all of its parents),
the specified default value for that property will be returned.key
- a key in the properties listdefault_value
- the default value for the property that will
be returned if the key is not mapped to a valuedefault_value
if the key
is not mapped to
any value in the properties lists of this object and parent object(s).public final java.lang.Object getRequiredProperty(java.lang.String key)
key
is mapped
in the properties list of this DrawAtom
or (if no properties list is
assigned or the key is not contained) of the parent DrawAtom
. If the
key was not found in any of the properties lists, a DrawException
will be thrown.key
- a key in the properties listDrawException
- if key not foundpublic final java.lang.Object getLocalProperty(java.lang.String key)
key
is mapped
in the properties list of this DrawAtom
. If this DrawAtom
has no
properties list or the specified key
is not contained,
null
will be returned.key
- a key in the properties listnull
if the key
is not mapped to any value
in this DrawAtoms
properties list.public final java.lang.Object setProperty(java.lang.String key, java.lang.Object value)
key
to the specified value in this
DrawAtom's
properties list. Neither the key
nor the value
can be null. If this
DrawAtom
has no properties list, a new
properties list will be created.key
- the properties keyvalue
- the valuenull
if it did not have one.public java.lang.Object removeProperty(java.lang.String key)
key
(and its corresponding value) from this
DrawAtom's
properties lies. This method does nothing if the key
is
not in this
DrawAtom's
properties list.key
- the key that needs to be removednull
if the key did not have a mappingpublic final void setProperty(java.lang.String key, boolean value)
key
to the specified value in this
DrawAtom's
properties list. The key
can not be null.
If this
DrawAtom
has no properties list, a new
properties list will be created.key
- the properties keyvalue
- the valuepublic final void setProperty(java.lang.String key, int value)
key
to the specified value in this
DrawAtom's
properties list. The key
can not be null.
If this
DrawAtom
has no properties list, a new
properties list will be created.key
- the properties keyvalue
- the valuepublic final void setProperty(java.lang.String key, double value)
key
to the specified value in this
DrawAtom's
properties list. The key
can not be null.
If this
DrawAtom
has no properties list, a new
properties list will be created.key
- the properties keyvalue
- the value
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |