01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: EditorView.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.gui.ui;
09:
10: import java.awt.*;
11: import javax.swing.*;
12:
13: public abstract class EditorView extends JPanel {
14: private EditorPane mPane = null;
15: private int mWidth = 0;
16: private int mHeight = 0;
17: private boolean mScrollActive = false;
18:
19: private EditorView() {
20: }
21:
22: protected EditorView(EditorPane pane) {
23: this .mPane = pane;
24: this .setDoubleBuffered(true);
25: this .setOpaque(true);
26:
27: this .calculateDimension();
28: }
29:
30: public EditorPane getPane() {
31: return mPane;
32: }
33:
34: protected abstract Dimension calculateDimensionReal();
35:
36: protected void calculateDimension() {
37: Dimension dimension = this .calculateDimensionReal();
38: this .mWidth = (int) dimension.getWidth();
39: this .mHeight = (int) dimension.getHeight();
40: }
41:
42: public int getCalculatedWidth() {
43: return mWidth;
44: }
45:
46: public int getCalculatedHeight() {
47: return mHeight;
48: }
49:
50: public Dimension getMinimumSize() {
51: return new Dimension(mWidth, mHeight);
52: }
53:
54: public Dimension getPreferredSize() {
55: return new Dimension(mWidth, mHeight);
56: }
57:
58: public boolean isScrollActive() {
59: return mScrollActive;
60: }
61:
62: public void setScrollActive(boolean active) {
63: mScrollActive = active;
64: }
65: }
|