|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.malai.widget.WidgetUtilities
public class WidgetUtilities
This singleton provides common methods for widgets.
This file is part of Malai.
Copyright (c) 2009-2012 Arnaud BLOUIN
Malai is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later version.
Malai is distributed without any warranty; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
11/02/2010
Field Summary | |
---|---|
static WidgetUtilities |
INSTANCE
The singleton of the class. |
Constructor Summary | |
---|---|
protected |
WidgetUtilities()
Initialise the singleton. |
Method Summary | |
---|---|
void |
attachAddedComponent(SwingEventManager eventManager,
java.awt.Component comp)
Attaches the given component to the event manager of the panel if it exists. |
boolean |
contains(java.awt.Component[] subComponents,
java.lang.Object obj)
Tests if the given object is contained into the given components. |
boolean |
contains(java.awt.Component component,
double x,
double y)
Tests if the given point is into the pickable object. |
Pickable |
getPickableAt(java.awt.Component component,
java.awt.Component[] subComponents,
double x,
double y)
|
Picker |
getPicker(java.awt.Component component)
|
Picker |
getPickerAt(java.awt.Component component,
java.awt.Component[] subComponents,
double x,
double y)
|
java.awt.geom.Point2D |
getRelativePoint(java.awt.Component[] comps,
double x,
double y,
java.lang.Object o)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final WidgetUtilities INSTANCE
Constructor Detail |
---|
protected WidgetUtilities()
Method Detail |
---|
public boolean contains(java.awt.Component[] subComponents, java.lang.Object obj)
subComponents
- The components to test.obj
- The object to test.
public boolean contains(java.awt.Component component, double x, double y)
component
- The concerned widget.x
- The x-coordinate of the point to test.y
- The y-coordinate of the point to test.
public Picker getPicker(java.awt.Component component)
component
- The concerned widget.
public Picker getPickerAt(java.awt.Component component, java.awt.Component[] subComponents, double x, double y)
component
- The component to test.subComponents
- The sub-components of the given component.x
- The x-coordinate to test.y
- The Y-coordinate to test.
public Pickable getPickableAt(java.awt.Component component, java.awt.Component[] subComponents, double x, double y)
component
- The concerned widget.subComponents
- All the components that contains the given component.x
- The x-coordinate of the position used to get the pickable object.y
- The y-coordinate of the position used to get the pickable object.
public java.awt.geom.Point2D getRelativePoint(java.awt.Component[] comps, double x, double y, java.lang.Object o)
comps
- The components contained by a widget.x
- The x-coordinate of the position to convert.y
- The y-coordinate of the position to convert.o
- An object contained by the calling picker. This function will computed the real position of the given
point in o
.
o1
that contains an other object o2
at position (10, 10)
. o1.getRelativePoint(30, 30, o2)
will return (20, 20)
.public void attachAddedComponent(SwingEventManager eventManager, java.awt.Component comp)
comp
- The component to attach.eventManager
- The event manager where the given component will be attached.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |