public abstract class TICComponent extends Object
Constructor and Description |
---|
TICComponent()
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
void |
addKeyListener(TICKeyListener listener) |
void |
addMouseListener(TICMouseListener listener) |
void |
assignSize()
Adopts the current component size to the underlying GUI toolkit, if a toolkit specific component
has already been created.
|
JComponent |
createSwingComponent()
Creates the Swing component that will be associated with this instance if it was not created before.
|
Composite |
createSWTWidget(Composite parent,
int style)
Creates the SWT component that will be associated with this instance if it was not created before.
|
protected JComponent |
doCreateSwingComponent()
Method that creates a new instance of the associated Swing component.
|
protected Composite |
doCreateSWTWidget(Composite parent,
int style)
Method that creates a new instance of the associated SWT component.
|
TargetToolkit |
getCurrentToolkit()
Returns the toolkit the associated toolkit class belongs to.
|
Point |
getLocationInParent()
Returns the location of this component in the coordinate space of the parent component.
|
abstract Dimension |
getSize()
Returns the size this objects uses to be painted completely.
|
ToolkitComponent |
getToolkitComponent()
Returns a toolkit specific component used to display the contents of this class.
|
boolean |
hasToolkitComponent()
Checks if an associated toolkit specific component has already been assigned to this instance.
|
abstract void |
paint(TICPaintEvent event)
Painting operations of the implementing class should be performed here, if a toolkit independent
painting method is provided.
|
boolean |
removeKeyListener(TICKeyListener listener) |
boolean |
removeMouseListener(TICMouseListener listener) |
void |
repaint()
Forces the underlying toolkit component to be repainted.
|
public TICComponent()
public TargetToolkit getCurrentToolkit()
TargetToolkit.UNDEFINED
if no toolkit specific
implementation has yet been assignedpublic abstract void paint(TICPaintEvent event)
If implementing classes provide custom toolkit specific components by overwriting
doCreateSwingComponent()
and doCreateSWTWidget(Composite, int)
the
implementation of this method can be empty.
graphics
- the graphics context used to perform the paint operations in Swing and SWTpublic abstract Dimension getSize()
Note that the associated graphical component might be contained in a scroll container and the actual area displayed in the screen can be smaller than the dimension returned here.
public void repaint()
hasToolkitComponent()
return
true
).public void assignSize()
public Point getLocationInParent()
null
if neither a Swing nor a SWT component has yet been created.public ToolkitComponent getToolkitComponent()
null
if neither createSwingComponent()
nor
createSWTWidget(Composite, int)
have been called previouslypublic boolean hasToolkitComponent()
true
if a component has been assigned, false
otherwiseprotected JComponent doCreateSwingComponent()
createSwingComponent()
internally.
Overwrite this method if you want to provide custom toolkit specific implementations.
IMPORTANT: The returned instances must implement the interface ToolkitComponent
.
ToolkitComponent
public JComponent createSwingComponent()
getToolkitComponent()
from now on. Subsequent
calls of this method will return the same instance again.
Note that this method can only be called if createSWTWidget(Composite, int)
has not been called
before.
If you want to provide a custom Swing component overwrite doCreateSwingComponent()
instead of this method.
IllegalStateException
- if createSWTWidget(Composite, int)
has been called beforeprotected Composite doCreateSWTWidget(Composite parent, int style)
createSWTWidget(org.eclipse.swt.widgets.Composite, int)
internally.
Overwrite this method if you want to provide custom toolkit specific implementations.
IMPORTANT: The returned instances must implement the interface ToolkitComponent
.
ToolkitComponent
public Composite createSWTWidget(Composite parent, int style)
getToolkitComponent()
from now on. Subsequent
calls of this method will return the same instance again. The specified parameters will not be
considered in that case.
Note that this method can only be called if createSWTWidget(Composite, int)
has not been called
before.
If you want to provide a custom Swing component overwrite doCreateSwingComponent()
instead of this method.
IllegalStateException
- if createSWTWidget(Composite, int)
has been called beforepublic void addKeyListener(TICKeyListener listener)
public boolean removeKeyListener(TICKeyListener listener)
public void addMouseListener(TICMouseListener listener)
public boolean removeMouseListener(TICMouseListener listener)