1 | // Copyright 2004-2007 Jean-Francois Poilpret |
2 | // |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
4 | // you may not use this file except in compliance with the License. |
5 | // You may obtain a copy of the License at |
6 | // |
7 | // http://www.apache.org/licenses/LICENSE-2.0 |
8 | // |
9 | // Unless required by applicable law or agreed to in writing, software |
10 | // distributed under the License is distributed on an "AS IS" BASIS, |
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | // See the License for the specific language governing permissions and |
13 | // limitations under the License. |
14 | |
15 | package net.sourceforge.hiveboard.view; |
16 | |
17 | import java.awt.Graphics2D; |
18 | |
19 | import javax.swing.JComponent; |
20 | |
21 | import org.jdesktop.animation.timing.Animator; |
22 | |
23 | public final class MattePainterManager extends AbstractMattePainter |
24 | { |
25 | public MattePainterManager(JComponent pane) |
26 | { |
27 | setPane(pane); |
28 | // Initialize all painters |
29 | _scrollPainter = new ScrollingMattePainter(); |
30 | _fixedPainter = new FixedMattePainter(); |
31 | } |
32 | |
33 | @Override public Animator createAnimator(FullScreenPrefs prefs, String content) |
34 | { |
35 | if (prefs.isAutoScroll()) |
36 | { |
37 | _painter = _scrollPainter; |
38 | } |
39 | else |
40 | { |
41 | _painter = _fixedPainter; |
42 | } |
43 | _painter.setPane(getPane()); |
44 | return _painter.createAnimator(prefs, content); |
45 | } |
46 | |
47 | @Override public void paint(Graphics2D graf) |
48 | { |
49 | _painter.paint(graf); |
50 | } |
51 | |
52 | final private AbstractMattePainter _scrollPainter; |
53 | final private AbstractMattePainter _fixedPainter; |
54 | |
55 | private AbstractMattePainter _painter; |
56 | } |