01: /*
02: * Copyright 2006-2007 Pentaho Corporation. All rights reserved.
03: * This software was developed by Pentaho Corporation and is provided under the terms
04: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
05: * this file except in compliance with the license. If you need a copy of the license,
06: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt.
07: *
08: * Software distributed under the Mozilla Public License is distributed on an "AS IS"
09: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
10: * the license for the specific language governing your rights and limitations.
11: *
12: * Additional Contributor(s): Martin Schmid gridvision engineering GmbH
13: */
14: package org.pentaho.reportdesigner.lib.client.commands;
15:
16: import org.jetbrains.annotations.NonNls;
17: import org.jetbrains.annotations.NotNull;
18: import org.jetbrains.annotations.Nullable;
19:
20: import javax.swing.*;
21:
22: /**
23: * User: Martin
24: * Date: 21.11.2004
25: * Time: 10:47:22
26: */
27: public abstract class AbstractCommand implements Command {
28: @NotNull
29: private TemplatePresentation templatePresentation;
30: @NotNull
31: private String name;
32:
33: protected AbstractCommand(@NotNull
34: @NonNls
35: String name) {
36: this .name = name;
37:
38: templatePresentation = new TemplatePresentation(this , "", "",
39: false, true);
40:
41: //ensure that an icon is set for the most common cases, this makes the "bad looking" look and feels a bit better. metal/ocean indents menus in an ugly way.
42: templatePresentation.setIcon(CommandSettings.SIZE_16,
43: new ImageIcon(AbstractCommand.class
44: .getResource("Empty16.png")));//NON-NLS
45: templatePresentation.setIcon(CommandSettings.SIZE_32,
46: new ImageIcon(AbstractCommand.class
47: .getResource("Empty32.png")));//NON-NLS
48: templatePresentation.setIcon(CommandSettings.SIZE_64,
49: new ImageIcon(AbstractCommand.class
50: .getResource("Empty64.png")));//NON-NLS
51: }
52:
53: @NotNull
54: public TemplatePresentation getTemplatePresentation() {
55: return templatePresentation;
56: }
57:
58: @NotNull
59: public String getName() {
60: return name;
61: }
62:
63: @Nullable
64: public JComponent getCustomComponent(@NotNull
65: Presentation presentation) {
66: return null;
67: }
68:
69: }
|