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.command; |
16 | |
17 | import org.jdesktop.application.Action; |
18 | |
19 | import net.sourceforge.hiveevents.Channel; |
20 | //import net.sourceforge.hivegui.docking.DockingHelper; |
21 | |
22 | public class GeneralCommands extends AbstractCommandHolder |
23 | { |
24 | public GeneralCommands( Channel<Object> clearComments, |
25 | Channel<Object> clearNotifications, |
26 | Channel<Object> fullScreenMode, |
27 | Channel<Object> windowMode) |
28 | { |
29 | _clearComments = clearComments; |
30 | _clearNotifications = clearNotifications; |
31 | _fullScreenMode = fullScreenMode; |
32 | _windowMode = windowMode; |
33 | } |
34 | |
35 | @Action public void setAnyWriter() |
36 | { |
37 | // This action is a no-op |
38 | } |
39 | |
40 | @Action(enabledProperty = DRAW_BOARD_SELECTED) |
41 | public void print() |
42 | { |
43 | _application.showMessage("unimplemented-feature"); |
44 | // DockingHelper.trace(_application.getMainFrame().getContentPane(), ""); |
45 | } |
46 | |
47 | @Action(enabledProperty = DRAW_BOARD_SELECTED) |
48 | public void clearComments() |
49 | { |
50 | _clearComments.push(null); |
51 | } |
52 | |
53 | @Action public void clearNotifications() |
54 | { |
55 | _clearNotifications.push(null); |
56 | } |
57 | |
58 | @Action public void changeSelfPassword() |
59 | { |
60 | showDialog("change-password-panel"); |
61 | } |
62 | |
63 | @Action(enabledProperty = DRAW_BOARD_SELECTED) |
64 | public void switchScreenMode() |
65 | { |
66 | // In which mode are we currently? |
67 | if (_fullScreen) |
68 | { |
69 | // Full screen: pass back to window mode |
70 | _windowMode.push(null); |
71 | |
72 | } |
73 | else |
74 | { |
75 | // Window: pass back to full screen mode |
76 | _fullScreenMode.push(null); |
77 | } |
78 | _fullScreen = !_fullScreen; |
79 | } |
80 | |
81 | @Action public void showPreferences() |
82 | { |
83 | showDialog("preferences-panel"); |
84 | } |
85 | |
86 | @Action public void showAbout() |
87 | { |
88 | showDialog("about-panel"); |
89 | } |
90 | |
91 | final private Channel<Object> _clearComments; |
92 | final private Channel<Object> _clearNotifications; |
93 | final private Channel<Object> _fullScreenMode; |
94 | final private Channel<Object> _windowMode; |
95 | private boolean _fullScreen = false; |
96 | } |