001: /**
002: * L2FProd.com Common Components 7.3 License.
003: *
004: * Copyright 2005-2007 L2FProd.com
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: */package com.l2fprod.common.springrcp;
018:
019: import com.l2fprod.common.swing.JTaskPaneGroup;
020:
021: import java.util.ArrayList;
022: import java.util.Iterator;
023: import java.util.List;
024:
025: import org.springframework.richclient.command.ActionCommand;
026: import org.springframework.richclient.command.CommandGroup;
027: import org.springframework.richclient.command.CommandRegistry;
028: import org.springframework.richclient.command.SwingActionAdapter;
029:
030: public class JTaskPaneGroupCommandGroup extends CommandGroup {
031:
032: private List actions = new ArrayList();
033:
034: private boolean expanded;
035: private boolean special;
036: private boolean scrollOnExpand;
037: private boolean animated;
038:
039: public JTaskPaneGroupCommandGroup(String groupId,
040: CommandRegistry registry) {
041: super (groupId, registry);
042: }
043:
044: public void setExpanded(boolean expanded) {
045: if (hasChanged(isExpanded(), expanded)) {
046: this .expanded = expanded;
047: firePropertyChange(JTaskPaneGroup.EXPANDED_CHANGED_KEY,
048: !expanded, expanded);
049: }
050: }
051:
052: public boolean isExpanded() {
053: return expanded;
054: }
055:
056: public boolean isAnimated() {
057: return animated;
058: }
059:
060: public void setAnimated(boolean animated) {
061: if (hasChanged(isAnimated(), animated)) {
062: this .animated = animated;
063: firePropertyChange(JTaskPaneGroup.ANIMATED_CHANGED_KEY,
064: !animated, animated);
065: }
066: }
067:
068: public boolean isScrollOnExpand() {
069: return scrollOnExpand;
070: }
071:
072: public void setScrollOnExpand(boolean scrollOnExpand) {
073: if (hasChanged(isScrollOnExpand(), scrollOnExpand)) {
074: this .scrollOnExpand = scrollOnExpand;
075: firePropertyChange(
076: JTaskPaneGroup.SCROLL_ON_EXPAND_CHANGED_KEY,
077: !scrollOnExpand, scrollOnExpand);
078: }
079: }
080:
081: public boolean isSpecial() {
082: return special;
083: }
084:
085: public void setSpecial(boolean special) {
086: if (hasChanged(isSpecial(), special)) {
087: this .special = special;
088: firePropertyChange(JTaskPaneGroup.SPECIAL_CHANGED_KEY,
089: !special, special);
090: }
091: }
092:
093: public JTaskPaneGroup createTaskPaneGroup() {
094: JTaskPaneGroup taskpane = new JTaskPaneGroup();
095: taskpane.setExpanded(isExpanded());
096: taskpane.setTitle(getText());
097: taskpane.setAnimated(isAnimated());
098: taskpane.setScrollOnExpand(isScrollOnExpand());
099: taskpane.setSpecial(isSpecial());
100: if (isFaceConfigured()) {
101: taskpane.setToolTipText(getFaceDescriptor().getCaption());
102: }
103:
104: for (Iterator members = actions.iterator(); members.hasNext();) {
105: ActionCommand member = (ActionCommand) members.next();
106:
107: SwingActionAdapter adapter = new SwingActionAdapter(member);
108: taskpane.add(adapter);
109: }
110: return taskpane;
111: }
112:
113: public void addActionCommand(ActionCommand command) {
114: super.add(command);
115: actions.add(command);
116: }
117:
118: }
|