01 /*
02 * Copyright 2008-2016 the original author or authors.
03 *
04 * Licensed under the Apache License, Version 2.0 (the "License");
05 * you may not use this file except in compliance with the License.
06 * You may obtain a copy of the License at
07 *
08 * http://www.apache.org/licenses/LICENSE-2.0
09 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.codehaus.griffon.runtime.core.controller;
17
18 import griffon.core.artifact.GriffonController;
19 import griffon.core.controller.Action;
20 import griffon.core.controller.ActionManager;
21
22 import javax.annotation.Nonnull;
23 import javax.annotation.Nullable;
24
25 import static java.util.Objects.requireNonNull;
26
27 /**
28 * @author Andres Almiray
29 * @since 2.2.0
30 */
31 public class ActionDecorator implements Action {
32 private final Action delegate;
33
34 public ActionDecorator(@Nonnull Action delegate) {
35 this.delegate = requireNonNull(delegate, "Argument 'delegate' must not be null");
36 }
37
38 @Nonnull
39 @Override
40 public String getActionName() {
41 return delegate.getActionName();
42 }
43
44 @Nonnull
45 @Override
46 public String getFullyQualifiedName() {
47 return delegate.getFullyQualifiedName();
48 }
49
50 @Nullable
51 @Override
52 public String getName() {
53 return delegate.getName();
54 }
55
56 @Override
57 public void setName(@Nullable String name) {
58 delegate.setName(name);
59 }
60
61 @Override
62 public boolean isEnabled() {
63 return delegate.isEnabled();
64 }
65
66 @Override
67 public void setEnabled(boolean enabled) {
68 delegate.setEnabled(enabled);
69 }
70
71 @Nonnull
72 @Override
73 public ActionManager getActionManager() {
74 return delegate.getActionManager();
75 }
76
77 @Nonnull
78 @Override
79 public GriffonController getController() {
80 return delegate.getController();
81 }
82
83 @Nonnull
84 @Override
85 public Object getToolkitAction() {
86 return delegate.getToolkitAction();
87 }
88
89 @Override
90 public void execute(Object... args) {
91 delegate.execute(args);
92 }
93
94 @Override
95 public void initialize() {
96 delegate.initialize();
97 }
98 }
|