| Method from javax.swing.plaf.basic.BasicInternalFrameUI Detail: |
protected void activateFrame(JInternalFrame f) {
getDesktopManager().activateFrame(f);
}
This method is called when the frame becomes selected.
This action is delegated to the desktopManager. |
protected void closeFrame(JInternalFrame f) {
// Internal Frame Auditory Cue Activation
BasicLookAndFeel.playSound(frame,"InternalFrame.closeSound");
// delegate to desktop manager
getDesktopManager().closeFrame(f);
}
This method is called when the user wants to close the frame.
The playCloseSound Action is fired.
This action is delegated to the desktopManager. |
protected MouseInputAdapter createBorderListener(JInternalFrame w) {
return new BorderListener();
}
|
protected ComponentListener createComponentListener() {
return getHandler();
}
|
protected DesktopManager createDesktopManager() {
return new DefaultDesktopManager();
}
|
protected JComponent createEastPane(JInternalFrame w) {
return null;
}
|
protected MouseInputListener createGlassPaneDispatcher() {
return null;
}
|
InputMap createInputMap(int condition) {
if (condition == JComponent.WHEN_IN_FOCUSED_WINDOW) {
Object[] bindings = (Object[])DefaultLookup.get(
frame, this, "InternalFrame.windowBindings");
if (bindings != null) {
return LookAndFeel.makeComponentInputMap(frame, bindings);
}
}
return null;
}
|
protected void createInternalFrameListener() {
internalFrameListener = getHandler();
}
|
protected LayoutManager createLayoutManager() {
return getHandler();
}
|
protected JComponent createNorthPane(JInternalFrame w) {
titlePane = new BasicInternalFrameTitlePane(w);
return titlePane;
}
|
protected PropertyChangeListener createPropertyChangeListener() {
return getHandler();
}
|
protected JComponent createSouthPane(JInternalFrame w) {
return null;
}
|
public static ComponentUI createUI(JComponent b) {
/////////////////////////////////////////////////////////////////////////////
// ComponentUI Interface Implementation methods
/////////////////////////////////////////////////////////////////////////////
return new BasicInternalFrameUI((JInternalFrame)b);
}
|
protected JComponent createWestPane(JInternalFrame w) {
return null;
}
|
protected void deactivateFrame(JInternalFrame f) {
getDesktopManager().deactivateFrame(f);
}
This method is called when the frame is no longer selected.
This action is delegated to the desktopManager. |
protected void deiconifyFrame(JInternalFrame f) {
// Internal Frame Auditory Cue Activation
if ( ! f.isMaximum() ) {
// This method seems to regularly get called after an
// internal frame is maximized. Don't play this sound then.
BasicLookAndFeel.playSound(frame, "InternalFrame.restoreUpSound");
}
// delegate to desktop manager
getDesktopManager().deiconifyFrame(f);
}
This method is called when the user wants to deiconify the frame.
The playRestoreUpSound Action is fired.
This action is delegated to the desktopManager. |
protected void deinstallMouseHandlers(JComponent c) {
c.removeMouseListener(borderListener);
c.removeMouseMotionListener(borderListener);
}
|
protected DesktopManager getDesktopManager() {
if(frame.getDesktopPane() != null
&& frame.getDesktopPane().getDesktopManager() != null)
return frame.getDesktopPane().getDesktopManager();
if(sharedDesktopManager == null)
sharedDesktopManager = createDesktopManager();
return sharedDesktopManager;
}
Returns the proper DesktopManager. Calls getDesktopPane() to
find the JDesktop component and returns the desktopManager from
it. If this fails, it will return a default DesktopManager that
should work in arbitrary parents. |
public JComponent getEastPane() {
return eastPane;
}
|
InputMap getInputMap(int condition) {
if (condition == JComponent.WHEN_IN_FOCUSED_WINDOW) {
return createInputMap(condition);
}
return null;
}
|
public Dimension getMaximumSize(JComponent x) {
return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
}
|
public Dimension getMinimumSize(JComponent x) {
if((JComponent)frame == x) {
return frame.getLayout().minimumLayoutSize(x);
}
return new Dimension(0, 0);
}
|
public JComponent getNorthPane() {
return northPane;
}
|
public Dimension getPreferredSize(JComponent x) {
if((JComponent)frame == x)
return frame.getLayout().preferredLayoutSize(x);
return new Dimension(100, 100);
}
|
public JComponent getSouthPane() {
return southPane;
}
|
public JComponent getWestPane() {
return westPane;
}
|
protected void iconifyFrame(JInternalFrame f) {
// Internal Frame Auditory Cue Activation
BasicLookAndFeel.playSound(frame, "InternalFrame.minimizeSound");
// delegate to desktop manager
getDesktopManager().iconifyFrame(f);
}
This method is called when the user wants to iconify the frame.
The playMinimizeSound Action is fired.
This action is delegated to the desktopManager. |
protected void installComponents() {
setNorthPane(createNorthPane(frame));
setSouthPane(createSouthPane(frame));
setEastPane(createEastPane(frame));
setWestPane(createWestPane(frame));
}
|
protected void installDefaults() {
Icon frameIcon = frame.getFrameIcon();
if (frameIcon == null || frameIcon instanceof UIResource) {
frame.setFrameIcon(UIManager.getIcon("InternalFrame.icon"));
}
// Enable the content pane to inherit background color from its
// parent by setting its background color to null.
Container contentPane = frame.getContentPane();
if (contentPane != null) {
Color bg = contentPane.getBackground();
if (bg instanceof UIResource)
contentPane.setBackground(null);
}
frame.setLayout(internalFrameLayout = createLayoutManager());
frame.setBackground(UIManager.getLookAndFeelDefaults().getColor("control"));
LookAndFeel.installBorder(frame, "InternalFrame.border");
}
|
protected void installKeyboardActions() {
createInternalFrameListener();
if (internalFrameListener != null) {
frame.addInternalFrameListener(internalFrameListener);
}
LazyActionMap.installLazyActionMap(frame, BasicInternalFrameUI.class,
"InternalFrame.actionMap");
}
|
protected void installListeners() {
borderListener = createBorderListener(frame);
propertyChangeListener = createPropertyChangeListener();
frame.addPropertyChangeListener(propertyChangeListener);
installMouseHandlers(frame);
glassPaneDispatcher = createGlassPaneDispatcher();
if (glassPaneDispatcher != null) {
frame.getGlassPane().addMouseListener(glassPaneDispatcher);
frame.getGlassPane().addMouseMotionListener(glassPaneDispatcher);
}
componentListener = createComponentListener();
if (frame.getParent() != null) {
parentBounds = frame.getParent().getBounds();
}
if ((frame.getParent() != null) && !componentListenerAdded) {
frame.getParent().addComponentListener(componentListener);
componentListenerAdded = true;
}
}
|
protected void installMouseHandlers(JComponent c) {
c.addMouseListener(borderListener);
c.addMouseMotionListener(borderListener);
}
|
public void installUI(JComponent c) {
frame = (JInternalFrame)c;
installDefaults();
installListeners();
installComponents();
installKeyboardActions();
LookAndFeel.installProperty(frame, "opaque", Boolean.TRUE);
}
|
public final boolean isKeyBindingActive() {
return keyBindingActive;
}
|
protected final boolean isKeyBindingRegistered() {
return keyBindingRegistered;
}
|
static void loadActionMap(LazyActionMap map) {
map.put(new UIAction("showSystemMenu") {
public void actionPerformed(ActionEvent evt) {
JInternalFrame iFrame = (JInternalFrame)evt.getSource();
if (iFrame.getUI() instanceof BasicInternalFrameUI) {
JComponent comp = ((BasicInternalFrameUI)
iFrame.getUI()).getNorthPane();
if (comp instanceof BasicInternalFrameTitlePane) {
((BasicInternalFrameTitlePane)comp).
showSystemMenu();
}
}
}
public boolean isEnabled(Object sender){
if (sender instanceof JInternalFrame) {
JInternalFrame iFrame = (JInternalFrame)sender;
if (iFrame.getUI() instanceof BasicInternalFrameUI) {
return ((BasicInternalFrameUI)iFrame.getUI()).
isKeyBindingActive();
}
}
return false;
}
});
// Set the ActionMap's parent to the Auditory Feedback Action Map
BasicLookAndFeel.installAudioActionMap(map);
}
|
protected void maximizeFrame(JInternalFrame f) {
// Internal Frame Auditory Cue Activation
BasicLookAndFeel.playSound(frame,"InternalFrame.maximizeSound");
// delegate to desktop manager
getDesktopManager().maximizeFrame(f);
}
This method is called when the user wants to maximize the frame.
The playMaximizeSound Action is fired.
This action is delegated to the desktopManager. |
protected void minimizeFrame(JInternalFrame f) {
// Internal Frame Auditory Cue Activation
if ( ! f.isIcon() ) {
// This method seems to regularly get called after an
// internal frame is iconified. Don't play this sound then.
BasicLookAndFeel.playSound(frame,"InternalFrame.restoreDownSound");
}
// delegate to desktop manager
getDesktopManager().minimizeFrame(f);
}
This method is called when the user wants to minimize the frame.
The playRestoreDownSound Action is fired.
This action is delegated to the desktopManager. |
protected void replacePane(JComponent currentPane,
JComponent newPane) {
if(currentPane != null) {
deinstallMouseHandlers(currentPane);
frame.remove(currentPane);
}
if(newPane != null) {
frame.add(newPane);
installMouseHandlers(newPane);
}
}
Installs necessary mouse handlers on newPane
and adds it to the frame.
Reverse process for the currentPane. |
public void setEastPane(JComponent c) {
eastPane = c;
}
|
protected final void setKeyBindingActive(boolean b) {
keyBindingActive = b;
}
|
protected final void setKeyBindingRegistered(boolean b) {
keyBindingRegistered = b;
}
|
public void setNorthPane(JComponent c) {
if (northPane != null &&
northPane instanceof BasicInternalFrameTitlePane) {
((BasicInternalFrameTitlePane)northPane).uninstallListeners();
}
replacePane(northPane, c);
northPane = c;
if (c instanceof BasicInternalFrameTitlePane) {
titlePane = (BasicInternalFrameTitlePane)c;
}
}
|
public void setSouthPane(JComponent c) {
southPane = c;
}
|
public void setWestPane(JComponent c) {
westPane = c;
}
|
protected void setupMenuCloseKey() {
}
|
protected void setupMenuOpenKey() {
// PENDING(hania): Why are these WHEN_IN_FOCUSED_WINDOWs? Shouldn't
// they be WHEN_ANCESTOR_OF_FOCUSED_COMPONENT?
// Also, no longer registering on the desktopicon, the previous
// action did nothing.
InputMap map = getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
SwingUtilities.replaceUIInputMap(frame,
JComponent.WHEN_IN_FOCUSED_WINDOW, map);
//ActionMap actionMap = getActionMap();
//SwingUtilities.replaceUIActionMap(frame, actionMap);
}
|
protected void uninstallComponents() {
setNorthPane(null);
setSouthPane(null);
setEastPane(null);
setWestPane(null);
if(titlePane != null) {
titlePane.uninstallDefaults();
}
titlePane = null;
}
|
protected void uninstallDefaults() {
Icon frameIcon = frame.getFrameIcon();
if (frameIcon instanceof UIResource) {
frame.setFrameIcon(null);
}
internalFrameLayout = null;
frame.setLayout(null);
LookAndFeel.uninstallBorder(frame);
}
|
protected void uninstallKeyboardActions() {
if (internalFrameListener != null) {
frame.removeInternalFrameListener(internalFrameListener);
}
internalFrameListener = null;
SwingUtilities.replaceUIInputMap(frame, JComponent.
WHEN_IN_FOCUSED_WINDOW, null);
SwingUtilities.replaceUIActionMap(frame, null);
}
|
protected void uninstallListeners() {
if ((frame.getParent() != null) && componentListenerAdded) {
frame.getParent().removeComponentListener(componentListener);
componentListenerAdded = false;
}
componentListener = null;
if (glassPaneDispatcher != null) {
frame.getGlassPane().removeMouseListener(glassPaneDispatcher);
frame.getGlassPane().removeMouseMotionListener(glassPaneDispatcher);
glassPaneDispatcher = null;
}
deinstallMouseHandlers(frame);
frame.removePropertyChangeListener(propertyChangeListener);
propertyChangeListener = null;
borderListener = null;
}
|
public void uninstallUI(JComponent c) {
if(c != frame)
throw new IllegalComponentStateException(
this + " was asked to deinstall() "
+ c + " when it only knows about "
+ frame + ".");
uninstallKeyboardActions();
uninstallComponents();
uninstallListeners();
uninstallDefaults();
updateFrameCursor();
handler = null;
frame = null;
}
|
void updateFrameCursor() {
if (resizing) {
return;
}
Cursor s = (Cursor)frame.getLastCursor();
if (s == null) {
s = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
}
frame.setCursor(s);
}
|