01: /*--------------------------------------------------------------------------*
02: | Copyright (C) 2006 Christopher Kohlhaas, Bettina Lademann |
03: | |
04: | This program is free software; you can redistribute it and/or modify |
05: | it under the terms of the GNU General Public License as published by the |
06: | Free Software Foundation. A copy of the license has been included with |
07: | these distribution in the COPYING file, if not go to www.fsf.org |
08: | |
09: | As a special exception, you are granted the permissions to link this |
10: | program with every library, which license fulfills the Open Source |
11: | Definition as published by the Open Source Initiative (OSI). |
12: *--------------------------------------------------------------------------*/
13: package org.rapla.gui.internal.action;
14:
15: import java.awt.event.ActionEvent;
16:
17: import org.rapla.framework.RaplaContext;
18: import org.rapla.framework.RaplaException;
19: import org.rapla.gui.RaplaAction;
20: import org.rapla.gui.internal.common.CalendarSelectionModel;
21:
22: public class OnlyMyAction extends RaplaAction {
23: CalendarSelectionModel model;
24:
25: public OnlyMyAction(RaplaContext sm, CalendarSelectionModel model)
26: throws RaplaException {
27: super (sm);
28: this .model = model;
29: this .setEnabled(true);
30: putValue(NAME, getString("only_own_reservations"));
31: //putValue(SMALL_ICON,getIcon("icon.filter"));
32: }
33:
34: public CalendarSelectionModel getModel() {
35: return model;
36: }
37:
38: public void setModel(CalendarSelectionModel model) {
39: }
40:
41: public void actionPerformed(ActionEvent evt) {
42: try {
43: boolean isSelected = model.isOnlyCurrentUserSelected();
44: if (!isSelected) {
45: model.selectUser(getUser());
46: } else {
47: model.selectUser(null);
48: }
49: firePropertyChange("model", new Object(), model);
50: } catch (RaplaException ex) {
51: }
52:
53: }
54:
55: }
|