001 /* 002 * Copyright 2002-2004 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 005 * use this file except in compliance with the License. You may obtain a copy of 006 * the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 013 * License for the specific language governing permissions and limitations under 014 * the License. 015 */ 016 package org.springframework.richclient.command; 017 018 import java.util.List; 019 020 import javax.swing.Box; 021 022 import org.springframework.richclient.command.config.CommandButtonConfigurer; 023 024 /** 025 * A member of a {@link CommandGroup} that represents a 'glue' component between other members 026 * of the group. 027 * 028 * <p> 029 * A glue component is most often used as a filler between other components in a layout where those 030 * components cannot expand beyound a maximum height or width. As the layout area expands, the glue 031 * component will expand to take up the space. 032 * </p> 033 * 034 * @see Box#createGlue() 035 */ 036 public class GlueGroupMember extends GroupMember { 037 038 /** 039 * Creates a new uninitialized {@code GlueGroupMember}. 040 */ 041 public GlueGroupMember() { 042 //do nothing 043 } 044 045 /** 046 * Adds a glue component using the given container populator. 047 * 048 * {@inheritDoc} 049 */ 050 protected void fill(GroupContainerPopulator parentContainer, 051 Object factory, 052 CommandButtonConfigurer configurer, 053 List previousButtons) { 054 parentContainer.add(Box.createGlue()); 055 } 056 057 /** 058 * Always returns false. A glue group member does not manage any commands. 059 * @return false always. 060 */ 061 public final boolean managesCommand(String commandId) { 062 return false; 063 } 064 065 /** 066 * Default implemenation, performs no operation. 067 */ 068 public void setEnabled(boolean enabled) { 069 // do nothing 070 } 071 072 }