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;
14:
15: import java.awt.Component;
16: import java.awt.Point;
17: import java.util.Collection;
18: import java.util.Collections;
19:
20: import org.rapla.framework.RaplaContext;
21: import org.rapla.framework.RaplaDefaultContext;
22:
23: public class MenuContext extends RaplaDefaultContext {
24: public static String PARENT_COMPONENT = "parent_component";
25: public static String POPUP_POINT = "popup_point";
26: public static String FOCUSED_OBJECT = "menu_object";
27: public static String SELECTED_OBJECTS = "selected_objects";
28:
29: public MenuContext(RaplaContext parentContext, Object focusedObject) {
30: this (parentContext, focusedObject, null, null);
31: }
32:
33: public MenuContext(RaplaContext parentContext,
34: Object focusedObject, Component parent, Point p) {
35: super (parentContext);
36: put(FOCUSED_OBJECT, focusedObject);
37: put(PARENT_COMPONENT, parent);
38: put(POPUP_POINT, p);
39: put(SELECTED_OBJECTS, Collections.EMPTY_LIST);
40: }
41:
42: public void setSelectedObjects(Collection selectedObjects) {
43: put(SELECTED_OBJECTS, selectedObjects);
44: }
45:
46: public Collection getSelectedObjects() {
47: return (Collection) getUnsave(SELECTED_OBJECTS);
48: }
49:
50: public Point getPoint() {
51: return (Point) getUnsave(POPUP_POINT);
52:
53: }
54:
55: public Component getComponent() {
56: return (Component) getUnsave(PARENT_COMPONENT);
57: }
58:
59: public Object getFocusedObject() {
60: return getUnsave(FOCUSED_OBJECT);
61: }
62:
63: }
|