001 /*
002 * SPDX-License-Identifier: Apache-2.0
003 *
004 * Copyright 2008-2017 the original author or authors.
005 *
006 * Licensed under the Apache License, Version 2.0 (the "License");
007 * you may not use this file except in compliance with the License.
008 * You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018 package org.codehaus.griffon.runtime.core.controller;
019
020 import griffon.core.artifact.GriffonController;
021 import griffon.core.controller.Action;
022 import griffon.core.controller.ActionManager;
023 import griffon.core.controller.ActionMetadata;
024
025 import javax.annotation.Nonnull;
026 import javax.annotation.Nullable;
027
028 import static java.util.Objects.requireNonNull;
029
030 /**
031 * @author Andres Almiray
032 * @since 2.2.0
033 */
034 public class ActionDecorator implements Action {
035 private final Action delegate;
036
037 public ActionDecorator(@Nonnull Action delegate) {
038 this.delegate = requireNonNull(delegate, "Argument 'delegate' must not be null");
039 }
040
041 @Nonnull
042 @Override
043 public ActionMetadata getActionMetadata() {
044 return delegate.getActionMetadata();
045 }
046
047 @Nonnull
048 @Override
049 public String getActionName() {
050 return delegate.getActionName();
051 }
052
053 @Nonnull
054 @Override
055 public String getFullyQualifiedName() {
056 return delegate.getFullyQualifiedName();
057 }
058
059 @Nullable
060 @Override
061 public String getName() {
062 return delegate.getName();
063 }
064
065 @Override
066 public void setName(@Nullable String name) {
067 delegate.setName(name);
068 }
069
070 @Override
071 public boolean isEnabled() {
072 return delegate.isEnabled();
073 }
074
075 @Override
076 public void setEnabled(boolean enabled) {
077 delegate.setEnabled(enabled);
078 }
079
080 @Nonnull
081 @Override
082 public ActionManager getActionManager() {
083 return delegate.getActionManager();
084 }
085
086 @Nonnull
087 @Override
088 public GriffonController getController() {
089 return delegate.getController();
090 }
091
092 @Nonnull
093 @Override
094 public Object getToolkitAction() {
095 return delegate.getToolkitAction();
096 }
097
098 @Override
099 public void execute(Object... args) {
100 delegate.execute(args);
101 }
102
103 @Override
104 public void initialize() {
105 delegate.initialize();
106 }
107 }
|