diff options
Diffstat (limited to 'libjava/java/awt/Container.java')
-rw-r--r-- | libjava/java/awt/Container.java | 334 |
1 files changed, 314 insertions, 20 deletions
diff --git a/libjava/java/awt/Container.java b/libjava/java/awt/Container.java index 6befa79..8484024 100644 --- a/libjava/java/awt/Container.java +++ b/libjava/java/awt/Container.java @@ -1,4 +1,4 @@ -/* Copyright (C) 1999 Free Software Foundation +/* Copyright (C) 1999, 2000 Free Software Foundation This file is part of libjava. @@ -8,26 +8,320 @@ details. */ package java.awt; +import java.awt.event.*; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.util.EventListener; + /* A very incomplete placeholder. */ public abstract class Container extends Component { - int componentCount; - Component[] components; + /* Serialized fields from the serialization spec. */ + int ncomponents; + Component[] component; + LayoutManager layoutMgr; + /* LightweightDispatcher dispatcher; */ // wtf? + Dimension maxSize; + int containerSerializedDataVersion; - public Component[] getComponents() + /* Anything else is non-serializable, and should be declared "transient". */ + transient ContainerListener containerListener; + + public Container() { - Component[] result = new Component[componentCount]; - if (componentCount > 0) - System.arraycopy(components, 0, result, 0, componentCount); - return result; + } + + public int getComponentCount() + { + return ncomponents; + } + + /** @deprecated Use getComponentCount() instead. */ + public int countComponents() + { + return ncomponents; } public Component getComponent (int n) { - if (n < 0 || n >= componentCount) + if (n < 0 || n >= ncomponents) throw new ArrayIndexOutOfBoundsException("no such component"); - return components[n]; + return component[n]; + } + + public Component[] getComponents() + { + Component[] result = new Component[ncomponents]; + if (ncomponents > 0) + System.arraycopy(component, 0, result, 0, ncomponents); + return result; + } + + public Insets getInsets() + { + // FIXME + return null; + } + + /** @deprecated Use getInsets() instead. */ + public Insets insets() + { + return getInsets(); + } + + public Component add(Component comp) + { + // FIXME + return null; + } + + public Component add(String name, Component comp) + { + // FIXME + return null; + } + + public Component add(Component comp, int index) + { + // FIXME + return null; + } + + public void add(Component comp, Object constraints) + { + // FIXME + } + + public void add(Component comp, Object constraints, int index) + { + // FIXME + } + + protected void addImpl(Component comp, Object constraints, int index) + { + // FIXME + } + + public void remove(int index) + { + // FIXME + } + + public void remove(Component comp) + { + // FIXME + } + + public void removeAll() + { + // FIXME + } + + public LayoutManager getLayout() + { + return layoutMgr; + } + + public void setLayout(LayoutManager mgr) + { + layoutMgr = mgr; + // FIXME + } + + public void doLayout() + { + // FIXME + } + + /** @deprecated Use doLayout() instead. */ + public void layout() + { + doLayout(); + } + + public void invalidate() + { + // FIXME + } + + public void validate() + { + // FIXME + } + + protected void validateTree() + { + // FIXME + } + + public void setFont(Font f) + { + // FIXME + } + + public Dimension getPreferredSize() + { + // FIXME + return null; + } + + /** @deprecated Use getPreferredSize() instead */ + public Dimension preferredSize() + { + return getPreferredSize(); + } + + public Dimension getMinimumSize() + { + // FIXME + return null; + } + + /** @deprecated Use getMinimumSize() instead */ + public Dimension minimumSize() + { + return getMinimumSize(); + } + + public Dimension getMaximumSize() + { + // FIXME + return null; + } + + public float getAlignmentX() + { + // FIXME + return 0; + } + + public float getAlignmentY() + { + // FIXME + return 0; + } + + public void paint(Graphics g) + { + // FIXME + } + + public void update(Graphics g) + { + // FIXME + } + + public void print(Graphics g) + { + // FIXME + } + + public void paintComponents(Graphics g) + { + // FIXME + } + + public void printComponents(Graphics g) + { + // FIXME + } + + void dispatchEventImpl(AWTEvent e) + { + if ((e.id <= ContainerEvent.CONTAINER_LAST + && e.id >= ContainerEvent.CONTAINER_FIRST) + && (containerListener != null + || (eventMask & AWTEvent.CONTAINER_EVENT_MASK) != 0)) + processEvent(e); + else super.dispatchEventImpl(e); + } + + public void addContainerListener(ContainerListener l) + { + containerListener = (ContainerListener) + AWTEventMulticaster.add(containerListener, l); + } + + public void removeContainerListener(ContainerListener l) + { + containerListener = (ContainerListener) + AWTEventMulticaster.remove(containerListener, l); + } + + /** @since 1.3 */ + public EventListener[] getListeners(Class listenerType) + { + if (listenerType == ContainerListener.class) + return getListenersImpl(listenerType, containerListener); + else return super.getListeners(listenerType); + } + + protected void processEvent(AWTEvent e) + { + if (e instanceof ContainerEvent) + processContainerEvent((ContainerEvent) e); + else super.processEvent(e); + } + + protected void processContainerEvent(ContainerEvent e) + { + if (componentListener == null) + return; + switch (e.id) + { + case ContainerEvent.COMPONENT_ADDED: + containerListener.componentAdded(e); + break; + + case ContainerEvent.COMPONENT_REMOVED: + containerListener.componentRemoved(e); + break; + } + } + + /** @deprecated */ + public void deliverEvent(Event e) + { + } + + public Component getComponentAt(int x, int y) + { + // FIXME + return null; + } + + /** @deprecated Use getComponentAt() instead */ + public Component locate(int x, int y) + { + return getComponentAt(x, y); + } + + public Component getComponentAt(Point p) + { + return getComponentAt(p.x, p.y); + } + + public Component findComponentAt(int x, int y) + { + // FIXME + return null; + } + + public Component findComponentAt(Point p) + { + return findComponentAt(p.x, p.y); + } + + public void addNotify () + { + for (int i = ncomponents; --i >= 0; ) + component[i].addNotify(); + } + + public void removeNotify() + { + // FIXME } public boolean isAncestorOf (Component comp) @@ -42,18 +336,18 @@ public abstract class Container extends Component } } - public Component add (String name, Component comp) + protected String paramString() { - /* FIXME */ - return comp; + return "FIXME"; } - - public void addNotify () + + public void list(PrintStream out, int indent) { - for (int i = componentCount; --i >= 0; ) - components[i].addNotify(); + // FIXME + } + + public void list(PrintWriter out, int indent) + { + // FIXME } - - public void setLayout (LayoutManager layout) - { /* FIXME */ } } |