KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > lobobrowser > html > renderer > BoundableRenderable


1 /*
2     GNU LESSER GENERAL PUBLIC LICENSE
3     Copyright (C) 2006 The Lobo Project
4
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Lesser General Public
7     License as published by the Free Software Foundation; either
8     version 2.1 of the License, or (at your option) any later version.
9
10     This library is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13     Lesser General Public License for more details.
14
15     You should have received a copy of the GNU Lesser General Public
16     License along with this library; if not, write to the Free Software
17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19     Contact info: xamjadmin@users.sourceforge.net
20 */

21 package org.lobobrowser.html.renderer;
22
23 import java.awt.*;
24 import java.awt.event.*;
25
26 import org.lobobrowser.html.domimpl.ModelNode;
27
28 /**
29  * A renderer node with well-defined bounds. Most renderer nodes
30  * implement this interface.
31  */

32 public interface BoundableRenderable extends Renderable {
33     public ModelNode getModelNode();
34     public Rectangle getBounds();
35     public Dimension getSize();
36     
37     /**
38      * Gets the parent where the renderable is rendered.
39      */

40     public RCollection getParent();
41     public void setOriginalParent(RCollection origParent);
42     
43     /**
44      * Gets the parent set with {@link #setOriginalParent(RCollection)}.
45      * It represents the parent where the renderable would have
46      * been originally rendered according to the DOM. This will
47      * be non-null only if {@link #getParent()} is not the parent
48      * where this renderable would have been originally rendered.
49      */

50     public RCollection getOriginalParent();
51     
52     /**
53      * Returns {@link #getOriginalParent()} if not null. Otherwise
54      * it returns {@link #getParent()}.
55      */

56     public RCollection getOriginalOrCurrentParent();
57     public void setBounds(int x, int y, int with, int height);
58     public void setOrigin(int x, int y);
59     public void setX(int x);
60     public void setY(int y);
61     public int getX();
62     public int getY();
63     public int getHeight();
64     public int getWidth();
65     public void setHeight(int height);
66     public void setWidth(int width);
67     public RenderableSpot getLowestRenderableSpot(int x, int y);
68     public Point getRenderablePoint(int guiX, int guiY);
69     public void repaint();
70     
71     /**
72      * Returns false if the event is consumed. True to propagate further.
73      */

74     public boolean onMousePressed(MouseEvent event, int x, int y);
75     public boolean onMouseReleased(MouseEvent event, int x, int y);
76     public boolean onMouseDisarmed(MouseEvent event);
77     public boolean onMouseClick(MouseEvent event, int x, int y);
78     public boolean onDoubleClick(MouseEvent event, int x, int y);
79         
80     /**
81      * Asks the Renderable to paint the selection between two
82      * points. Nothing will be done if the points are outside
83      * the Renderable.
84      * @param g
85      * @param inSelection
86      * @param startPoint
87      * @param endPoint
88      * @return True iff it's in selection when finished painting.
89      */

90     public boolean paintSelection(Graphics g, boolean inSelection, RenderableSpot startPoint, RenderableSpot endPoint);
91     
92     /**
93      * Paints by either creating a new clipped graphics context corresponding
94      * to the bounds of the Renderable, or by translating the origin.
95      * @param g Parent's Graphics context.
96      */

97     public void paintTranslated(Graphics g);
98     
99     public boolean extractSelectionText(StringBuffer JavaDoc buffer, boolean inSelection, RenderableSpot startPoint, RenderableSpot endPoint);
100     public void repaint(int x, int y, int width, int height);
101     public void relayout();
102     public void setParent(RCollection parent);
103     public java.awt.Point JavaDoc getGUIPoint(int clientX, int clientY);
104 }
105
Popular Tags