/* * Copyright (c) 2003,2009 Declarative Engineering LLC. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Declarative Engineering LLC * verson 1 which accompanies this distribution, and is available at * http://declarativeengineering.com/legal/DE_Developer_License_v1.txt */ package com.foundation.view; import com.common.thread.IRunnable; import com.foundation.event.IRequestHandler; import com.foundation.controller.AbstractViewController; /** * An interface implemented by view components that can be the root of a view or partial view. */ public interface IView { /** * Gets the request handler associated with the view. * @return The view's request handler. */ public IRequestHandler getRequestHandler(); /** * Executes the given runnable in a thread safe way. * @param runnable The object to be executed within the view's thread. * @return The return value of the given runnable. */ public Object execute(IRunnable runnable); /** * Executes the given runnable in a thread safe way and does not wait around for the operation to finish. * @param runnable The object to be executed within the view's thread. */ public void executeAsync(IRunnable runnable); /** * Gets the controller associated with the view or view part. * @return The controller reference that is managing the view. */ public AbstractViewController getController(); /** * Sets the controller associated with the view or view part. * @param controller The controller reference that is managing the view. */ public void setController(AbstractViewController controller); /** * Sets the view so that it receives the focus. */ public void setFocus(); /** * Determines whether the view is enabled and the user is able to interact with it. * @param isEnabled Whether the view and its components are enabled (or if not then disabled). */ public void setIsEnabled(boolean isEnabled); /** * Determines whether the view and its children are visible. * @param isVisible Whether the view and its components will be visible. */ public void setIsVisible(boolean isVisible); /** * Lays out the view components. */ public void layout(); /** * Packs the view so it takes up a minimum amount of space. */ public void pack(); /** * Centers the view on the primary monitor. */ public void center(); /** * Centers the view on the primary monitor. * @param centerOnView The view to center on. If this is null then it will center on the primary monitor. */ public void center(IView centerOnView); /** * Sets the view to be visible, non-iconified, and have focus. */ public void show(); /** * Maximizes the view so that it takes up all available screen realestate. */ public void maximize(); /** * Minimizes the view so that it takes up no screen realestate. */ public void minimize(); /** * Initializes this view and all its' contained components. */ public void viewInitializeAll(); /** * Refreshes this view and all its' contained components. */ public void viewRefreshAll(); /** * Releases this view and all its' contained components. */ public void viewReleaseAll(); /** * Synchronizes this view and all its' contained components. */ public void viewSynchronizeAll(); /** * Gets the view context for this view. * @return The context in which this view exists. */ public IViewContext getViewContext(); /** * Determines whether the calling thread is the view's event thread. * @return Whether the view's event thread and the calling thread are one and the same. */ public boolean isViewThread(); /** * Increments the hold count on the message queue so that messages will be queued up until the count reaches zero. */ public void addMessageHold(); /** * Decrements the hold count on the message queue so that messages will be queued up until the count reaches zero. */ public void removeMessageHold(); /** * Suspends all layouts and packing while the view is getting setup. */ public void suspendLayouts(); /** * Resumes processing of requests to layout or pack components. */ public void resumeLayouts(); }//IView//