From 4dfcdad172a0959dbbbbe5084b393ba8995c67dd Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Thu, 17 Jun 2004 23:43:16 +0000 Subject: [multiple changes] 2004-06-17 Michael Koch * javax/swing/JToolBar.java (name): Removed. (JToolBar): Use Component.setName(String) instead of doing it all alone. * javax/swing/Timer.java (queueEvent): Added missing modifier. 2004-06-17 Olga Rodimina * Makefile.am: Added new file. * Makefile.in: Re-generate. * javax/swing/JMenu.java: (insertSeparator): Implemented. * javax/swing/JPopupMenu.java: (JPopupMenu.Separator): Implemented. * javax/swing/MenuSelectionManager.java: (processMouseEvent): Use java.awt.Component for event source instead of javax.swing.JComponent. * javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java: New File. Implemented. 2004-06-16 David Jee * java/awt/GridBagLayout.java (GetLayoutInfo): Adjust cell sizes iff parent size is not zero. Make sure pos_x and pos_y are never negative. 2004-04-16 Andrew Overholt * Makefile.am: Add new file. * Makefile.in: Re-generate. * javax/swing/JToolBar.java Partially implemented. * javax/swing/plaf/basic/BasicToolBarUI.java New file. Partially implemented. 2004-06-16 Graydon Hoare * gnu/java/awt/peer/gtk/GdkGraphics2D.java (setComposite): Accept AlphaComposite arguments. * gnu/java/awt/peer/gtk/GdkPixbufDecoder.java (createBufferedImage): Add new overloads. * gnu/java/awt/peer/gtk/GtkToolkit.java (createImage): Use GdkPixbufDecoder.createBufferedImage when useGraphics2D() is true. (getImage): Delegate to createImage. * javax/swing/JList.java (isSelectionEmpty): (getFirstVisibleIndex): (getLastVisibleIndex): (setSelectedValue): (ensureIndexIsVisible): New methods. * javax/swing/Timer.java: Reimplement. 2004-06-16 Michael Koch * javax/swing/text/AbstractDocument.java (AbstracElement): Made public, implements java.io.Serializable. (AttributeContext): Made public. (BranchElement): Likewise. (Content): Likewise. (DefaultDocumentEvent): Made public, extends javax.swing.undo.CompoundEdit. (ElementEdit): Made public, extends javax.swing.undo.AbstractUndoableEdit. (LeafElement): Made public. (LeafElement.LeafElement): Made public. 2004-06-16 Michael Koch * javax/swing/text/JTextComponent.java: Totally reworked. Removed many methods (that were obviously never be intended to get included hi this class. Added some methods too. 2004-06-16 Michael Koch * javax/swing/text/PlainDocument.java (serialVersionUID): New constant. (lineLimitAttribute): Likewise. (tabSizeAttribute): Likewise. (tabSize): New field. (PlainDocument): Made public. (PlainDocument): New constructor. 2004-06-16 Michael Koch * javax/swing/text/AbstractDocument.java (insertString): Throws BadLocationException. * javax/swing/text/Document.java (insertString): Likewise. * javax/swing/text/JTextComponent.java: Javadocs and comments cleaned up. 2004-06-16 Michael Koch * javax/swing/event/UndoableEditListener.java: Reformatted. * javax/swing/text/AbstractDocument.java (AbstractDocument): Implements java.io.Serializable. (doc_list): Removed. (undo_list): Removed. (AbstractElement.serialVerionUID): New field. (BranchElement.serialVerionUID): Likewise. (DefaultDocumentEvent.serialVerionUID): Likewise. (ElementEdit.serialVerionUID): Likewise. (LeafElement.serialVerionUID): Likewise. (serialVerionUID): Likewise. (BAD_LOCATION): New constant. (BidiElementName): Likewise. (ContentElementName): Likewise. (ParagraphElementName): Likewise. (SectionElementName): Likewise. (ElementNameAttribute): Likewise. (AbstractDocument): Made protected. (AbstractDocument): New construtor. (listenerList): New field. (fireChangedUpdate): Implemented. (fireInsertUpdate): Likewise. (fireRemoveUpdate): Likewise. (fireUndoableEditUpdate): Likewise. (getListeners): Likewise. (addDocumentListener): Likewise. (removeDocumentListener): Likewise. (addUndoableEditListener): Likewise. (removeUndoableEditListener): Likewise. (getDocumentListeners): New method. (getUndoableEditListeners): Likewise. (getAsynchronousLoadPriority): Made public. (getBidiRootElement): Likewise. (setAsynchronousLoadPriority): Likewise. (setDocumentProperties): Likewise. * javax/swing/text/BadLocationException.java (serialVerionUID): New field. * javax/swing/text/DefaultCaret.java (changeEvent): New field. (listenerList): Likewise. (changes): Removed. (addChangeListener): Reimplemented. (removeChangeListener): Likewise. (getListeners): New method. (getChangeListeners): Likwise. (getComponent): Likewise. * javax/swing/text/GapContent.java (GapContent): Implements java.io.Serializable. (serialVerionUID): New field. 2004-06-16 Michael Koch * javax/swing/JTree.java (treeModel): New field. (JTree): New constructors, one existing one made public. (createTreeModel): New method. (addTreeExpansionListener): Likewise. (removeTreeExpansionListener): Likewise. (getTreeExpansionListeners): Likewise. (fireTreeCollapsed): Likewise. (fireTreeExpanded): Likewise. (addTreeSelectionListener): Likewise. (removeTreeSelectionListener): Likewise. (getTreeSelectionListeners): Likewise. (fireValueChanged): Likewise. (addTreeWillExpandListener): Likewise. (removeTreeWillExpandListener): Likewise. (getTreeWillExpandListeners): Likewise. (fireTreeWillCollapse): Likewise. (fireTreeWillExpand): Likewise. 2004-06-16 Michael Koch * javax/swing/JTree.java: Reformatted. 2004-06-16 Michael Koch * javax/swing/JTextArea.java: New file. * javax/swing/JTextField.java (actions): Removed. (notifyAction): New constant. (columns): New field. (JTextField): New constructors. (createDefaultModel): New method. (addActionListener): Reimplmemented. (removeActionListener): Reimplemented. (getActionListeners): New method. (fireActionPerformed): New method. (getColumns): New method. (setColumne): New method. * javax/swing/text/JTextComponent.java (AccessibleJTextComponent.serialVersionUID): New field. (serialVersionUID): Likewise. (DEFAULT_KEYMAP): Likewise. (FOCUS_ACCELERATOR_KEY): Likewise. (doc): Made private. (icon_gap): Likewise. (icon): Likewise. (align): Likewise. (JTextComponent): Some constructors removed. (getScrollableTracksViewportHeight): New method. (getScrollableTracksViewportWidth): Likewise. * Makefile.am: Added javax/swing/JTextArea.java. * Makefile.in: Regenerated. 2004-06-15 Graydon Hoare * javax/swing/ImageIcon.java (ImageIcon): New constructor. * javax/swing/JFrame.java (defaultLookAndFeelDecorated): New property. * javax/swing/JViewport.java (getExtentSize): Return size rather than preferred size. (toViewCoordinates): New methods. (getViewSize): Return size rather than preferred size. (setViewSize): Note view size as set. * javax/swing/ViewportLayout.java (layoutContainer): Reimplement. * javax/swing/plaf/basic/BasicScrollBarUI.java (getPreferredSize): Don't redo layout. * javax/swing/plaf/basic/BasicViewportUI.java (paint): Translate image properly and eat exceptions. 2004-06-15 Kim Ho * javax/swing/JTabbedPane.java (setComponent): Remove old component and add new component. (setSelectedIndex): Don't operate on the components if they're null. Don't set index on the model if the index is the same. (insertTab): Don't add or hide the component if it's null. Repaint the container. * javax/swing/plaf/basic/BasicLookAndFeel.java Change colors for TabbedPane. * javax/swing/plaf/basic/BasicTabbedPaneUI.java (mousePressed): Re-layout and paint the component. (layoutContainer): Don't set location on the view. (ScrollingViewport::paint): Remove. 2004-06-14 Thomas Fitzsimmons * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c (gtkWidgetDispatchKeyEvent): Change warning message to comment. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c (drawString): Wrap baseline y value in PANGO_PIXELS macro, rather than simply dividing by PANGO_SCALE. Call gdk_flush before leaving GDK critical region. (drawLine): Call gdk_flush before leaving GDK critical region. (fillRect): Likewise. (drawRect): Likewise. (copyArea): Likewise. (copyPixmap): Likewise. (clearRect): Likewise. (drawArc): Likewise. (drawPolyline): Likewise. (drawPolygon): Likewise. (fillPolygon): Likewise. (fillArc): Likewise. (drawOval): Likewise. (fillOval): Likewise. * gnu/java/awt/peer/gtk/GdkFontMetrics.java (initState): Add style parameter. (GdkFontMetrics): Add style argument to initState call. (stringWidth(String,int,int,String)): Add style parameter. (stringWidth(String)): Add style argument to stringWidth call. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c (initState): Set pango font style and weight based on AWT style parameter. Pass default GTK language to pango_context_get_metrics. Use PANGO_PIXELS macro rather than simply dividing by PANGO_SCALE. (stringWidth): Set pango font style and weight based on AWT style parameter. * java/awt/Button.java (next_button_number): New field. (paramString): Change output. (generateName): New method. (getUniqueLong): New method. 2004-06-14 Kim Ho * javax/swing/JTabbedPane.java: (setComponentAt): Set the component, not the enabled status. * javax/swing/plaf/basic/BasicDesktopIconUI.java (actionPerformed): Let deiconize catch exception. 2004-06-14 Olga Rodimina * javax/swing/JPopupMenu.java: (setVisible): Corrected location of a heavyweight popup menu. 2004-06-14 Olga Rodimina * javax/swing/MenuSelectionManager.java: Ran through jalopy to fix formatting style. 2004-06-14 Olga Rodimina * javax/swing/JLayeredPane.java: (remove): Revalidate and repaint layered pane after the component was removed. javax/swing/JMenu.java: (setVisible): Display popup menu at the user location, if one was set by the user. (setMenuLocation): Reimplemented. Fixed javadoc. * javax/swing/JMenuBar.java: Added javadoc. (BORDER_PAINTED_CHANGED_PROPERTY): New Property. (MODEL_CHANGED_PROPERTY): New Property. (isSelected): Implemented. (setBorderPainted): Fire PropertyChangeEvent if paintBorder property changes. (setSelected): Implemented. (setSelectionModel): Implemented. * javax/swing/JPopupMenu.java: Added Javadoc (pack): Implemented. (setVisible): Reimplemented. (show): Fixed location. (JPopupMenu.LigthWeightPopup): Reimplemented to use Container instead of JPanel. * javax/swing/MenuSelectionManager.java: Added Javadocs. (clearSelectedPath): Reimplemented to clear selectedPath in reverse order. (processMouseEvent): Reimplemented. (setSelectedPath): Fire stateChange event indicating that selected menu path has changed. (getPath): Change to use ArrayList instead of Vector. * javax/swing/plaf/basic/BasicMenuBarUI.java: (installUI): call installKeyboardActions(). (uninstallUI): call uninstallKeyboardActions(). 2004-06-13 Michael Koch * javax/swing/text/DefaultCaret.java, javax/swing/text/BadLocationException.java: Reformatted. 2004-06-12 Thomas Fitzsimmons * gnu/java/awt/peer/gtk/GtkTextAreaPeer.java (DEFAULT_ROWS, DEFAULT_COLS): New variables. (create): Don't allow 0 rows or 0 columns. Instead, set the values to DEFAULT_ROWS or DEFAULT_COLS. (getMinimumSize): Likewise. (getPreferredSize): Likewise. (minimumSize): Likewise. (preferredSize): Likewise. (create): Set peer's editable state. * java/awt/TextArea.java (TextArea()): Set rows and columns to zero. Update javadocs. (TextArea(String)): Likewise. (TextArea(int,int)): Fix javadocs. (TextArea(String,int,int,int)): Only throw exception if one of rows or columns is zero. Fix javadocs. 2004-06-11 Thomas Fitzsimmons * java/awt/AWTEvent.java (toString): Handle MenuComponents in addition to Components. * java/awt/MenuItem.java (dispatchEventImpl): If the event wasn't consumed by normal processing, send it to the parent menu. * gnu/java/awt/peer/gtk/GtkImagePainter.java (setPixels(int,int,int,int,ColorModel,int[],int,int)): Remove translation. 2004-06-11 David Jee * java/awt/MediaTracker.java (addImage(Image,int)): Call imageUpdate() to udpate image status. (addImage(Image,int,int,int)): Likewise. 2004-06-11 Michael Koch * javax/swing/text/AbstractDocument.java, javax/swing/text/Document.java, javax/swing/text/GapContent.java, javax/swing/text/JTextComponent.java, javax/swing/text/PlainDocument.java: Reformatted. 2004-06-11 Michael Koch * javax/swing/JRootPane.java (AccessibleJRootPane.serialVersionUID): New field. (AccessibleJRootPane.AccessibleJRootPane): New constructor. (AccessibleJRootPane.getAccessibleRole): New method. (RootLayout): Implements Serializable. (RootLayout.serialVersionUID): New field. (RootLayout.RootLayout): New constructor. (setJMenuBar): Made public. (getJMenuBar): Likewise. (JRootPane): Likewise. (createContentPane): Likewise. (createGlassPane): Likewise. (createLayeredPane): Likewise. 2004-06-11 Michael Koch * javax/swing/SwingUtilities.java (isLeftMouseButton): Fixed javadoc. (isMiddleMouseButton): Likewise. (isRightMouseButton): Likewise. 2004-06-11 Michael Koch * javax/swing/JScrollPane.java (serialVersionUID): New field. (columnHeader): Made protected. (rowHeader): Likewise. (lowerLeft): Likewise. (lowerRight): Likewise. (upperLeft): Likewise. (upperRight): Likewise. (horizontalScrollBar): Likewise. (horizontalScrollBarPolicy): Likewise. (verticalScrollBar): Likewise. (verticalScrollBarPolicy): Likewise. (viewport): Likewise. 2004-06-11 Michael Koch * javax/swing/LookAndFeel.java: Fixed javadocs. 2004-06-11 Michael Koch * javax/swing/JEditorPane.java: Fixed javadocs. (JEditorPane): Removed redundant call to to this(). (fireHyperlinkUpdate): Implemented. 2004-06-10 Olga Rodimina * javax/swing/JMenu.java: Fixed file name in the file comment. 2004-06-10 Olga Rodimina * javax/swing/JMenu.java: Added javadoc. (JMenu): Added MenuChangeListener to listen to ChangeEvents occuring in menu's model. (insert): Throw IllegalArgumentException if index is less than 0 (setSelected): Reimplement. (setPopupMenuVisible): Call menu's model isEnabled() (setDelay): Throw IllegalArgumentException if given amount of delay is less than 0. (createActionComponent): Implemented. (createActionChangeListener): Implemented. (addSeparator): Implemented. (getItem): Throw IllegalArgumentException if index is less than 0. (getItemCount): Implemented. (fireMenuSelected): Changed to use menuEvent. (fireMenuDeselected): Likewise. (fireMenuCanceled): Likewise. (setAccelerator): Changed to throw an error if this method is used. (doClick): Implemented. (JMenu.ActionChangedListener): New inner class to handle PropertyChangeEvents occuring in the actions associated with menu. * javax/swing/plaf/basic/BasicMenuUI.java: Added javadoc. (BasicMenuUI): Added PropertyChangeListener to the menu. (createChangeListener): Implemented. (createMenuDragMouseListener): Likewise. (createMenuKeyListener): Likewise. (createPropertyChangeListener): Likewise. (uninstallListeners): Likewise. (BasicMenuUI.MouseInputHandler): Reimplemented. (BasicMenuUI.PropertyChangeHandler): New class. Not implemented yet. (BasicMenuUI.ChangeHandler): Likewise. (BasicMenuUI.MenuDragMouseHandler): Likewise. (BasicMenuUI.MenuKeyHandler): Likewise. 2004-06-10 David Jee * java/awt/MediaTracker.java (imageUpdate): Only do notifyAll() if the image is complete. 2004-06-10 Olga Rodimina * javax/swing/JApplet.java: (getJMenuBar): Made public. (setJMenuBar): Likewise. * javax/swing/JFrame.java: (getJMenuBar): Made public. (setJMenuBar): Likewise. * javax/swing/JWindow.java: (getJMenuBar): Removed. (setJMenuBar): Removed. 2004-06-10 Michael Koch * javax/swing/JEditorPane.java (createEditorKitForContentType): Fixed visibility. (fireHyperlinkUpdate): Likewise. (getContentType): Likewise. (getEditorKit): Likewise. (getEditorKitForContentType): Likewise. (getPage): Likewise. (read): Likewise. (registerEditorKitForContentTyoe): Likewise. (replaceSelection): Likewise. (setContentType): Likewise. (setEditorKit): Likewise. (setPage): Likewise. 2004-06-10 Michael Koch * javax/swing/Timer.java (Timer): New constructor. * javax/swing/plaf/basic/BasicProgressBarUI.java (animationTimer): Don't initialize at construction. (startAnimationTimer): Added since tag. (stopAnimationTimer): Likewise. (installUI): Use new Timer constructor. * javax/swing/plaf/basic/BasicScrollBarUI.java (installUI): Likewise. * javax/swing/plaf/basic/BasicSliderUI.java (installUI): Likewise. 2004-06-10 Michael Koch * javax/swing/ButtonGroup.java (serialVersionUID): Made private. (buttons): Renamed from v, added javadoc. (sel): Added javadoc. (ButtonGroup): Likewise. (add): Likewise. (remove): Likewise. (getElements): Likewise. (getSelection): Likewise. (setSelected): Likewise. (isSelected): Likewise. (getButtonCount): Likewise. 2004-06-10 Michael Koch * javax/swing/ButtonGroup.java, javax/swing/ImageIcon.java, javax/swing/JEditorPane.java, javax/swing/JRootPane.java, javax/swing/JTextField.java, javax/swing/LookAndFeel.java, javax/swing/plaf/basic/BasicTextUI.java: Reindented. 2004-06-10 Michael Koch * javax/swing/text/Style.java: Added javadocs. 2004-06-10 Michael Koch * javax/swing/JComponent.java (fireVetoableChange): Removed redundant cast. * javax/swing/JLabel.java (getDisabledIcon): Save icon for next call. 2004-06-10 Michael Koch * javax/swing/KeyStroke.java (getKeyStroke(char,boolean)): Marked deprecated. 2004-06-10 Michael Koch * javax/swing/DefaultCellEditor.java, javax/swing/GrayFilter.java, javax/swing/event/DocumentEvent.java, javax/swing/text/JTextComponent.java, javax/swing/text/MutableAttributeSet.java: Reindented. 2004-06-10 Michael Koch * javax/swing/plaf/BorderUIResource.java: Added serialVersionUID all over. 2004-06-10 Sascha Brawer * javax/swing/undo/UndoManager.java: Re-written from scratch. 2004-06-10 Michael Koch * javax/swing/table/DefaultTableCellRenderer.java (noFocusBorder): Initialize directly. 2004-06-10 Michael Koch * javax/swing/plaf/basic/BasicArrowButton.java (setDirection): Use method argument. 2004-06-10 Michael Koch * javax/swing/plaf/BorderUIResource.java, javax/swing/plaf/ComponentUI.java, javax/swing/undo/CompoundEdit.java, javax/swing/undo/StateEdit.java: Fixed javadocs all over. 2004-06-10 Michael Koch * javax/swing/DefaultButtonModel.java (ARMED): Made public final, fixed value. (ENABLED): Likewise. (PRESSED): Likewise. (ROLLOVER): Likewise. (SELECTED): Likewise. (stateMask): Initialize directly. (listenerList): Likewise. (mnemonic): Likewise. (fireStateChanged): Removed argument, use changeEvent as event. All places where this method is called are fixed too. (getActionCommant): Fixed javadoc. (setGroup): Fixed javadoc. (getGroup): New method. 2004-06-09 Olga Rodimina * javax/swing/AbstractButton.java (AbstractButton): Use init() to initialize the button. (init): New Method. Initializes AbstractButton. * javax/swing/JMenuItem.java: Documented. (JMenuItem): Reimplemented. (init): Implemented. (setEnabled): Changed to call super.setEnabled() (processMouseEvent): Reimplemented. (fireMenuKeyPressed): Implemented. (fireMenuKeyReleased): Implemented. (fireMenuKeyTyped): Implemented. (menuSelectionChanged): disarm the model if the menu item was deselected. * javax/swing/plaf/basic/BasicMenuItemUI.java:Documented. (getPath): Change to use ArrayList instead of Vector. (getPreferredSize): Renamed variable. (paintMenuItem): Paint margin area of menu item. (MouseInputHandler.mouseEntered): Set selection in MenuSelectionManager. (MouseInputHandler.mouseReleased): Check if mouse was pressed inside menu item's bounds before clearing the selection. 2004-06-09 David Jee * gnu/java/awt/peer/gtk/GtkTextComponentPeer.java (GtkTextComponentPeer): Set caret position to 0. * java/awt/TextComponent.java (setText): Set caret position to 0. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c (Java_gnu_java_awt_peer_gtk_GtkComponentPeer_addExposeFilter): Handle GtkScrolledWindow separately. Fix signal handler blocking. (Java_gnu_java_awt_peer_gtk_GtkComponentPeer_removeExposeFilter): Likewise. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c (Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_create): Make cursor visible. 2004-06-09 Kim Ho * Makefile.am: New files * Makefile.in: Regenerated * java/awt/Container.java (getComponentAt): Removed. * javax/swing/AbstractAction.java (ENABLED_PROPERTY): New property. (putValue): Fire PropertyChangeEvents. (setEnabled): ditto. (firePropertyChange): Javadoc and implement convenience method. * javax/swing/AbstractButton.java (setAction): Don't create PropertyChangeListener if new Action is null. (setIcon): Don't set icon till after comparing it. (configurePropertiesFromAction): Check mnemonic key before calling intValue(). (createActionPropertyChangeListener): Check properties rather than bulk change. * javax/swing/DefaultDesktopManager.java: Implement. * javax/swing/DesktopManager.java: Jalopy and javadoc. * javax/swing/JComponent.java (fireVetoableChange): Implement. (paintImmediately): Use root component. * javax/swing/JDesktopPane.java: Implement * javax/swing/JInternalFrame.java: Implement * javax/swing/JLabel.java (getDisabledIcon): Return grayscaled icon if no disabled icon specified. * javax/swing/JMenuBar.java (getComponentAtIndex): Use getComponent * javax/swing/JOptionPane.java (getDesktopPaneForComponent): Use SwingUtilities' getAncestorOfClass (getFrameForComponent): ditto. * javax/swing/JSplitPane.java (remove): Use getComponent. * javax/swing/SwingUtilities.java (convertPoint): Implement. * javax/swing/plaf/basic/BasicButtonUI.java (paintButtonNormal): Check opaqueness before filling background. * javax/swing/plaf/basic/BasicDesktopIconUI.java: Implement * javax/swing/plaf/basic/BasicDesktopPaneUI.java: Implement. * javax/swing/plaf/basic/BasicInternalFrameTitlePane.java: Implement. * javax/swing/plaf/basic/BasicInternalFrameUI.java: Implement. * javax/swing/plaf/basic/BasicLookAndFeel.java: Change InternalFrame and Desktop colors. 2004-06-09 David Jee * java/awt/Container.java (remove): Do not set component to invisible. 2004-06-09 Michael Koch * javax/swing/tree/DefaultMutableTreeNode.java (getLeafCount): Renamed enum to e. 2004-06-09 Michael Koch * javax/swing/plaf/basic/BasicSplitPaneDivider.java (positionForMouseEvent): Removed redundant semicolon. (continueDrag): Use method arguments. 2004-06-09 Michael Koch * javax/swing/border/TitledBorder.java, javax/swing/filechooser/FileSystemView.java, javax/swing/plaf/basic/BasicButtonListener.java, javax/swing/plaf/basic/BasicGraphicsUtils.java, javax/swing/plaf/basic/BasicLabelUI.java, javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java, javax/swing/plaf/basic/BasicScrollBarUI.java, javax/swing/plaf/basic/BasicScrollPaneUI.java, javax/swing/plaf/basic/BasicSliderUI.java, javax/swing/plaf/basic/BasicTabbedPaneUI.java, javax/swing/plaf/basic/BasicToggleButtonUI.java, javax/swing/table/JTableHeader.java, javax/swing/text/AbstractDocument.java, javax/swing/text/DefaultCaret.java, javax/swing/text/StyledEditorKit.java, javax/swing/tree/DefaultTreeCellEditor.java: Reworked import statements. 2004-06-08 Graydon Hoare * javax/swing/Box.java: Temporarily comment out code broken due to visibility bug. 2004-06-09 Michael Koch * javax/swing/ImageIcon.java (ImageIcon): Added missing constructor. 2004-06-08 Michael Koch * javax/swing/JToggleButton.java (JToggleButton): New constructor. (getAccessibleContext): Moved documentation into javadoc. (getUIClassID): Likewise. 2004-06-08 Michael Koch * javax/swing/AbstractButton.java (getDisabledIcon): Create disabled icon if none exists yet. 2004-06-08 Michael Koch * javax/swing/plaf/basic/BasicLookAndFeel.java (initClassDefaults): Added FormattedTextFieldUI. (loadResourceBundle): Renamed enum to e. 2004-06-08 Michael Koch * javax/swing/plaf/basic/BasicButtonUI.java (paintIcon): Simplified. (paintText): Paint disabled button correctly. 2004-06-08 Michael Koch * javax/swing/JComponent.java (createToolTip): Use official JToolTip API. 2004-06-08 Michael Koch * javax/swing/JToolTip.java (JToolTip): No arguments in API. (setTipText): New method. 2004-06-08 Michael Koch * javax/swing/SwingUtilities.java (isLeftMouseButton): New method. (isMiddleMouseButton): New method. (isRightMouseButton): New method. 2004-06-08 Michael Koch * javax/swing/AbstractButton.java, javax/swing/CellRendererPane.java, javax/swing/JCheckBoxMenuItem.java, javax/swing/JColorChooser.java, javax/swing/JComboBox.java, javax/swing/JComponent.java, javax/swing/JDesktopPane.java, javax/swing/JFileChooser.java, javax/swing/JMenu.java, javax/swing/JMenuItem.java, javax/swing/JOptionPane.java, javax/swing/JPasswordField.java, javax/swing/JPopupMenu.java, javax/swing/JProgressBar.java, javax/swing/JRadioButtonMenuItem.java, javax/swing/JScrollBar.java, javax/swing/JSeparator.java, javax/swing/JSlider.java, javax/swing/JSplitPane.java, javax/swing/JTabbedPane.java, javax/swing/JTextField.java, javax/swing/JToolBar.java, javax/swing/text/JTextComponent.java: Fixed all constructors of accessibility classes. 2004-06-08 Michael Koch * javax/swing/ScrollPaneLayout.java: Renamed all memeber variables all over. 2004-06-08 Michael Koch * javax/swing/Box.java (AccessibleBoxFiller): Extends AccessibleAWTComponent. (AccessibleBoxFiller.serialVersionUID): New member variable. * javax/swing/DefaultButtonModel.java (stateMask): Made protected. (listenerList): Likewise. (changeEvent): Likewise. (group): Likewise. (mnemonic): Likewise. (actionCommand): Likewise. (getListeners): New method. (getActionListeners): New method. (getItemListeners): New method. (getChangeListeners): New method. (fireItemStateChanged): Simplified. (fireActionPerformed): Simplified. (fireStateChanged): Simplified. * javax/swing/JFrame.java (JFrame): Implements WindowContants. (HIDE_ON_CLOSE): Removed. (EXIT_ON_CLOSE): Removed. (DISPOSE_ON_CLOSE): Removed. (DO_NOTHING_ON_CLOSE): Removed. (processWindowEvent): Exit with code 0. (setDefaultCloseOperation): Do security check before setting value. * javax/swing/JOptionPane.java (message): Initialize only in constructor. * javax/swing/JToolTip.java: Removed unused imports. * javax/swing/JViewport.java (serialVersionUID): New member variable. (SIMPLE_SCROLL_MODE): Made final, fixed value. (BLIT_SCROLL_MODE): Likewise. (BACKINGSTORE_SCROLL_MODE): Likewise. (scrollUnderway): Made protected. (isViewSizeSet): Likewise. * javax/swing/ListModel.java: Fixed javadoc. * javax/swing/Popup.java: Likewise. * javax/swing/RepaintManager.java (paintDirtyRegions): Don't use internal classes of java.util.AbstractMap. * javax/swing/ScrollPaneConstants.java: Reindented. * javax/swing/ScrollPaneLayout.java (viewport): Made protected. (verticalScrollBar): Made protected, renamed to vsb. (horizontalScrollBar): Made protected, renamed to hsb. (rowHeader): Made protected, renamed to rowHead. (columnHeader): Made protected, renamed to colHead. (lowerLeft): Made protected. (lowerRight): Made protected. (upperLeft): Made protected. (upperRight): Made protected. (verticalScrollBarPolicy): Made protected, renamed to vsbPolicy. (horizontalScrollBarPolicy): Made protected, renamed to hsbPolicy. 2004-06-07 Bernd Schmidt * java/awt/MediaTracker.java (imageUpdate): Only set status to LOADING if flags has SOMEBITS set. 2004-06-07 Michael Koch * javax/swing/AbstractButton.java: Reorganized imports. * javax/swing/ActionMap.java: Likewise. * javax/swing/DefaultButtonModel.java: Likewise. * javax/swing/DefaultListModel.java: Likewise. * javax/swing/ImageIcon.java: Likewise. (serialVersionUID): New member variable. * javax/swing/JComboBox.java: Reorganized imports. * javax/swing/JComponent.java: Likewise. (ui): Made protected. (listenerList): Made protected. (TOOL_TIP_TEXT_KEY): New constant. (scrollRectToVisible): Removed redundant null check. * javax/swing/JFrame.java: Reorganized imports. * javax/swing/JInternalFrame.java: Reorganized imports. * javax/swing/JProgressBar.java: Likewise. * javax/swing/JRootPane.java: Likewise. * javax/swing/JScrollBar.java: Likewise. * javax/swing/JSeparator.java: Likewise. * javax/swing/JSlider.java: Likewise. * javax/swing/JTabbedPane.java: Likewise. * javax/swing/JTextField.java: Likewise. * javax/swing/JToolBar.java: Likewise. * javax/swing/JTree.java: Likewise. * javax/swing/JViewport.java: Likewise. * javax/swing/JWindow.java: Likewise. * javax/swing/KeyStroke.java: Likewise. * javax/swing/LookAndFeel.java: Likewise. * javax/swing/MenuSelectionManager.java: Likewise. * javax/swing/SwingUtilities.java: Likewise. * javax/swing/Timer.java: Likewise. * javax/swing/DefaultBoundedRangeModel.java: Fixed javadoc. * javax/swing/JList.java (HORIZONTAL_WRAP): Made final, fixed value. (VERTICAL): Likewise. (VERTICAL_WRAP): Likewise. 2004-06-07 Michael Koch * javax/swing/AbstractButton.java (serialVersionUID): New member variable. (AccessibleAbstractButton.serialVersionUID): Likewise. (AbstractButton): Made public. * javax/swing/Box.java (AccessibleBox.serialVersionUID): New member variable. (Filler.serialVersionUID): Likewise. * javax/swing/DefaultListSelectionModel.java (serialVersionUID): Likewise. * javax/swing/JApplet.java (serialVersionUID): Likewise. * javax/swing/JCheckBox.java (serialVersionUID): Likewise. * javax/swing/JCheckBoxMenuItem.java (serialVersionUID): Likewise. (AccessibleJCheckBoxMenuItem.serialVersionUID): Likewise. * javax/swing/JColorChooser.java (serialVersionUID): Likewise. (AccessibleJColorChooser.serialVersionUID): Likewise. * javax/swing/JComponent.java (serialVersionUID): Made private. (AccessibleJComponent.serialVersionUID): New member variable. * javax/swing/JDesktopPane.java (serialVersionUID): Likewise. * javax/swing/JDialog.java (serialVersionUID): Likewise. * javax/swing/JFormattedTextField.java (serialVersionUID): Fixed value. * javax/swing/JFrame.java (serialVersionUID): New member variable. (getDefaultCloseOpertation): Made public. * javax/swing/JLayeredPane.java (serialVersionUID): Likewise. (LAYER_PROPERTY): Made final, fixed value. (JLayeredPane): Made public. * javax/swing/JMenu.java (AccessibleJMenu.serialVersionUID): New member variable. (WinListener.serialVersionUID): Likewise. * javax/swing/JMenuBar.java (serialVersionUID): Likewise. (getComponentAtIndex): Added @deprecated tag. * javax/swing/JMenuItem.java (serialVersionUID): New member variable. (AccessibleJMenuItem.serialVersionUID): Likewise. * javax/swing/JOptionPane.java (serialVersionUID): Likewise. (AccessibleJOptionPane.serialVersionUID): Likewise. * javax/swing/JPopupMenu.java (serialVersionUID): Likewise. (AccessibleJPopupMenu.serialVersionUID): Likewise. (getPopupMenuListeners): New method. (getComponentAtIndex): Added @deprecated tag. * javax/swing/JProgressBar.java (serialVersionUID): New member variable. (AccessibleJProgressBar.serialVersionUID): Likewise. * javax/swing/JRadioButton.java (serialVersionUID): Likewise. * javax/swing/JRadioButtonMenuItem.java (serialVersionUID): Likewise. (AccessibleJRadioButtonMenuItem.serialVersionUID): Likewise. * javax/swing/JScrollBar.java (serialVersionUID): Likewise. (AccessibleJScrollBar.serialVersionUID): Likewise. * javax/swing/JSeparator.java (serialVersionUID): Likewise. (AccessibleJSeparator.serialVersionUID): Likewise. * javax/swing/JSlider.java: Fixed javadocs. (AccessibleJSlider.serialVersionUID): New member variable. * javax/swing/JSplitPane.java: Added copyright statement. (serialVersionUID): New member variable. (AccessibleJSplitPane.serialVersionUID): Likewise. * javax/swing/JTabbedPane.java (serialVersionUID): Likewise. (AccessibleJTabbedPane.serialVersionUID): Likewise. (ModelListener.serialVersionUID): Likewise. (ModelListener.ModelListener): New constructor. (SCROLL_TAB_LAYOUT): Made public final, fixed value. (WRAP_TAB_LAYOUT): Likewise. * javax/swing/JTable.java (serialVersionUID): New member variable. * javax/swing/JToggleButton.java (serialVersionUID): Likewise. (ToggleButtonModel): Made static. (ToggleButtonModel.serialVersionUID): New member variable. * javax/swing/JToolTip.java (serialVersionUID): Likewise. * javax/swing/JTree.java (serialVersionUID): Likewise. * javax/swing/JWindow.java (serialVersionUID): Likewise. * javax/swing/Timer.java (serialVersionUID): Likewise. 2004-06-06 Michael Koch * javax/swing/SwingConstants.java (NEXT): New constant. (PREVIOUS): Likewise. * javax/swing/UIManager.java (LookAndFeel): Made public. (LookAndFeel.getClassName): Likewise. (LookAndFeel.getName): Likewise. 2004-06-02 Olga Rodimina * javax/swing/JCheckBoxMenuItem.java: Removed CVS tags. * javax/swing/JMenu.java: Likewise. * javax/swing/JMenuBar.java: Likewise. * javax/swing/JMenuItem.java: Likewise. * javax/swing/JPopupMenu.java: Likewise. * javax/swing/JRadioButtonMenuItem.java: Likewise. * javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java:Likewise. * javax/swing/plaf/basic/BasicMenuBarUI.java: Likewise. * javax/swing/plaf/basic/BasicMenuItemUI.java: Likewise. * javax/swing/plaf/basic/BasicMenuUI.java: Likewise. * javax/swing/plaf/basic/BasicPopupMenuUI.java: Likewise. * javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java: Likewise. 2004-05-31 Olga Rodimina * javax/swing/plaf/basic/BasicMenuUI.java: (MouseEntered): Do not call getPath() from MenuSelectionManager. Call getPath() from super class instead. 2004-05-31 David Jee * java/awt/Container.java (remove): Set component visibility to false after removing it. 2004-05-27 Thomas Fitzsimmons * java/awt/Component.java (getForeground): Return SystemColor if parent is null. (getBackground): Likewise. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c (item_highlighted): New function. (connectSignals): Set item_highlighted as list's select function. * java/applet/Applet.java: Revert changes from 2004-04-29, 2004-03-15 and 2004-03-14. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c (drawString): Divide baseline y coordinate by PANGO_SCALE, not DPI conversion factor. * gnu/java/awt/peer/gtk/GtkTextAreaPeer.java (create): Set "Dialog" as the default font. * gnu/java/awt/peer/gtk/GtkTextFieldPeer.java (create): Likewise. * java/awt/Component.java (getFont): Return "Dialog" font by default. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.c: Multiply size argument to pango_font_description_set_size by the DPI conversion factor rather than by PANGO_SCALE. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c: Likewise. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c: Likewise. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c: Likewise. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c: Likewise. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c: Likewise. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c: Likewise. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c: Likewise. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c: Likewise. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c: Likewise. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c (drawString): Divide baseline y coordinate by DPI conversion factor rather than by PANGO_SCALE. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c (area_prepared): Fix typo. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c (gtkSetFont): Move gtk_bin_get_child inside GDK critical region. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c (dpi_conversion_factor): New global variable. (init_dpi_conversion_factor): New function to calculate and track DPI conversion factor. (dpi_changed_cb): New callback. * jni/gtk-peer/gtkpeer.h (dpi_conversion_factor): Declare. 2004-05-27 David Jee * gnu/java/awt/peer/gtk/GtkComponentPeer.java (getGraphics): Return a new GdkGraphics instance. * gnu/java/awt/peer/gtk/GtkContainerPeer.java (getGraphics): Call super.getGraphics(). 2004-05-26 Thomas Fitzsimmons * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c (setNativeBounds): Clamp width and height values to >= 0. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c (find_fg_color_widget): Handle GtkOptionMenu specially. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c (pre_event_handler): Only post configure events to visible top-level windows. 2004-05-26 David Jee * java/awt/BorderLayout.java (layoutContainer): Fix size calculations. 2004-05-26 Thomas Fitzsimmons * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c (window_wm_protocols_filter): Remove function. (create): Remove filter that removes WM_TAKE_FOCUS client messages. From-SVN: r83324 --- libjava/javax/swing/text/AbstractDocument.java | 684 +++++++++++------ libjava/javax/swing/text/BadLocationException.java | 17 +- libjava/javax/swing/text/DefaultCaret.java | 300 +++++--- libjava/javax/swing/text/Document.java | 25 +- libjava/javax/swing/text/GapContent.java | 124 +-- libjava/javax/swing/text/JTextComponent.java | 833 ++++++++++++--------- libjava/javax/swing/text/MutableAttributeSet.java | 84 +-- libjava/javax/swing/text/PlainDocument.java | 47 +- libjava/javax/swing/text/Style.java | 25 +- 9 files changed, 1287 insertions(+), 852 deletions(-) (limited to 'libjava/javax/swing/text') diff --git a/libjava/javax/swing/text/AbstractDocument.java b/libjava/javax/swing/text/AbstractDocument.java index 6408b22..18a8ea9 100644 --- a/libjava/javax/swing/text/AbstractDocument.java +++ b/libjava/javax/swing/text/AbstractDocument.java @@ -1,4 +1,4 @@ -/* AbstractDocument.java -- +/* AbstractDocument.java -- Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -37,6 +37,7 @@ exception statement from your version. */ package javax.swing.text; +import java.io.Serializable; import java.util.Dictionary; import java.util.Enumeration; import java.util.EventListener; @@ -47,321 +48,520 @@ import javax.swing.event.DocumentListener; import javax.swing.event.UndoableEditEvent; import javax.swing.event.UndoableEditListener; import javax.swing.tree.TreeNode; +import javax.swing.undo.AbstractUndoableEdit; +import javax.swing.undo.CompoundEdit; import javax.swing.undo.UndoableEdit; -public abstract class AbstractDocument implements Document -{ - Vector doc_list = new Vector(); - Vector undo_list = new Vector(); - // these still need to be implemented by a derived class: - public abstract Element getParagraphElement(int pos); - public abstract Element getDefaultRootElement(); +public abstract class AbstractDocument + implements Document, Serializable +{ + public abstract class AbstractElement + implements Element, TreeNode, Serializable + { + private static final long serialVersionUID = 1265312733007397733L; + + int count; + int offset; + AttributeSet attr; + Vector elts = new Vector(); + String name; + Element parent; + Vector kids = new Vector(); + TreeNode tree_parent; - // some inner classes sun says I should have: - abstract class AbstractElement implements Element, TreeNode + public AbstractElement(Element p, AttributeSet s) { - int count, offset; - AttributeSet attr; - Vector elts = new Vector(); - String name; - Element parent; - Vector kids = new Vector(); - TreeNode tree_parent; - - public AbstractElement(Element p, AttributeSet s) - { parent = p; attr = s; } - - public Enumeration children() { return kids.elements(); } - public boolean getAllowsChildren() { return true; } - public TreeNode getChildAt(int index) { return (TreeNode) kids.elementAt(index); } - public int getChildCount() { return kids.size(); } - public int getIndex(TreeNode node) { return kids.indexOf(node); } - public TreeNode getParent() { return tree_parent; } - - public AttributeSet getAttributes() { return attr; } - public Document getDocument() { return AbstractDocument.this; } - public Element getElement(int index) { return (Element)elts.elementAt(index); } - public String getName() { return name; } - public Element getParentElement() { return parent; } - - public abstract boolean isLeaf(); - public abstract int getEndOffset(); - public abstract int getElementCount(); - public abstract int getElementIndex(int offset); - public abstract int getStartOffset(); + parent = p; + attr = s; } - interface AttributeContext + public Enumeration children() { + return kids.elements(); } - - class BranchElement extends AbstractElement + public boolean getAllowsChildren() { - public BranchElement(Element e, AttributeSet a, int s, int end) - { super(e, a); } - - public boolean isLeaf() { return false; } - public int getEndOffset() { return 0; } - public int getElementCount() { return 0; } - public int getElementIndex(int offset) { return 0; } - public int getStartOffset() { return 0; } + return true; } - - interface Content - { - Position createPosition(int offset) throws BadLocationException; - int length(); - UndoableEdit insertString(int where, String str) throws BadLocationException; - UndoableEdit remove(int where, int nitems) throws BadLocationException; - String getString(int where, int len) throws BadLocationException; - void getChars(int where, int len, Segment txt) throws BadLocationException; - } - - class DefaultDocumentEvent implements DocumentEvent - { - public int len, off; - public Document getDocument() { return AbstractDocument.this; } - public int getLength() { return len; } - public int getOffset() { return off; } - public DocumentEvent.EventType getType() { return null; } - public DocumentEvent.ElementChange getChange(Element elem) { return null; } - } - - static class ElementEdit - { - } - - class LeafElement extends AbstractElement + + public TreeNode getChildAt(int index) { - LeafElement(Element e, AttributeSet a, int s, int end) - { super(e, a); } - - public boolean isLeaf() { return true; } - public int getEndOffset() { return 0; } - public int getElementCount() { return 0; } - public int getElementIndex(int offset) { return 0; } - public int getStartOffset() { return 0; } + return (TreeNode) kids.elementAt(index); } - - Content content; - - AbstractDocument(Content doc) + public int getChildCount() { - content = doc; + return kids.size(); } - - /******************************************************** - * - * the meat: - * - ***********/ - - public void addDocumentListener(DocumentListener listener) + public int getIndex(TreeNode node) { - doc_list.addElement(listener); + return kids.indexOf(node); } - - public void addUndoableEditListener(UndoableEditListener listener) + + public TreeNode getParent() { - undo_list.addElement(listener); - } - - protected Element createBranchElement(Element parent, AttributeSet a) - { - return new BranchElement(parent, a, 0, 0); + return tree_parent; } - - protected Element createLeafElement(Element parent, AttributeSet a, int p0, int p1) + + public AttributeSet getAttributes() { - return new LeafElement(parent, a, p0, p1-p0); + return attr; } - public Position createPosition(int offs) + public Document getDocument() { - final int a = offs; - return new Position() - { - public int getOffset() - { - return a; - } - }; + return AbstractDocument.this; } - - protected void fireChangedUpdate(DocumentEvent e) + + public Element getElement(int index) { + return (Element) elts.elementAt(index); } - - protected void fireInsertUpdate(DocumentEvent e) + + public String getName() { + return name; } - - protected void fireRemoveUpdate(DocumentEvent e) + + public Element getParentElement() { + return parent; } - - protected void fireUndoableEditUpdate(UndoableEditEvent e) + + public abstract boolean isLeaf(); + + public abstract int getEndOffset(); + + public abstract int getElementCount(); + + public abstract int getElementIndex(int offset); + + public abstract int getStartOffset(); + } + + public interface AttributeContext + { + } + + public class BranchElement extends AbstractElement + { + private static final long serialVersionUID = -8595176318868717313L; + + public BranchElement(Element e, AttributeSet a, int s, int end) { + super(e, a); } - int getAsynchronousLoadPriority() + + public boolean isLeaf() { - return 0; + return false; } - - protected AttributeContext getAttributeContext() + + public int getEndOffset() { - return null; + return 0; } - - Element getBidiRootElement() + + public int getElementCount() { - return null; + return 0; } - - protected Content getContent() + + public int getElementIndex(int offset) { - return content; + return 0; } - - protected Thread getCurrentWriter() + + public int getStartOffset() { - return null; + return 0; } + } + public interface Content + { + Position createPosition(int offset) throws BadLocationException; - public Dictionary getDocumentProperties() - { - return null; - } + int length(); + + UndoableEdit insertString(int where, String str) + throws BadLocationException; + + UndoableEdit remove(int where, int nitems) throws BadLocationException; + + String getString(int where, int len) throws BadLocationException; + + void getChars(int where, int len, Segment txt) throws BadLocationException; + } + + public class DefaultDocumentEvent extends CompoundEdit + implements DocumentEvent + { + private static final long serialVersionUID = -7406103236022413522L; + + public int len; + public int off; - public Position getEndPosition() + public Document getDocument() { - return null; + return AbstractDocument.this; } public int getLength() { - return content.length(); + return len; } - - public EventListener[] getListeners(Class listenerType) + + public int getOffset() { - return null; + return off; } - - public Object getProperty(Object key) + + public DocumentEvent.EventType getType() { - return null; + return null; } - public Element[] getRootElements() + public DocumentEvent.ElementChange getChange(Element elem) { - return null; + return null; } + } + + public static class ElementEdit extends AbstractUndoableEdit + { + private static final long serialVersionUID = -1216620962142928304L; + } + + public class LeafElement extends AbstractElement + { + private static final long serialVersionUID = 5115368706941283802L; - public Position getStartPosition() + public LeafElement(Element e, AttributeSet a, int s, int end) { - return null; + super(e, a); } - public String getText(int offset, int length) - { - try { - return content.getString(offset, length); - } catch (Exception e) { - System.out.println("Hmmm, fail to getText: " + offset + " -> " + length); - return null; - } - } - - public void getText(int offset, int length, Segment txt) - { - String a = getText(offset, length); - - if (a == null) - { - txt.offset = 0; - txt.count = 0; - txt.array = new char[0]; - return; - } - - txt.offset = offset; - txt.count = length; - - char chars[] = new char[ a.length() ]; - - a.getChars(0, a.length(), chars, 0); - - txt.array = chars; - } - - public void insertString(int offs, String str, AttributeSet a) - { - try { - content.insertString(offs, str); - } catch (Exception e) { - System.err.println("FAILED TO INSERT-STRING: " + e + ", at:"+offs); - } - } - - protected void insertUpdate(DefaultDocumentEvent chng, AttributeSet attr) - { - } - - protected void postRemoveUpdate(DefaultDocumentEvent chng) - { - } - - public void putProperty(Object key, Object value) - { - } - - public void readLock() - { - } - - public void readUnlock() - { - } - - public void remove(int offs, int len) + public boolean isLeaf() { + return true; } - - public void removeDocumentListener(DocumentListener listener) - { - } - - public void removeUndoableEditListener(UndoableEditListener listener) + + public int getEndOffset() { + return 0; } - - protected void removeUpdate(DefaultDocumentEvent chng) + + public int getElementCount() { + return 0; } - - public void render(Runnable r) + + public int getElementIndex(int offset) { + return 0; } - - void setAsynchronousLoadPriority(int p) + + public int getStartOffset() { + return 0; } + } + + private static final long serialVersionUID = -116069779446114664L; + + protected static final String BAD_LOCATION = "document location failure"; + + public static final String BidiElementName = "bidi level"; + public static final String ContentElementName = "content"; + public static final String ParagraphElementName = "paragraph"; + public static final String SectionElementName = "section"; + public static final String ElementNameAttribute = "$ename"; - void setDocumentProperties(Dictionary x) - { - } - - protected void writeLock() - { - } - - protected void writeUnlock() - { - } + Content content; + + protected AbstractDocument(Content doc) + { + this(doc, null); + } + + protected AbstractDocument(Content doc, AttributeContext context) + { + content = doc; + } + + protected EventListenerList listenerList = new EventListenerList(); + + // these still need to be implemented by a derived class: + public abstract Element getParagraphElement(int pos); + + public abstract Element getDefaultRootElement(); + + protected Element createBranchElement(Element parent, AttributeSet a) + { + return new BranchElement(parent, a, 0, 0); + } + + protected Element createLeafElement(Element parent, AttributeSet a, int p0, + int p1) + { + return new LeafElement(parent, a, p0, p1 - p0); + } + + public Position createPosition(int offs) + { + final int a = offs; + return new Position() + { + public int getOffset() + { + return a; + } + }; + } + + protected void fireChangedUpdate(DocumentEvent event) + { + DocumentListener[] listeners = getDocumentListeners(); + + for (int index = 0; index < listeners.length; ++index) + listeners[index].changedUpdate(event); + } + + protected void fireInsertUpdate(DocumentEvent event) + { + DocumentListener[] listeners = getDocumentListeners(); + + for (int index = 0; index < listeners.length; ++index) + listeners[index].insertUpdate(event); + } + + protected void fireRemoveUpdate(DocumentEvent event) + { + DocumentListener[] listeners = getDocumentListeners(); + + for (int index = 0; index < listeners.length; ++index) + listeners[index].removeUpdate(event); + } + + protected void fireUndoableEditUpdate(UndoableEditEvent event) + { + UndoableEditListener[] listeners = getUndoableEditListeners(); + + for (int index = 0; index < listeners.length; ++index) + listeners[index].undoableEditHappened(event); + } + + public int getAsynchronousLoadPriority() + { + return 0; + } + + protected AttributeContext getAttributeContext() + { + return null; + } + + public Element getBidiRootElement() + { + return null; + } + + protected Content getContent() + { + return content; + } + + protected Thread getCurrentWriter() + { + return null; + } + + public Dictionary getDocumentProperties() + { + return null; + } + + public Position getEndPosition() + { + return null; + } + + public int getLength() + { + return content.length(); + } + + public EventListener[] getListeners(Class listenerType) + { + return listenerList.getListeners(listenerType); + } + + public Object getProperty(Object key) + { + return null; + } + + public Element[] getRootElements() + { + return null; + } + + public Position getStartPosition() + { + return null; + } + + public String getText(int offset, int length) + { + try + { + return content.getString(offset, length); + } + catch (Exception e) + { + System.out.println("Hmmm, fail to getText: " + offset + " -> " + + length); + return null; + } + } + + public void getText(int offset, int length, Segment txt) + { + String a = getText(offset, length); + + if (a == null) + { + txt.offset = 0; + txt.count = 0; + txt.array = new char[0]; + return; + } + + txt.offset = offset; + txt.count = length; + + char[] chars = new char[a.length()]; + + a.getChars(0, a.length(), chars, 0); + + txt.array = chars; + } + + public void insertString(int offs, String str, AttributeSet a) + throws BadLocationException + { + content.insertString(offs, str); + } + + protected void insertUpdate(DefaultDocumentEvent chng, AttributeSet attr) + { + } + + protected void postRemoveUpdate(DefaultDocumentEvent chng) + { + } + + public void putProperty(Object key, Object value) + { + } + + public void readLock() + { + } + + public void readUnlock() + { + } + + public void remove(int offs, int len) + { + } + + /** + * Adds a DocumentListener object to this document. + * + * @param listener the listener to add + */ + public void addDocumentListener(DocumentListener listener) + { + listenerList.add(DocumentListener.class, listener); + } + + /** + * Removes a DocumentListener object from this document. + * + * @param listener the listener to remove + */ + public void removeDocumentListener(DocumentListener listener) + { + listenerList.remove(DocumentListener.class, listener); + } + + /** + * Returns add added DocumentListener objects. + * + * @return an array of listeners + */ + public DocumentListener[] getDocumentListeners() + { + return (DocumentListener[]) getListeners(DocumentListener.class); + } + + /** + * Adds a UndoableEditListener object to this document. + * + * @param listener the listener to add + */ + public void addUndoableEditListener(UndoableEditListener listener) + { + listenerList.add(UndoableEditListener.class, listener); + } + + /** + * Removes a UndoableEditListener object from this document. + * + * @param listener the listener to remove + */ + public void removeUndoableEditListener(UndoableEditListener listener) + { + listenerList.remove(UndoableEditListener.class, listener); + } + + /** + * Returns add added UndoableEditListener objects. + * + * @return an array of listeners + */ + public UndoableEditListener[] getUndoableEditListeners() + { + return (UndoableEditListener[]) getListeners(UndoableEditListener.class); + } + + protected void removeUpdate(DefaultDocumentEvent chng) + { + } + + public void render(Runnable r) + { + } + + public void setAsynchronousLoadPriority(int p) + { + } + + public void setDocumentProperties(Dictionary x) + { + } + + protected void writeLock() + { + } + + protected void writeUnlock() + { + } } diff --git a/libjava/javax/swing/text/BadLocationException.java b/libjava/javax/swing/text/BadLocationException.java index d62ad54..01463d1 100644 --- a/libjava/javax/swing/text/BadLocationException.java +++ b/libjava/javax/swing/text/BadLocationException.java @@ -1,5 +1,5 @@ -/* BadLocationException.java -- - Copyright (C) 2002 Free Software Foundation, Inc. +/* BadLocationException.java -- + Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -37,27 +37,28 @@ exception statement from your version. */ package javax.swing.text; - public class BadLocationException extends Exception -{ - int offset; +{ + private static final long serialVersionUID = -7712259886815656766L; + int offset; + /** * Constructs a BadLocationException * * @param str A string indicating what was wrong with the arguments * @param offset Offset within the document that was requested >= 0 */ - public BadLocationException (String str, int offset) + public BadLocationException(String str, int offset) { - super (str); + super(str); this.offset = offset; } /** * Returns the offset into the document that was not legal */ - public int offsetRequested () + public int offsetRequested() { return offset; } diff --git a/libjava/javax/swing/text/DefaultCaret.java b/libjava/javax/swing/text/DefaultCaret.java index 1c4607fc..d79e920 100644 --- a/libjava/javax/swing/text/DefaultCaret.java +++ b/libjava/javax/swing/text/DefaultCaret.java @@ -1,4 +1,4 @@ -/* DefaultCaret.java -- +/* DefaultCaret.java -- Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -44,132 +44,184 @@ import java.awt.Rectangle; import java.awt.event.FocusListener; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; -import java.util.Vector; +import java.util.EventListener; +import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -public class DefaultCaret extends Rectangle implements Caret, FocusListener, MouseListener, MouseMotionListener +public class DefaultCaret extends Rectangle + implements Caret, FocusListener, MouseListener, MouseMotionListener { - Color color = new Color(0,0,0); - JTextComponent parent; - - public void mouseDragged(java.awt.event.MouseEvent evt) - { - } - - public void mouseMoved(java.awt.event.MouseEvent evt) - { - } - - public void mouseClicked(java.awt.event.MouseEvent evt) - { - } - - public void mouseEntered(java.awt.event.MouseEvent evt) - { - } - - public void mouseExited(java.awt.event.MouseEvent evt) - { - } - - public void mousePressed(java.awt.event.MouseEvent evt) - { - } - - public void mouseReleased(java.awt.event.MouseEvent evt) - { - } - - public void focusGained(java.awt.event.FocusEvent evt) - { - } - - public void focusLost(java.awt.event.FocusEvent evt) - { - } - - // caret methods: - - public void deinstall(JTextComponent c) - { - parent.removeFocusListener(this); - parent.removeMouseListener(this); - - parent = null; - } - public void install(JTextComponent c) - { - parent.addFocusListener(this); - parent.addMouseListener(this); - parent = c; - repaint(); - } - - Point magic = null; - public void setMagicCaretPosition(Point p) - { magic = p; } - public Point getMagicCaretPosition() - { return magic; } - - - int mark = 0; - public int getMark() - { return mark; } - - boolean vis_sel = true; - public void setSelectionVisible(boolean v) - { vis_sel = v; repaint(); } - public boolean isSelectionVisible() - { return vis_sel; } - - private void repaint() - { - if (parent != null) - { - parent.repaint(); - } - } - - public void paint(Graphics g) - { - g.setColor(color); - g.drawLine(x,y, - x,y+height); - } - - - Vector changes = new Vector(); - public void addChangeListener(ChangeListener l) - { changes.addElement(l); } - public void removeChangeListener(ChangeListener l) - { changes.removeElement(l); } - - - int blink = 500; - public int getBlinkRate() - { return blink; } - public void setBlinkRate(int rate) - { blink = rate; } - - int dot = 0; - public int getDot() - { return dot; } - public void moveDot(int dot) - { setDot(dot); } - public void setDot(int dot) - { - this.dot = dot; - repaint(); - } - - boolean vis = true; - public boolean isVisible() - { return vis; } - public void setVisible(boolean v) - { - vis = v; - repaint(); - } + protected ChangeEvent changeEvent = new ChangeEvent(this); + protected EventListenerList listenerList = new EventListenerList(); + + Color color = new Color(0, 0, 0); + JTextComponent parent; + Point magic = null; + int mark = 0; + boolean vis_sel = true; + int blink = 500; + int dot = 0; + boolean vis = true; + + + public void mouseDragged(java.awt.event.MouseEvent evt) + { + } + + public void mouseMoved(java.awt.event.MouseEvent evt) + { + } + + public void mouseClicked(java.awt.event.MouseEvent evt) + { + } + + public void mouseEntered(java.awt.event.MouseEvent evt) + { + } + + public void mouseExited(java.awt.event.MouseEvent evt) + { + } + + public void mousePressed(java.awt.event.MouseEvent evt) + { + } + + public void mouseReleased(java.awt.event.MouseEvent evt) + { + } + + public void focusGained(java.awt.event.FocusEvent evt) + { + } + + public void focusLost(java.awt.event.FocusEvent evt) + { + } + + public void deinstall(JTextComponent c) + { + parent.removeFocusListener(this); + parent.removeMouseListener(this); + parent = null; + } + + public void install(JTextComponent c) + { + parent.addFocusListener(this); + parent.addMouseListener(this); + parent = c; + repaint(); + } + + public void setMagicCaretPosition(Point p) + { + magic = p; + } + + public Point getMagicCaretPosition() + { + return magic; + } + + public int getMark() + { + return mark; + } + + public void setSelectionVisible(boolean v) + { + vis_sel = v; + repaint(); + } + + public boolean isSelectionVisible() + { + return vis_sel; + } + + private void repaint() + { + if (parent != null) + parent.repaint(); + } + + public void paint(Graphics g) + { + g.setColor(color); + g.drawLine(x, y, x, y + height); + } + + public EventListener[] getListeners(Class listenerType) + { + return listenerList.getListeners(listenerType); + } + + public void addChangeListener(ChangeListener listener) + { + listenerList.add(ChangeListener.class, listener); + } + + public void removeChangeListener(ChangeListener listener) + { + listenerList.remove(ChangeListener.class, listener); + } + + public ChangeListener[] getChangeListeners() + { + return (ChangeListener[]) getListeners(ChangeListener.class); + } + + protected void fireStateChanged() + { + ChangeListener[] listeners = getChangeListeners(); + + for (int index = 0; index < listeners.length; ++index) + listeners[index].stateChanged(changeEvent); + } + + protected final JTextComponent getComponent() + { + return parent; + } + + public int getBlinkRate() + { + return blink; + } + + public void setBlinkRate(int rate) + { + blink = rate; + } + + public int getDot() + { + return dot; + } + + public void moveDot(int dot) + { + setDot(dot); + } + + public void setDot(int dot) + { + this.dot = dot; + repaint(); + } + + public boolean isVisible() + { + return vis; + } + + public void setVisible(boolean v) + { + vis = v; + repaint(); + } } diff --git a/libjava/javax/swing/text/Document.java b/libjava/javax/swing/text/Document.java index 351b0aa..6ecb7ca 100644 --- a/libjava/javax/swing/text/Document.java +++ b/libjava/javax/swing/text/Document.java @@ -1,4 +1,4 @@ -/* Document.java -- +/* Document.java -- Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -40,27 +40,44 @@ package javax.swing.text; import javax.swing.event.DocumentListener; import javax.swing.event.UndoableEditListener; + public interface Document -{ +{ String StreamDescriptionProperty = "stream"; - String TitleProperty = "text"; void addDocumentListener(DocumentListener listener); + void addUndoableEditListener(UndoableEditListener listener); + Position createPosition(int offs); + Element getDefaultRootElement(); + Position getEndPosition(); + int getLength(); + Object getProperty(Object key); + Element[] getRootElements(); + Position getStartPosition(); + String getText(int offset, int length); + void getText(int offset, int length, Segment txt); - void insertString(int offset, String str, AttributeSet a); + + void insertString(int offset, String str, AttributeSet a) + throws BadLocationException; + void putProperty(Object key, Object value); + void remove(int offs, int len); + void removeDocumentListener(DocumentListener listener); + void removeUndoableEditListener(UndoableEditListener listener); + void render(Runnable r); } diff --git a/libjava/javax/swing/text/GapContent.java b/libjava/javax/swing/text/GapContent.java index 5016543..9344682 100644 --- a/libjava/javax/swing/text/GapContent.java +++ b/libjava/javax/swing/text/GapContent.java @@ -1,4 +1,4 @@ -/* GapContent.java -- +/* GapContent.java -- Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -35,69 +35,75 @@ this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ -package javax.swing.text; +package javax.swing.text; + +import java.io.Serializable; // too lazy to make a real gapcontent. // lets just use a stringbuffer instead. - import javax.swing.undo.UndoableEdit; -public class GapContent implements AbstractDocument.Content +public class GapContent + implements AbstractDocument.Content, Serializable { - StringBuffer buf = new StringBuffer(); - - public GapContent() - { - this(10); - } + private static final long serialVersionUID = 8374645204155842629L; - public GapContent(int size) - { - } - - public Position createPosition(final int offset) throws BadLocationException - { - return new Position() - { - int off = offset; - public int getOffset() - { - return off; - } - }; - } - - public int length() - { - return buf.length(); - } - - public UndoableEdit insertString(int where, String str) throws BadLocationException - { - buf.insert(where, str); - return null; - } - - public UndoableEdit remove(int where, int nitems) throws BadLocationException - { - buf.delete(where, where + nitems); - return null; - } - - public String getString(int where, int len) throws BadLocationException - { - return buf.toString(); - } - - public void getChars(int where, int len, Segment txt) throws BadLocationException - { - txt.array = new char[len]; - - System.arraycopy(buf.toString().toCharArray(), where, - txt.array, 0, - len); - - txt.count = len; - txt.offset = 0; - } + StringBuffer buf = new StringBuffer(); + + public GapContent() + { + this(10); + } + + public GapContent(int size) + { + } + + public Position createPosition(final int offset) throws BadLocationException + { + return new Position() + { + int off = offset; + + public int getOffset() + { + return off; + } + }; + } + + public int length() + { + return buf.length(); + } + + public UndoableEdit insertString(int where, String str) + throws BadLocationException + { + buf.insert(where, str); + return null; + } + + public UndoableEdit remove(int where, int nitems) + throws BadLocationException + { + buf.delete(where, where + nitems); + return null; + } + + public String getString(int where, int len) throws BadLocationException + { + return buf.toString(); + } + + public void getChars(int where, int len, Segment txt) + throws BadLocationException + { + txt.array = new char[len]; + + System.arraycopy(buf.toString().toCharArray(), where, txt.array, 0, len); + + txt.count = len; + txt.offset = 0; + } } diff --git a/libjava/javax/swing/text/JTextComponent.java b/libjava/javax/swing/text/JTextComponent.java index 48bb0c0..6451ef5 100644 --- a/libjava/javax/swing/text/JTextComponent.java +++ b/libjava/javax/swing/text/JTextComponent.java @@ -1,5 +1,5 @@ -/* JTextComponent.java -- - Copyright (C) 2002 Free Software Foundation, Inc. +/* JTextComponent.java -- + Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -42,8 +42,10 @@ import java.awt.Component; import java.awt.Dimension; import java.awt.Image; import java.awt.Insets; -import java.awt.Rectangle; import java.awt.Point; +import java.awt.Rectangle; +import java.awt.event.InputMethodListener; + import javax.accessibility.Accessible; import javax.accessibility.AccessibleContext; import javax.accessibility.AccessibleRole; @@ -51,6 +53,7 @@ import javax.accessibility.AccessibleStateSet; import javax.accessibility.AccessibleText; import javax.swing.Icon; import javax.swing.JComponent; +import javax.swing.JViewport; import javax.swing.KeyStroke; import javax.swing.Scrollable; import javax.swing.UIManager; @@ -60,6 +63,7 @@ import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.plaf.TextUI; + public abstract class JTextComponent extends JComponent implements Scrollable, Accessible { @@ -67,410 +71,323 @@ public abstract class JTextComponent extends JComponent // implements AccessibleText, CaretListener, DocumentListener, // AccessibleAction, AccessibleEditableText // { -// } // class AccessibleJTextComponent - - /** - * AccessibleJTextComponent - */ - public class AccessibleJTextComponent extends AccessibleJComponent - implements AccessibleText, CaretListener, DocumentListener { - - //------------------------------------------------------------- - // Variables -------------------------------------------------- - //------------------------------------------------------------- - - /** - * caretPos - */ - int caretPos; - - - //------------------------------------------------------------- - // Initialization --------------------------------------------- - //------------------------------------------------------------- - - /** - * Constructor AccessibleJTextComponent - * @param component TODO - */ - public AccessibleJTextComponent(JTextComponent component) { - super(component); - // TODO - } // AccessibleJTextComponent() - - - //------------------------------------------------------------- - // Methods ---------------------------------------------------- - //------------------------------------------------------------- - - /** - * getCaretPosition - * @returns int - */ - public int getCaretPosition() { - return 0; // TODO - } // getCaretPosition() - - /** - * getSelectedText - * @returns String - */ - public String getSelectedText() { - return null; // TODO - } // getSelectedText() - - /** - * getSelectionStart - * @returns int - */ - public int getSelectionStart() { - return 0; // TODO - } // getSelectionStart() - - /** - * getSelectionEnd - * @returns int - */ - public int getSelectionEnd() { - return 0; // TODO - } // getSelectionEnd() - - /** - * caretUpdate - * @param value0 TODO - */ - public void caretUpdate(CaretEvent value0) { - // TODO - } // caretUpdate() - - /** - * getAccessibleStateSet - * @returns AccessibleStateSet - */ - public AccessibleStateSet getAccessibleStateSet() { - return null; // TODO - } // getAccessibleStateSet() - - /** - * getAccessibleRole - * @returns AccessibleRole - */ - public AccessibleRole getAccessibleRole() { - return null; // TODO - } // getAccessibleRole() - - /** - * getAccessibleText - * @returns AccessibleText - */ - public AccessibleText getAccessibleText() { - return null; // TODO - } // getAccessibleText() - - /** - * insertUpdate - * @param value0 TODO - */ - public void insertUpdate(DocumentEvent value0) { - // TODO - } // insertUpdate() - - /** - * removeUpdate - * @param value0 TODO - */ - public void removeUpdate(DocumentEvent value0) { - // TODO - } // removeUpdate() - - /** - * changedUpdate - * @param value0 TODO - */ - public void changedUpdate(DocumentEvent value0) { - // TODO - } // changedUpdate() - - /** - * getIndexAtPoint - * @param value0 TODO - * @returns int - */ - public int getIndexAtPoint(Point value0) { - return 0; // TODO - } // getIndexAtPoint() - - /** - * getRootEditorRect - * @returns Rectangle - */ - Rectangle getRootEditorRect() { - return null; // TODO - } // getRootEditorRect() - - /** - * getCharacterBounds - * @param value0 TODO - * @returns Rectangle - */ - public Rectangle getCharacterBounds(int value0) { - return null; // TODO - } // getCharacterBounds() - - /** - * getCharCount - * @returns int - */ - public int getCharCount() { - return 0; // TODO - } // getCharCount() - - /** - * getCharacterAttribute - * @param value0 TODO - * @returns AttributeSet - */ - public AttributeSet getCharacterAttribute(int value0) { - return null; // TODO - } // getCharacterAttribute() - - /** - * getAtIndex - * @param value0 TODO - * @param value1 TODO - * @returns String - */ - public String getAtIndex(int value0, int value1) { - return null; // TODO - } // getAtIndex() - - /** - * getAfterIndex - * @param value0 TODO - * @param value1 TODO - * @returns String - */ - public String getAfterIndex(int value0, int value1) { - return null; // TODO - } // getAfterIndex() - - /** - * getBeforeIndex - * @param value0 TODO - * @param value1 TODO - * @returns String - */ - public String getBeforeIndex(int value0, int value1) { - return null; // TODO - } // getBeforeIndex() - - - } // AccessibleJTextComponent - +// } - - public static class KeyBinding + /** + * AccessibleJTextComponent + */ + public class AccessibleJTextComponent extends AccessibleJComponent + implements AccessibleText, CaretListener, DocumentListener { - public KeyStroke key; - public String actionName; - public KeyBinding(KeyStroke key, String actionName) - { - this.key = key; - this.actionName = actionName; - } - } // class KeyBinding + private static final long serialVersionUID = 7664188944091413696L; - int icon_gap; - Icon icon; - int align; - Document doc; + /** + * caretPos + */ + int caretPos; - public JTextComponent() + /** + * Constructor AccessibleJTextComponent + * @param component TODO + */ + public AccessibleJTextComponent() { - this("", null, 0); } - public JTextComponent(Icon image) + /** + * getCaretPosition + * @return int + */ + public int getCaretPosition() { - this("", image, 0); + return 0; // TODO } - public JTextComponent(Icon image, int horizontalAlignment) + /** + * getSelectedText + * @return String + */ + public String getSelectedText() { - this("", image, horizontalAlignment); + return null; // TODO } - public JTextComponent(String text) + /** + * getSelectionStart + * @return int + */ + public int getSelectionStart() { - this(text, null, 0); + return 0; // TODO } - public JTextComponent(String text, int horizontalAlignment) + /** + * getSelectionEnd + * @return int + */ + public int getSelectionEnd() { - this(text, null, horizontalAlignment); + return 0; // TODO } - public JTextComponent(String text, Icon icon, int horizontalAlignment) + /** + * caretUpdate + * @param value0 TODO + */ + public void caretUpdate(CaretEvent value0) { - setDocument(new PlainDocument()); - - // do the work..... - setText(text); - this.icon = icon; - this.align = horizontalAlignment; - - // its an editor, so: - enableEvents(AWTEvent.KEY_EVENT_MASK); - updateUI(); + // TODO } - public void setDocument(Document s) + /** + * getAccessibleStateSet + * @return AccessibleStateSet + */ + public AccessibleStateSet getAccessibleStateSet() { - doc = s; - revalidate(); - repaint(); + return null; // TODO } - public Document getDocument() + /** + * getAccessibleRole + * @return AccessibleRole + */ + public AccessibleRole getAccessibleRole() { - if (doc == null) - System.out.println("doc == null !!!"); - return doc; + return null; // TODO } - protected int checkHorizontalKey(int key, String message) - { - // Verify that key is a legal value for the horizontalAlignment properties. - return 0; - } - protected int checkVerticalKey(int key, String message) - { - // Verify that key is a legal value for the verticalAlignment or verticalTextPosition properties. - return 0; - } - public AccessibleContext getAccessibleContext() - { - // Get the AccessibleContext of this object - return null; - } - public Icon getDisabledIcon() + /** + * getAccessibleText + * @return AccessibleText + */ + public AccessibleText getAccessibleText() { - return null; + return null; // TODO } - public int getDisplayedMnemonic() - { - // Return the keycode that indicates a mnemonic key. - return 0; - } - public int getHorizontalAlignment() - { - // Returns the alignment of the label's contents along the X axis. - return 0; - } - public int getHorizontalTextPosition() - { - // Returns the horizontal position of the label's text, relative to its image. - return 0; - } - - public Icon getIcon() - { return icon; } - public int getIconTextGap() - { return icon_gap; } - - Component getLabelFor() + /** + * insertUpdate + * @param value0 TODO + */ + public void insertUpdate(DocumentEvent value0) { - // Get the component this is labelling. - return null; + // TODO } - public Insets getMargin() + /** + * removeUpdate + * @param value0 TODO + */ + public void removeUpdate(DocumentEvent value0) { - // FIXME: Not implemented. - return null; + // TODO } - public void setText(String text) - { - getDocument().remove(0,doc.getLength()); - getDocument().insertString(0, text, null); - } - - public String getText() + /** + * changedUpdate + * @param value0 TODO + */ + public void changedUpdate(DocumentEvent value0) { - return getDocument().getText(0, - getDocument().getLength()); + // TODO } - public String getUIClassID() - { - // Returns a string that specifies the name of the l&f class that renders this component. - return "TextComponentUI"; - } - public int getVerticalAlignment() - { - // Returns the alignment of the label's contents along the Y axis. - return 0; - } - public int getVerticalTextPosition() + /** + * getIndexAtPoint + * @param value0 TODO + * @return int + */ + public int getIndexAtPoint(Point value0) { - // Returns the vertical position of the label's text, relative to its image. - return 0; + return 0; // TODO } - public boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h) - { - // This is overriden to return false if the current Icon's Image is not equal to the passed in Image img. - return (img == icon); - } - protected String paramString() + /** + * getRootEditorRect + * @return Rectangle + */ + Rectangle getRootEditorRect() { - // Returns a string representation of this JTextComponent. - return "JTextComponent"; + return null; } - void setDisabledIcon(Icon disabledIcon) + + /** + * getCharacterBounds + * @param value0 TODO + * @return Rectangle + */ + public Rectangle getCharacterBounds(int value0) { - // Set the icon to be displayed if this JTextComponent is "disabled" (JTextComponent.setEnabled(false)). + return null; // TODO } - void setDisplayedMnemonic(char aChar) + + /** + * getCharCount + * @return int + */ + public int getCharCount() { - // Specifies the displayedMnemonic as a char value. + return 0; // TODO } - void setDisplayedMnemonic(int key) + + /** + * getCharacterAttribute + * @param value0 TODO + * @return AttributeSet + */ + public AttributeSet getCharacterAttribute(int value0) { - // Specify a keycode that indicates a mnemonic key. + return null; // TODO } - void setHorizontalAlignment(int alignment) + + /** + * getAtIndex + * @param value0 TODO + * @param value1 TODO + * @return String + */ + public String getAtIndex(int value0, int value1) { - // Sets the alignment of the label's contents along the X axis. + return null; // TODO } - void setHorizontalTextPosition(int textPosition) + + /** + * getAfterIndex + * @param value0 TODO + * @param value1 TODO + * @return String + */ + public String getAfterIndex(int value0, int value1) { - // Sets the horizontal position of the label's text, relative to its image. + return null; // TODO } - void setIcon(Icon icon) + + /** + * getBeforeIndex + * @param value0 TODO + * @param value1 TODO + * @return String + */ + public String getBeforeIndex(int value0, int value1) { - // Defines the icon this component will display. + return null; // TODO } - public void setIconTextGap(int iconTextGap) + } + + public static class KeyBinding + { + public KeyStroke key; + public String actionName; + + public KeyBinding(KeyStroke key, String actionName) { - // If both the icon and text properties are set, this property defines the space between them. + this.key = key; + this.actionName = actionName; } + } + + private static final long serialVersionUID = -8796518220218978795L; - public void setLabelFor(Component c) - { - // Set the component this is labelling. - } - - public void setVerticalAlignment(int alignment) - { - // Sets the alignment of the label's contents along the Y axis. - } - public void setVerticalTextPosition(int textPosition) - { - // Sets the vertical position of the label's text, relative to its image. - } + public static final String DEFAULT_KEYMAP = "default"; + public static final String FOCUS_ACCELERATOR_KEY = "focusAcceleratorKey"; + + private Document doc; + private Caret caret; + private boolean editable; + + public JTextComponent() + { + enableEvents(AWTEvent.KEY_EVENT_MASK); + updateUI(); + } + + public void setDocument(Document s) + { + doc = s; + revalidate(); + repaint(); + } + + public Document getDocument() + { + if (doc == null) + System.out.println("doc == null !!!"); + return doc; + } + + /** + * Get the AccessibleContext of this object + */ + public AccessibleContext getAccessibleContext() + { + return null; + } + + public Insets getMargin() + { + // FIXME: Not implemented. + return null; + } + + public void setText(String text) + { + try + { + getDocument().remove(0, doc.getLength()); + getDocument().insertString(0, text, null); + } + catch (BadLocationException e) + { + } + } + + /** + * Retrieves the current text in this text document. + * + * @return the text + * + * @exception NullPointerException if the underlaying document is null + */ + public String getText() + { + return getDocument().getText(0, getDocument().getLength()); + } + + /** + * Retrieves a part of the current text in this document. + * + * @param offset the postion of the first character + * @param length the length of the text to retrieve + * + * @return the text + * + * @exception BadLocationException if arguments do not hold pre-conditions + */ + public String getText(int offset, int length) + throws BadLocationException + { + return getDocument().getText(offset, length); + } + + /** + * Returns a string that specifies the name of the l&f class + * that renders this component. + * + * @return the string "TextComponentUI" + */ + public String getUIClassID() + { + return "TextComponentUI"; + } + + /** + * Returns a string representation of this JTextComponent. + */ + protected String paramString() + { + return "JTextComponent"; + } public TextUI getUI() { @@ -486,26 +403,246 @@ public abstract class JTextComponent extends JComponent { return null; } + public int getScrollableUnitIncrement(Rectangle visible, int orientation, int direction) { return 0; } + public int getScrollableBlockIncrement(Rectangle visible, int orientation, int direction) { return 0; } -} // class JTextComponent + /** + * Checks whether this text component it editable. + * + * @return true if editable, false otherwise + */ + public boolean isEditable() + { + return editable; + } + + /** + * Enables/disabled this text component's editability. + * + * @param editable true to make it editable, false otherwise. + */ + public void setEditable(boolean editable) + { + firePropertyChange("editable", this.editable, editable); + this.editable = editable; + } + + /** + * The Caret object used in this text component. + * + * @return the caret object + */ + public Caret getCaret() + { + return caret; + } + + /** + * Retrisves the current caret position. + * + * @return the current position + */ + public int getCaretPosition() + { + return caret.getDot(); + } + + /** + * Sets the caret to a new position. + * + * @param position the new position + */ + public void setCaretPosition(int position) + { + if (doc == null) + return; + + if (position < 0 || position > doc.getLength()) + throw new IllegalArgumentException(); + + caret.setDot(position); + } + + /** + * Moves the caret to a given position. This selects the text between + * the old and the new position of the caret. + */ + public void moveCaretPosition(int position) + { + if (doc == null) + return; + + if (position < 0 || position > doc.getLength()) + throw new IllegalArgumentException(); + + caret.moveDot(position); + } + + /** + * Returns the start postion of the currently selected text. + * + * @return the start postion + */ + public int getSelectionStart() + { + return Math.min(caret.getDot(), caret.getMark()); + } + + /** + * Selects the text from the given postion to the selection end position. + * + * @param end the start positon of the selected text. + */ + public void setSelectionStart(int start) + { + select(start, getSelectionEnd()); + } + + /** + * Returns the end postion of the currently selected text. + * + * @return the end postion + */ + public int getSelectionEnd() + { + return Math.max(caret.getDot(), caret.getMark()); + } + + /** + * Selects the text from the selection start postion to the given position. + * + * @param end the end positon of the selected text. + */ + public void setSelectionEnd(int end) + { + select(getSelectionStart(), end); + } + + /** + * Selects a part of the content of the text component. + * + * @param start the start position of the selected text + * @param ent the end position of the selected text + */ + public void select(int start, int end) + { + int length = doc.getLength(); + + start = Math.max(start, 0); + start = Math.min(start, length); + + end = Math.max(end, 0); + end = Math.min(end, length); + + setCaretPosition(start); + moveCaretPosition(end); + } + + /** + * Selects the whole content of the text component. + */ + public void selectAll() + { + select(0, doc.getLength()); + } + + public boolean getScrollableTracksViewportHeight() + { + if (getParent() instanceof JViewport) + return ((JViewport) getParent()).getHeight() > getPreferredSize().height; + return false; + } + public boolean getScrollableTracksViewportWidth() + { + if (getParent() instanceof JViewport) + return ((JViewport) getParent()).getWidth() > getPreferredSize().width; + return false; + } + /** + * Adds a CaretListener object to this text component. + * + * @param listener the listener to add + */ + public void addCaretListener(CaretListener listener) + { + listenerList.add(CaretListener.class, listener); + } + /** + * Removed a CaretListener object from this text component. + * + * @param listener the listener to remove + */ + public void removeCaretListener(CaretListener listener) + { + listenerList.remove(CaretListener.class, listener); + } + /** + * Returns all added CaretListener objects. + * + * @return an array of listeners + */ + public CaretListener[] getCaretListeners() + { + return (CaretListener[]) getListeners(CaretListener.class); + } + /** + * Notifies all registered CaretListener objects that the caret + * was updated. + * + * @param event the event to send + */ + protected void fireCaretUpdate(CaretEvent event) + { + CaretListener[] listeners = getCaretListeners(); + for (int index = 0; index < listeners.length; ++index) + listeners[index].caretUpdate(event); + } + /** + * Adds an InputListener object to this text component. + * + * @param listener the listener to add + */ + public void addInputMethodListener(InputMethodListener listener) + { + listenerList.add(InputMethodListener.class, listener); + } + /** + * Removes an InputListener object from this text component. + * + * @param listener the listener to remove + */ + public void removeInputMethodListener(InputMethodListener listener) + { + listenerList.remove(InputMethodListener.class, listener); + } + /** + * Returns all added InputMethodListener objects. + * + * @return an array of listeners + */ + public InputMethodListener[] getInputMethodListeners() + { + return (InputMethodListener[]) getListeners(InputMethodListener.class); + } +} diff --git a/libjava/javax/swing/text/MutableAttributeSet.java b/libjava/javax/swing/text/MutableAttributeSet.java index 6bc18df..d8cb62a 100644 --- a/libjava/javax/swing/text/MutableAttributeSet.java +++ b/libjava/javax/swing/text/MutableAttributeSet.java @@ -44,48 +44,42 @@ import java.util.Enumeration; * @author Andrew Selkirk * @version 1.0 */ -public interface MutableAttributeSet extends AttributeSet { - - //------------------------------------------------------------- - // Methods ---------------------------------------------------- - //------------------------------------------------------------- - - /** - * addAttribute - * @param name TODO - * @param value TODO - */ - void addAttribute(Object name, Object value); - - /** - * addAttributes - * @param attributes TODO - */ - void addAttributes(AttributeSet attributes); - - /** - * removeAttribute - * @param name TODO - */ - void removeAttribute(Object name); - - /** - * removeAttributes - * @param names TODO - */ - void removeAttributes(Enumeration names); - - /** - * removeAttributes - * @param attributes TODO - */ - void removeAttributes(AttributeSet attributes); - - /** - * setResolveParent - * @param parent TODO - */ - void setResolveParent(AttributeSet parent); - - -} // MutableAttributeSet +public interface MutableAttributeSet extends AttributeSet +{ + /** + * addAttribute + * @param name TODO + * @param value TODO + */ + void addAttribute(Object name, Object value); + + /** + * addAttributes + * @param attributes TODO + */ + void addAttributes(AttributeSet attributes); + + /** + * removeAttribute + * @param name TODO + */ + void removeAttribute(Object name); + + /** + * removeAttributes + * @param names TODO + */ + void removeAttributes(Enumeration names); + + /** + * removeAttributes + * @param attributes TODO + */ + void removeAttributes(AttributeSet attributes); + + /** + * setResolveParent + * @param parent TODO + */ + void setResolveParent(AttributeSet parent); +} diff --git a/libjava/javax/swing/text/PlainDocument.java b/libjava/javax/swing/text/PlainDocument.java index 45fe5ef..930e5d3 100644 --- a/libjava/javax/swing/text/PlainDocument.java +++ b/libjava/javax/swing/text/PlainDocument.java @@ -1,5 +1,5 @@ -/* PlainDocument.java -- - Copyright (C) 2002 Free Software Foundation, Inc. +/* PlainDocument.java -- + Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -37,22 +37,33 @@ exception statement from your version. */ package javax.swing.text; - public class PlainDocument extends AbstractDocument { - PlainDocument() - { - super(new GapContent()); - } - - public Element getDefaultRootElement() - { - return null; - } - - public Element getParagraphElement(int pos) - { - return null; - } -} + private static final long serialVersionUID = 4758290289196893664L; + + public static final String lineLimitAttribute = "lineLimit"; + public static final String tabSizeAttribute = "tabSize"; + + private int tabSize; + + public PlainDocument() + { + this(new GapContent()); + } + public PlainDocument(AbstractDocument.Content content) + { + super(content); + tabSize = 8; + } + + public Element getDefaultRootElement() + { + return null; + } + + public Element getParagraphElement(int pos) + { + return null; + } +} diff --git a/libjava/javax/swing/text/Style.java b/libjava/javax/swing/text/Style.java index f6c8723..d8553c0 100644 --- a/libjava/javax/swing/text/Style.java +++ b/libjava/javax/swing/text/Style.java @@ -39,9 +39,26 @@ package javax.swing.text; import javax.swing.event.ChangeListener; -public interface Style +public interface Style extends MutableAttributeSet { - void addChangeListener(ChangeListener l); - String getName(); - void removeChangeListener(ChangeListener l); + /** + * Returns the name of the style. + * + * @return the name + */ + String getName(); + + /** + * Adds a ChangeListener object to the style. + * + * @param listener the listener object to add + */ + void addChangeListener(ChangeListener listener); + + /** + * Removes a ChangeListener from to the style. + * + * @param listener the listener object to remove, + */ + void removeChangeListener(ChangeListener listener); } -- cgit v1.1