001 package org.springframework.richclient.application.support;
002
003 import com.jgoodies.forms.layout.CellConstraints;
004 import com.jgoodies.forms.layout.FormLayout;
005 import org.springframework.richclient.command.CommandGroup;
006 import org.springframework.richclient.command.CommandGroupJComponentBuilder;
007
008 import javax.swing.*;
009
010 /**
011 * Abstract class for views that use some sort of navigation component for the overall application.
012 */
013 public abstract class AbstractNavigatorView extends AbstractView
014 {
015 private CommandGroup currentNavigation;
016
017 protected AbstractNavigatorView(CommandGroup currentNavigation)
018 {
019 this.currentNavigation = currentNavigation;
020 }
021
022 public abstract CommandGroupJComponentBuilder getNavigationBuilder();
023
024 protected JComponent createControl()
025 {
026 JPanel navigationView = new JPanel(new FormLayout("fill:pref:grow", "fill:pref:grow"));
027 navigationView.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
028 CellConstraints cc = new CellConstraints();
029 navigationView.add(getNavigationBuilder().buildComponent(this.currentNavigation), cc.xy(1, 1));
030 return navigationView;
031 }
032 }