001 /*
002 * $Id: ColumnControlPopup.java 3100 2008-10-14 22:33:10Z rah003 $
003 *
004 * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle,
005 * Santa Clara, California 95054, U.S.A. All rights reserved.
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * You should have received a copy of the GNU Lesser General Public
018 * License along with this library; if not, write to the Free Software
019 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
020 */
021 package org.jdesktop.swingx.table;
022
023 import java.awt.ComponentOrientation;
024 import java.util.List;
025
026 import javax.swing.Action;
027 import javax.swing.JComponent;
028
029 import org.jdesktop.swingx.action.AbstractActionExt;
030
031 /**
032 * Encapsulates the popup component which is the delegate for
033 * all popup visuals, used by a ColumnControlButton.
034 * <p>
035 * For now, this class a simple extraction of what a ColumnControl needs.
036 * Usage will drive further evolution.
037 *
038 */
039 public interface ColumnControlPopup {
040
041 /**
042 * Updates all internal visuals after changing a UI-delegate. <p>
043 *
044 * The method called by ColumnControlButton in it's updateUI.
045 * As there is a good probability that at the time of a
046 * ColumnControlButton is updated after a ui-delegate change the
047 * popup is not visible/part of the container hierarchy, this
048 * method must be messaged manually.
049 *
050 * @see javax.swing.JComponent#updateUI()
051 *
052 */
053 void updateUI();
054
055 /**
056 * Toggles the popup's visibility. This method is responsible for
057 * placing itself relative to the given owner if toggled to visible.
058 *
059 * @param owner the JComponent which triggered the visibility change, typically
060 * a ColumnControlButton.
061 */
062 void toggleVisibility(JComponent owner);
063
064 /**
065 * Applies the specified component orientation to all internal widgets.
066 * This method must be called by the owner if its component orientation
067 * changes.
068 *
069 * @param o the componentOrientation to apply to all internal widgets.
070 * @see javax.swing.JComponent#applyComponentOrientation(ComponentOrientation).
071 */
072 void applyComponentOrientation(ComponentOrientation o);
073
074 /**
075 * Removes all items from the popup.
076 */
077 void removeAll();
078
079 /**
080 * Adds items corresponding to the column's visibility actions.
081 * <p>
082 * Each <code>Action</code> in the list is a <code>stateAction</code>,
083 * its <code>selected</code> property bound to a column's
084 * <code>visible</code> property, that is toggling the selected will
085 * toggle the column's visibility (if the action is enabled).
086 *
087 * The <code>Action</code>s <code>name</code> property is bound to
088 * the column's <code>title</code>.
089 *
090 * @param actions List of AbstractActionExt to add.
091 */
092 void addVisibilityActionItems(List<? extends AbstractActionExt> actions);
093 // JW: dooohhh ... what a winding description ...
094 // sure need to have a better abstraction!
095 //
096
097 /**
098 * Adds additional actions to the popup.
099 *
100 * @param actions List of <code>Action</code>s to add to the popup.
101 */
102 void addAdditionalActionItems(List<? extends Action> actions);
103
104 }