001 package org.springframework.richclient.widget;
002
003 import org.springframework.richclient.application.support.ApplicationServicesAccessor;
004 import org.springframework.richclient.command.AbstractCommand;
005
006 import java.util.List;
007 import java.util.Collections;
008
009 /**
010 * Default behavior implementation of AbstractWidget
011 */
012 public abstract class AbstractWidget extends ApplicationServicesAccessor implements Widget
013 {
014 protected boolean showing = false;
015
016 /**
017 * {@inheritDoc}
018 */
019 public void onAboutToShow()
020 {
021 showing = true;
022 }
023
024 /**
025 * {@inheritDoc}
026 */
027 public void onAboutToHide()
028 {
029 showing = false;
030 }
031
032 public boolean isShowing()
033 {
034 return showing;
035 }
036
037 /**
038 * {@inheritDoc}
039 *
040 * Default: Widget can be closed.
041 */
042 public boolean canClose()
043 {
044 return true;
045 }
046
047 /**
048 * {@inheritDoc}
049 */
050 public List<? extends AbstractCommand> getCommands()
051 {
052 return Collections.emptyList();
053 }
054 }