|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.alchemy.core.AlcModule
public abstract class AlcModule
The Alchemy Module Class
This is an 'abstract class' that must be extended to create an Alchemy module.
This class takes care of basic functionality such as module loading and passing on mouse and other events.
It also has access to a bunch of other useful classes such as AlcCanvas
, AlcMath
etc...
Field Summary | |
---|---|
protected static AlcCanvas |
canvas
Access to the Alchemy canvas |
protected static AlcColorSelector |
colorSelector
Access to the Alchemy color selector |
protected static AlcMath |
math
Access to the Alchemy math class |
protected static AlcAbstractToolBar |
toolBar
Access to the Alchemy toolBar |
Constructor Summary | |
---|---|
AlcModule()
|
Method Summary | |
---|---|
protected void |
affect()
Apply affect. |
protected void |
cleared()
Called when the canvas is cleared. |
protected void |
commited()
Called after all shapes are commited to the buffer. |
protected void |
deselect()
Called when the module is deselected. |
protected java.lang.ClassLoader |
getClassLoader()
Returns the classloader to load resources from the plugin .zip |
protected java.lang.String |
getDescription()
Get the description of this module as defined in it's plugin.xml file. |
protected java.lang.String |
getIconName()
Get the icon name as defined in it's plugin.xml file. |
protected java.net.URL |
getIconUrl()
Get the Icon URL from within the module's .zip file. |
protected int |
getIndex()
Get the index of this module in either the 'creates' or 'affects' arraylist |
protected boolean |
getLoaded()
Loaded state of this module |
protected int |
getModuleType()
Get the type of module |
protected java.lang.String |
getName()
Get the name of this module as defined in it's plugin.xml file. |
void |
keyPressed(java.awt.event.KeyEvent e)
Called when a key is pressed, only when the module is active. |
void |
keyReleased(java.awt.event.KeyEvent e)
Called when a key is released, only when the module is active. |
void |
keyTyped(java.awt.event.KeyEvent e)
Called when a key is typed, only when the module is active. |
void |
mouseClicked(java.awt.event.MouseEvent e)
Called when the mouse is clicked, only if the module is active. |
void |
mouseDragged(java.awt.event.MouseEvent e)
Called when the mouse is Dragged, only if the module is active. |
void |
mouseEntered(java.awt.event.MouseEvent e)
Called when the mouse enters the canvas, only if the module is active. |
void |
mouseExited(java.awt.event.MouseEvent e)
Called when the mouse exits the canvas, only if the module is active. |
void |
mouseMoved(java.awt.event.MouseEvent e)
Called when the mouse is moved, only if the module is active. |
void |
mousePressed(java.awt.event.MouseEvent e)
Called when the mouse is pressed, only if the module is active. |
void |
mouseReleased(java.awt.event.MouseEvent e)
Called when the mouse is released, only if the module is active. |
protected void |
reselect()
Called when the module is reselected in the menu. |
protected void |
setup()
Called when the module is first selected in the menu. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static AlcCanvas canvas
protected static AlcAbstractToolBar toolBar
protected static AlcMath math
protected static AlcColorSelector colorSelector
Constructor Detail |
---|
public AlcModule()
Method Detail |
---|
protected void setup()
It will only be called once, so is useful for doing stuff like loading interface elements into the menu bar etc....
This function should be used instead of a constructor.
protected void reselect()
protected void deselect()
protected void cleared()
You might sometimes need to use this function if for example you are counting the number of shapes and you want to know when to reset the count to zero.
protected void commited()
To keep things speedy, shapes are committed to an image buffer when possible so they do not need to be redraw each and every time. When this happens, the shape will be moved to the shapes array and seemingly dissappear. This function is used to warn each module of dissappearing shapes.
protected void affect()
Called for every active affect module, before the canvas is redrawn. This is used by affect modules to 'affect' a shape i.e. apply some sort of change to it. Typically the affect module will work with all shapes in the canvas.createShapes array then either replace them or add new shapes to the canvas.affectShapes array.
protected java.lang.String getName()
// Will return the text from the XML node below:
<parameter id="name" value="This is my name"/>
protected int getIndex()
protected int getModuleType()
AlcConstants.MODULE_CREATE
or AlcConstants.MODULE_AFFECT
protected boolean getLoaded()
protected java.lang.ClassLoader getClassLoader()
protected java.lang.String getIconName()
// Will return the name of the icon file below:
<parameter id="icon" value="icon.png" />
protected java.net.URL getIconUrl()
// Will return a URL object to the icon file below:
<parameter id="icon" value="icon.png" />
protected java.lang.String getDescription()
// Will return the text from the XML node below:
<parameter id="description" value="This is where the description lives!" />
public void mousePressed(java.awt.event.MouseEvent e)
e
- The MouseEvent
containing location data.
Useful things you can do with the MouseEvent passed in:
// Get the x location int x = e.getX(); // Get the y location int y = e.getY(); // Get the location as a point Point p = e.getPoint();
public void mouseMoved(java.awt.event.MouseEvent e)
e
- The MouseEvent
containing location data.
Useful things you can do with the MouseEvent passed in:
// Get the x location int x = e.getX(); // Get the y location int y = e.getY(); // Get the location as a point Point p = e.getPoint();
public void mouseClicked(java.awt.event.MouseEvent e)
e
- The MouseEvent
containing location data.
Useful things you can do with the MouseEvent passed in:
// Get the x location int x = e.getX(); // Get the y location int y = e.getY(); // Get the location as a point Point p = e.getPoint();
public void mouseDragged(java.awt.event.MouseEvent e)
e
- The MouseEvent
containing location data.
Useful things you can do with the MouseEvent passed in:
// Get the x location int x = e.getX(); // Get the y location int y = e.getY(); // Get the location as a point Point p = e.getPoint();
public void mouseReleased(java.awt.event.MouseEvent e)
e
- The MouseEvent
containing location data.
Useful things you can do with the MouseEvent passed in:
// Get the x location int x = e.getX(); // Get the y location int y = e.getY(); // Get the location as a point Point p = e.getPoint();
public void mouseEntered(java.awt.event.MouseEvent e)
e
- The MouseEvent
containing location data.
Useful things you can do with the MouseEvent passed in:
// Get the x location int x = e.getX(); // Get the y location int y = e.getY(); // Get the location as a point Point p = e.getPoint();
public void mouseExited(java.awt.event.MouseEvent e)
e
- The MouseEvent
containing location data.
Useful things you can do with the MouseEvent passed in:
// Get the x location int x = e.getX(); // Get the y location int y = e.getY(); // Get the location as a point Point p = e.getPoint();
public void keyPressed(java.awt.event.KeyEvent e)
e
- The KeyEvent
containing key data.
Useful things you can do with the KeyEvent passed in:
// Get the character of the key pressed eg "A" char keyChar = e.getKeyChar(); // Get the key code of the key pressed eg 68 int keyCode = e.getKeyCode(); // Get the text of the key pressed eg "F1" String keyText = e.getKeyText(keyCode);
public void keyReleased(java.awt.event.KeyEvent e)
e
- The KeyEvent
containing key data.
Useful things you can do with the KeyEvent passed in:
// Get the character of the key pressed eg "A" char keyChar = e.getKeyChar(); // Get the key code of the key pressed eg 68 int keyCode = e.getKeyCode(); // Get the text of the key pressed eg "F1" String keyText = e.getKeyText(keyCode);
public void keyTyped(java.awt.event.KeyEvent e)
e
- The KeyEvent
containing key data.
Useful things you can do with the KeyEvent passed in:
// Get the character of the key pressed eg "A" char keyChar = e.getKeyChar(); // Get the key code of the key pressed eg 68 int keyCode = e.getKeyCode(); // Get the text of the key pressed eg "F1" String keyText = e.getKeyText(keyCode);
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |