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.application.support;
017
018 import java.awt.Dimension;
019 import java.awt.Image;
020
021 import org.springframework.core.style.ToStringCreator;
022 import org.springframework.richclient.application.ApplicationWindow;
023 import org.springframework.richclient.application.config.ApplicationWindowConfigurer;
024 import org.springframework.util.Assert;
025
026 /**
027 * @author Keith Donald
028 */
029 public class DefaultApplicationWindowConfigurer implements ApplicationWindowConfigurer {
030
031 private String title = "New Application Window";
032
033 private Image image;
034
035 private boolean showMenuBar = true;
036
037 private boolean showToolBar = true;
038
039 private boolean showStatusBar = true;
040
041 private Dimension initialSize = new Dimension(800, 600);
042
043 private ApplicationWindow window;
044
045 public DefaultApplicationWindowConfigurer(ApplicationWindow window) {
046 Assert.notNull(window, "Application window is required");
047 this.window = window;
048 }
049
050 public ApplicationWindow getWindow() {
051 return window;
052 }
053
054 public String getTitle() {
055 return title;
056 }
057
058 public Image getImage() {
059 return image;
060 }
061
062 public Dimension getInitialSize() {
063 return initialSize;
064 }
065
066 public boolean getShowMenuBar() {
067 return showMenuBar;
068 }
069
070 public boolean getShowToolBar() {
071 return showToolBar;
072 }
073
074 public boolean getShowStatusBar() {
075 return showStatusBar;
076 }
077
078 public void setTitle(String title) {
079 this.title = title;
080 }
081
082 public void setImage(Image image) {
083 this.image = image;
084 }
085
086 public void setInitialSize(Dimension initialSize) {
087 if (initialSize != null) {
088 this.initialSize = initialSize;
089 }
090 }
091
092 public void setShowMenuBar(boolean showMenuBar) {
093 this.showMenuBar = showMenuBar;
094 }
095
096 public void setShowToolBar(boolean showToolBar) {
097 this.showToolBar = showToolBar;
098 }
099
100 public void setShowStatusBar(boolean showStatusBar) {
101 this.showStatusBar = showStatusBar;
102 }
103
104 public String toString() {
105 return new ToStringCreator(this).append("title", title).append("image", image).append("showMenuBar",
106 showMenuBar).append("showToolBar", showToolBar).append("showStatusBar", showStatusBar).append(
107 "initialSize", initialSize).append("window", window).toString();
108 }
109
110 }