001 /*
002 * Created on Dec 11, 2004
003 *
004 * Copyright 2004 Chris Nelson
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 http://www.apache.org/licenses/LICENSE-2.0
009 * Unless required by applicable law or agreed to in writing,
010 * software distributed under the License is distributed on an "AS IS" BASIS,
011 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012 * See the License for the specific language governing permissions and limitations under the License.
013 */
014 package org.trails.component;
015
016 import org.trails.descriptor.IMethodDescriptor;
017 import org.trails.page.ModelPage;
018
019 import java.util.ArrayList;
020 import java.util.List;
021
022 public abstract class ObjectActions extends AbstractObjectRenderComponent
023 {
024
025 public List<IMethodDescriptor> getMethodDescriptors()
026 {
027 List<IMethodDescriptor> displayingPropertyDescriptors = new ArrayList<IMethodDescriptor>();
028 for (IMethodDescriptor methodDescriptor : getClassDescriptor().getMethodDescriptors())
029 {
030 if (!methodDescriptor.isHidden())
031 {
032 displayingPropertyDescriptors.add(methodDescriptor);
033 }
034 }
035 return displayingPropertyDescriptors;
036 }
037
038 public boolean isShowRemoveButton()
039 {
040 ModelPage page = (ModelPage) getPage();
041 return page != null && page.getClassDescriptor().isAllowRemove() && !page.isModelNew();
042 }
043
044 }