01: /*
02: * Copyright 2001-2006 C:1 Financial Services GmbH
03: *
04: * This software is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License Version 2.1, as published by the Free Software Foundation.
07: *
08: * This software is distributed in the hope that it will be useful,
09: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11: * Lesser General Public License for more details.
12: *
13: * You should have received a copy of the GNU Lesser General Public
14: * License along with this library; if not, write to the Free Software
15: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
16: */
17:
18: package de.finix.contelligent.client.gui.explorer;
19:
20: import java.awt.event.ActionEvent;
21:
22: import javax.swing.AbstractAction;
23:
24: import de.finix.contelligent.client.base.ComponentFactory;
25: import de.finix.contelligent.client.base.ContelligentComponent;
26: import de.finix.contelligent.client.gui.ContelligentAction;
27: import de.finix.contelligent.client.i18n.Resources;
28:
29: public class UpdateTypeAction extends AbstractAction implements
30: ContelligentAction {
31: /**
32: *
33: */
34: private final ExplorerEditor editor;
35:
36: public UpdateTypeAction(ExplorerEditor editor) {
37: super ("update_blueprint", Resources.defaultViewIcon);
38: this .editor = editor;
39: putValue(ROLLOVER_ICON, Resources.defaultViewIcon);
40: putValue(TYPE, PUSH_ACTION);
41: putValue(ACTION_TYPE, EDIT_ACTION);
42: putValue(ACTION_GROUP, EDIT_BLUEPRINT_GROUP);
43: putValue(ACTION_POS, EDIT_BLUEPRINT_UPDATE);
44: putValue(MENU_TARGET, NO_MENU);
45: putValue(BUTTON_TARGET, NO_BUTTON);
46: putValue(POPUP_TARGET, POPUP_SUBMENU);
47: putValue(POPUP_PARENT_ACTION, this .editor.typeAction);
48: }
49:
50: public void actionPerformed(ActionEvent e) {
51: this .editor.createType("update");
52: }
53:
54: public void update() {
55: ContelligentComponent component = this .editor
56: .getSelectedComponent();
57: boolean canDefine = component != null
58: && component.isBlueprint()
59: && !component.isBlueprintInstance()
60: && !component.isBlueprintInstanceSubComponent()
61: && !component.isBlueprintSubComponent()
62: && !this.editor.getView().isEditInProgress()
63: && this.editor.getView().getAllowBlueprintDefinition()
64: && ComponentFactory.getInstance().isRootContext();
65: setEnabled(canDefine);
66: }
67: }
|