diff options
author | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-08-09 04:26:17 +0000 |
---|---|---|
committer | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-08-09 04:26:17 +0000 |
commit | 71946bc3b406beb3d1fb9b447204e4236d645c43 (patch) | |
tree | cdf9958b411887bead2263ea8ef0bdfc8eae6319 /libjava/javax/swing/text | |
parent | 0fc014c9ce8232f14be66144bf5a4c08a3e5ffe7 (diff) | |
download | gcc-71946bc3b406beb3d1fb9b447204e4236d645c43.tar.gz |
AWT/Swing merge from GNU Classpath.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56147 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/javax/swing/text')
25 files changed, 3274 insertions, 0 deletions
diff --git a/libjava/javax/swing/text/AbstractDocument.java b/libjava/javax/swing/text/AbstractDocument.java new file mode 100644 index 00000000000..56ec3777920 --- /dev/null +++ b/libjava/javax/swing/text/AbstractDocument.java @@ -0,0 +1,360 @@ +/* AbstractDocument.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + +import javax.swing.event.*; +import javax.swing.undo.*; +import java.util.*; +import javax.swing.tree.*; + +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(); + + // some inner classes sun says I should have: + abstract class AbstractElement implements Element, TreeNode + { + 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(); + } + + interface AttributeContext + { + } + + + class BranchElement extends AbstractElement + { + 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; } + } + + public interface Content + { + public Position createPosition(int offset) throws BadLocationException; + public int length(); + public UndoableEdit insertString(int where, String str) throws BadLocationException; + public UndoableEdit remove(int where, int nitems) throws BadLocationException; + public String getString(int where, int len) throws BadLocationException; + public void getChars(int where, int len, Segment txt) throws BadLocationException; + } + + class DefaultDocumentEvent implements DocumentEvent + { + 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 + { + 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; } + } + + + Content content; + + AbstractDocument(Content doc) + { + content = doc; + } + + /******************************************************** + * + * the meat: + * + ***********/ + + + public void addDocumentListener(DocumentListener listener) + { + doc_list.addElement(listener); + } + + public void addUndoableEditListener(UndoableEditListener listener) + { + undo_list.addElement(listener); + } + + 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 e) + { + } + + protected void fireInsertUpdate(DocumentEvent e) + { + } + + protected void fireRemoveUpdate(DocumentEvent e) + { + } + + protected void fireUndoableEditUpdate(UndoableEditEvent e) + { + } + int getAsynchronousLoadPriority() + { + return 0; + } + + protected AttributeContext getAttributeContext() + { + return null; + } + + Element getBidiRootElement() + { + return null; + } + + protected Content getContent() + { + return content; + } + + protected Thread getCurrentWriter() + { + return null; + } + + + Dictionary getDocumentProperties() + { + return null; + } + + public Position getEndPosition() + { + return null; + } + + public int getLength() + { + return content.length(); + } + + EventListener[] getListeners(Class listenerType) + { + return null; + } + + 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) + { + 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) + { + } + + void readLock() + { + } + + void readUnlock() + { + } + + public void remove(int offs, int len) + { + } + + public void removeDocumentListener(DocumentListener listener) + { + } + + public void removeUndoableEditListener(UndoableEditListener listener) + { + } + + protected void removeUpdate(DefaultDocumentEvent chng) + { + } + + public void render(Runnable r) + { + } + + void setAsynchronousLoadPriority(int p) + { + } + + void setDocumentProperties(Dictionary x) + { + } + + protected void writeLock() + { + } + + protected void writeUnlock() + { + } +} diff --git a/libjava/javax/swing/text/AttributeSet.java b/libjava/javax/swing/text/AttributeSet.java new file mode 100644 index 00000000000..2ed3fc37d80 --- /dev/null +++ b/libjava/javax/swing/text/AttributeSet.java @@ -0,0 +1,54 @@ +/* AttributeSet.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + +import java.util.*; + + +public interface AttributeSet +{ + boolean containsAttribute(Object name, Object value); + boolean containsAttributes(AttributeSet attributes); + AttributeSet copyAttributes(); + Object getAttribute(Object key); + int getAttributeCount(); + Enumeration getAttributeNames(); + AttributeSet getResolveParent(); + boolean isDefined(Object attrName); + boolean isEqual(AttributeSet attr); +} diff --git a/libjava/javax/swing/text/BadLocationException.java b/libjava/javax/swing/text/BadLocationException.java new file mode 100644 index 00000000000..81e6cc8dc03 --- /dev/null +++ b/libjava/javax/swing/text/BadLocationException.java @@ -0,0 +1,46 @@ +/* BadLocationException.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + + +public class BadLocationException extends Exception +{ + BadLocationException() + { + } +} diff --git a/libjava/javax/swing/text/Caret.java b/libjava/javax/swing/text/Caret.java new file mode 100644 index 00000000000..69f63edf68d --- /dev/null +++ b/libjava/javax/swing/text/Caret.java @@ -0,0 +1,62 @@ +/* Caret.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + +import java.awt.*; +import javax.swing.event.*; + +public interface Caret +{ + void addChangeListener(ChangeListener l); + void deinstall(JTextComponent c); + int getBlinkRate(); + int getDot(); + Point getMagicaretPosition(); + int getMark(); + void install(JTextComponent c); + boolean isSelectionVisible(); + boolean isVisible(); + void moveDot(int dot); + void paint(Graphics g); + void removeChangeListener(ChangeListener l); + void setBlinkRate(int rate); + void setDot(int dot); + void setMagicCaretPosition(Point p); + void setSelectionVisible(boolean v); + void setVisible(boolean v); +} diff --git a/libjava/javax/swing/text/CharacterIterator.java b/libjava/javax/swing/text/CharacterIterator.java new file mode 100644 index 00000000000..71c8d660e4f --- /dev/null +++ b/libjava/javax/swing/text/CharacterIterator.java @@ -0,0 +1,53 @@ +/* CharacterIterator.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + + +public interface CharacterIterator extends Cloneable +{ + Object clone(); + char current(); + char first(); + int getBeginIndex(); + int getEndIndex(); + int getIndex(); + char last(); + char next(); + char previous(); + char setIndex(int position); +} diff --git a/libjava/javax/swing/text/ComponentView.java b/libjava/javax/swing/text/ComponentView.java new file mode 100644 index 00000000000..220ba0c8185 --- /dev/null +++ b/libjava/javax/swing/text/ComponentView.java @@ -0,0 +1,101 @@ +/* ComponentView.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + +import java.awt.*; + +public class ComponentView extends View +{ + public ComponentView(Element elem) + { + super(elem); + } + + + protected Component createComponent() + { + return null; + } + + public float getAlignment(int axis) + { + return 0; + } + + public Component getComponent() + { + return null; + } + + public float getMaximumSpan(int axis) + { + return 0; + } + + public float getMinimumSpan(int axis) + { + return 0; + } + + public float getPreferredSpan(int axis) + { + return 0; + } + + public Shape modelToView(int pos, Shape a, Position.Bias b) + { + return null; + } + + public void paint(Graphics g, Shape a) + { + } + + public void setParent(View p) + { + } + + public void setSize(float width, float height) + { + } + + public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) + { + return 0; + } +} diff --git a/libjava/javax/swing/text/DefaultCaret.java b/libjava/javax/swing/text/DefaultCaret.java new file mode 100644 index 00000000000..7fb7f945262 --- /dev/null +++ b/libjava/javax/swing/text/DefaultCaret.java @@ -0,0 +1,172 @@ +/* DefaultCaret.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + +import java.awt.*; +import java.util.*; +import java.awt.event.*; +import javax.swing.event.*; + + +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 getMagicaretPosition() + { 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(); + } +} + + + diff --git a/libjava/javax/swing/text/DefaultEditorKit.java b/libjava/javax/swing/text/DefaultEditorKit.java new file mode 100644 index 00000000000..550c4a74db4 --- /dev/null +++ b/libjava/javax/swing/text/DefaultEditorKit.java @@ -0,0 +1,89 @@ +/* DefaultEditorKit.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + +import javax.swing.*; +import java.io.*; + +public class DefaultEditorKit extends EditorKit +{ + void deinstall(JEditorPane c) + { + // Called when the kit is being removed from the JEditorPane. + } + void install(JEditorPane c) + { + } + + Caret createCaret() + { + return null; + } + Document createDefaultDocument() + { + return new PlainDocument(); + } + + Action[] getActions() + { + return null; + } + + String getContentType() + { + return "text/plain"; + } + + ViewFactory getViewFactory() + { + return null; + } + void read(InputStream in, Document doc, int pos) + { + } + void read(Reader in, Document doc, int pos) + { + } + void write(OutputStream out, Document doc, int pos, int len) + { + } + void write(Writer out, Document doc, int pos, int len) + { + } +} + diff --git a/libjava/javax/swing/text/Document.java b/libjava/javax/swing/text/Document.java new file mode 100644 index 00000000000..398030f0849 --- /dev/null +++ b/libjava/javax/swing/text/Document.java @@ -0,0 +1,62 @@ +/* Document.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + + +import javax.swing.event.*; + +public interface Document +{ + 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 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/EditorKit.java b/libjava/javax/swing/text/EditorKit.java new file mode 100644 index 00000000000..b52298c441c --- /dev/null +++ b/libjava/javax/swing/text/EditorKit.java @@ -0,0 +1,71 @@ +/* EditorKit.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + +import javax.swing.*; +import java.io.*; + +public abstract class EditorKit implements Cloneable +{ + EditorKit() + { + } + + EditorKit(EditorKit kit) + { + } + + void deinstall(JEditorPane c) + { + // Called when the kit is being removed from the JEditorPane. + } + void install(JEditorPane c) + { + } + + abstract Caret createCaret(); + abstract Document createDefaultDocument(); + abstract Action[] getActions(); + abstract String getContentType(); + abstract ViewFactory getViewFactory(); + abstract void read(InputStream in, Document doc, int pos); + abstract void read(Reader in, Document doc, int pos); + abstract void write(OutputStream out, Document doc, int pos, int len); + abstract void write(Writer out, Document doc, int pos, int len); +} + diff --git a/libjava/javax/swing/text/Element.java b/libjava/javax/swing/text/Element.java new file mode 100644 index 00000000000..9f61612649f --- /dev/null +++ b/libjava/javax/swing/text/Element.java @@ -0,0 +1,54 @@ +/* Element.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + + + +public interface Element +{ + AttributeSet getAttributes(); + Document getDocument(); + Element getElement(int index); + int getElementCount(); + int getElementIndex(int offset); + int getEndOffset(); + String getName(); + Element getParentElement(); + int getStartOffset(); + boolean isLeaf(); + } diff --git a/libjava/javax/swing/text/GapContent.java b/libjava/javax/swing/text/GapContent.java new file mode 100644 index 00000000000..d6986974be2 --- /dev/null +++ b/libjava/javax/swing/text/GapContent.java @@ -0,0 +1,104 @@ +/* GapContent.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + +// too lazy to make a real gapcontent. +// lets just use a stringbuffer instead. + +import javax.swing.undo.*; + + +public class GapContent implements AbstractDocument.Content +{ + 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 new file mode 100644 index 00000000000..9a6d350f048 --- /dev/null +++ b/libjava/javax/swing/text/JTextComponent.java @@ -0,0 +1,497 @@ +/* JTextComponent.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + +import java.awt.AWTEvent; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Image; +import java.awt.Rectangle; +import java.awt.Point; +import javax.accessibility.*; +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.KeyStroke; +import javax.swing.Scrollable; +import javax.swing.UIManager; +import javax.swing.event.*; +import javax.swing.plaf.TextUI; + +public abstract class JTextComponent extends JComponent + implements Scrollable, Accessible +{ +// public class AccessibleJTextComponent extends AccessibleJComponent +// 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 + { + public KeyStroke key; + public String actionName; + public KeyBinding(KeyStroke key, String actionName) + { + this.key = key; + this.actionName = actionName; + } + } // class KeyBinding + + int icon_gap; + Icon icon; + int align; + Document doc; + + public JTextComponent() + { + this("", null, 0); + } + + public JTextComponent(Icon image) + { + this("", image, 0); + } + + public JTextComponent(Icon image, int horizontalAlignment) + { + this("", image, horizontalAlignment); + } + + public JTextComponent(String text) + { + this(text, null, 0); + } + + public JTextComponent(String text, int horizontalAlignment) + { + this(text, null, horizontalAlignment); + } + + public JTextComponent(String text, Icon icon, int horizontalAlignment) + { + setDocument(new PlainDocument()); + + // do the work..... + setText(text); + this.icon = icon; + this.align = horizontalAlignment; + + // its an editor, so: + 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; + } + + 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() + { + return null; + } + 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() + { + // Get the component this is labelling. + return null; + } + + public void setText(String text) + { + getDocument().remove(0,doc.getLength()); + getDocument().insertString(0, text, null); + } + + public String getText() + { + return getDocument().getText(0, + getDocument().getLength()); + } + + public String getUIClassID() + { + // Returns a string that specifies the name of the l&f class that renders this component. + return "JTextComponent"; + } + public int getVerticalAlignment() + { + // Returns the alignment of the label's contents along the Y axis. + return 0; + } + public int getVerticalTextPosition() + { + // Returns the vertical position of the label's text, relative to its image. + return 0; + } + + 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() + { + // Returns a string representation of this JTextComponent. + return "JTextComponent"; + } + void setDisabledIcon(Icon disabledIcon) + { + // Set the icon to be displayed if this JTextComponent is "disabled" (JTextComponent.setEnabled(false)). + } + void setDisplayedMnemonic(char aChar) + { + // Specifies the displayedMnemonic as a char value. + } + void setDisplayedMnemonic(int key) + { + // Specify a keycode that indicates a mnemonic key. + } + void setHorizontalAlignment(int alignment) + { + // Sets the alignment of the label's contents along the X axis. + } + void setHorizontalTextPosition(int textPosition) + { + // Sets the horizontal position of the label's text, relative to its image. + } + void setIcon(Icon icon) + { + // Defines the icon this component will display. + } + public void setIconTextGap(int iconTextGap) + { + // If both the icon and text properties are set, this property defines the space between them. + } + + 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 TextUI getUI() + { return (TextUI) ui; + } + + public void updateUI() + { + TextUI b = (TextUI)UIManager.getUI(this); + setUI(b); + } + + public Dimension getPreferredScrollableViewportSize() + { + 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 + + + + + + + + + + + + diff --git a/libjava/javax/swing/text/Keymap.java b/libjava/javax/swing/text/Keymap.java new file mode 100644 index 00000000000..1d947123baf --- /dev/null +++ b/libjava/javax/swing/text/Keymap.java @@ -0,0 +1,59 @@ +/* Keymap.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + +import javax.swing.*; + +public interface Keymap +{ + void addActionForKeyStroke(KeyStroke key, Action a); + Action getAction(KeyStroke key); + Action[] getBoundActions(); + KeyStroke[] getBoundKeyStrokes(); + Action getDefaultAction(); + KeyStroke[] getKeyStrokesForAction(Action a); + String getName(); + Keymap getResolveParent(); + boolean isLocallyDefined(KeyStroke key); + void removeBindings(); + void removeKeyStrokeBinding(KeyStroke keys); + void setDefaultAction(Action a); + void setResolveParent(Keymap parent); +} + + diff --git a/libjava/javax/swing/text/MutableAttributeSet.java b/libjava/javax/swing/text/MutableAttributeSet.java new file mode 100644 index 00000000000..429e6a8a53d --- /dev/null +++ b/libjava/javax/swing/text/MutableAttributeSet.java @@ -0,0 +1,92 @@ +/* MutableAttributeSet.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + +// Imports +import java.util.*; + +/** + * MutableAttributeSet + * @author Andrew Selkirk + * @version 1.0 + */ +public interface MutableAttributeSet extends AttributeSet { + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * addAttribute + * @param name TODO + * @param value TODO + */ + public void addAttribute(Object name, Object value); + + /** + * addAttributes + * @param attributes TODO + */ + public void addAttributes(AttributeSet attributes); + + /** + * removeAttribute + * @param name TODO + */ + public void removeAttribute(Object name); + + /** + * removeAttributes + * @param names TODO + */ + public void removeAttributes(Enumeration names); + + /** + * removeAttributes + * @param attributes TODO + */ + public void removeAttributes(AttributeSet attributes); + + /** + * setResolveParent + * @param parent TODO + */ + public void setResolveParent(AttributeSet parent); + + +} // MutableAttributeSet diff --git a/libjava/javax/swing/text/PlainDocument.java b/libjava/javax/swing/text/PlainDocument.java new file mode 100644 index 00000000000..45fe5ef01be --- /dev/null +++ b/libjava/javax/swing/text/PlainDocument.java @@ -0,0 +1,58 @@ +/* PlainDocument.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + + +public class PlainDocument extends AbstractDocument +{ + PlainDocument() + { + super(new GapContent()); + } + + public Element getDefaultRootElement() + { + return null; + } + + public Element getParagraphElement(int pos) + { + return null; + } +} + diff --git a/libjava/javax/swing/text/PlainEditorKit.java b/libjava/javax/swing/text/PlainEditorKit.java new file mode 100644 index 00000000000..fbeb91f0888 --- /dev/null +++ b/libjava/javax/swing/text/PlainEditorKit.java @@ -0,0 +1,99 @@ +/* PlainEditorKit.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + +import javax.swing.*; +import java.io.*; + +public class PlainEditorKit extends EditorKit +{ + public PlainEditorKit() + { + } + + public PlainEditorKit(PlainEditorKit kit) + { + super(kit); + } + + protected Object clone() + { + return new PlainEditorKit(this); + } + void deinstall(JEditorPane c) + { + // Called when the kit is being removed from the JEditorPane. + } + void install(JEditorPane c) + { + } + + Caret createCaret() + { + return null; + } + Document createDefaultDocument() + { + return null; + } + Action[] getActions() + { + return null; + } + String getContentType() + { + return null; + } + ViewFactory getViewFactory() + { + return null; + } + void read(InputStream in, Document doc, int pos) + { + } + void read(Reader in, Document doc, int pos) + { + } + void write(OutputStream out, Document doc, int pos, int len) + { + } + void write(Writer out, Document doc, int pos, int len) + { + } +} + diff --git a/libjava/javax/swing/text/Position.java b/libjava/javax/swing/text/Position.java new file mode 100644 index 00000000000..be5406043f2 --- /dev/null +++ b/libjava/javax/swing/text/Position.java @@ -0,0 +1,48 @@ +/* Position.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + + +public interface Position +{ + static class Bias + { + } + + int getOffset(); +} diff --git a/libjava/javax/swing/text/Segment.java b/libjava/javax/swing/text/Segment.java new file mode 100644 index 00000000000..9d96c05ff24 --- /dev/null +++ b/libjava/javax/swing/text/Segment.java @@ -0,0 +1,110 @@ +/* Segment.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + +import java.util.*; + + +public class Segment implements Cloneable, CharacterIterator +{ + char[] array; + int count; + int offset; + + public Object clone() + { + try { + return super.clone(); + } catch (Exception e) { + System.err.println("Huuuhhh, this class implements cloneable !!!!!!"); + System.err.println("I think there is a bug in this JVM somewhere"); + } + return null; + } + + public char current() + { + return array[getIndex()]; + } + + public char first() + { + offset = getBeginIndex(); + return array[offset]; + } + + public int getBeginIndex() + { + return offset; + } + + public int getEndIndex() + { + return offset + count; + } + public int getIndex() + { + return offset; + } + public char last() + { + offset = getEndIndex() - 1; + return array[offset]; + } + public char next() + { + offset++; + return array[offset]; + } + public char previous() + { + offset--; + return array[offset]; + } + public char setIndex(int position) + { + offset = position; + return array[offset]; + } + + public String toString() + { + return new String(array, offset, count); + } +} + diff --git a/libjava/javax/swing/text/Style.java b/libjava/javax/swing/text/Style.java new file mode 100644 index 00000000000..99c4e329ab5 --- /dev/null +++ b/libjava/javax/swing/text/Style.java @@ -0,0 +1,47 @@ +/* Style.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + +import javax.swing.event.*; + +public interface Style +{ + void addChangeListener(ChangeListener l); + String getName(); + void removeChangeListener(ChangeListener l); +} diff --git a/libjava/javax/swing/text/StyledDocument.java b/libjava/javax/swing/text/StyledDocument.java new file mode 100644 index 00000000000..737703f0228 --- /dev/null +++ b/libjava/javax/swing/text/StyledDocument.java @@ -0,0 +1,145 @@ +/* StyledDcoument.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + +// Imports +import java.awt.*; + +/** + * StyledDocument + * @author Andrew Selkirk + * @version 1.0 + */ +public interface StyledDocument extends Document { + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * addStyle + * @param nm TODO + * @param rent TODO + * @returns Style + */ + public Style addStyle(String nm, Style parent); + + /** + * removeStyle + * @param nm TODO + */ + public void removeStyle(String nm); + + /** + * getStyle + * @param nm TODO + * @returns Style + */ + public Style getStyle(String nm); + + /** + * setCharacterAttributes + * @param offset TODO + * @param length TODO + * @param set TODO + * @param replace TODO + */ + public void setCharacterAttributes(int offset, int length, + AttributeSet set, boolean replace); + + /** + * setParagraphAttributes + * @param offset TODO + * @param length TODO + * @param set TODO + * @param replace TODO + */ + public void setParagraphAttributes(int offset, int length, + AttributeSet set, boolean replace); + + /** + * getLogicalStyle + * @param position TODO + * @returns Style + */ + public Style getLogicalStyle(int position); + + /** + * setLogicalStyle + * @param position TODO + * @param style TODO + */ + public void setLogicalStyle(int position, Style style); + + /** + * getParagraphElement + * @param position TODO + * @returns Element + */ + public abstract Element getParagraphElement(int position); + + /** + * getCharacterElement + * @param position TODO + * @returns Element + */ + public Element getCharacterElement(int position); + + /** + * getForeground + * @param set TODO + * @returns Color + */ + public Color getForeground(AttributeSet set); + + /** + * getBackground + * @param set TODO + * @returns Color + */ + public Color getBackground(AttributeSet set); + + /** + * getFont + * @param set TODO + * @returns Font + */ + public Font getFont(AttributeSet set); + + +} // StyledDocument diff --git a/libjava/javax/swing/text/StyledEditorKit.java b/libjava/javax/swing/text/StyledEditorKit.java new file mode 100644 index 00000000000..84b27bd11a0 --- /dev/null +++ b/libjava/javax/swing/text/StyledEditorKit.java @@ -0,0 +1,612 @@ +/* StyledEditorKit.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + +// Imports +import java.awt.*; +import java.awt.event.*; +import java.beans.*; +import java.io.*; +import javax.swing.*; +import javax.swing.event.*; + +/** + * StyledEditorKit + * @author Andrew Selkirk + * @version 1.0 + */ +public class StyledEditorKit extends DefaultEditorKit { + + //------------------------------------------------------------- + // Classes ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * UnderlineAction + */ + public static class UnderlineAction extends StyledEditorKit.StyledTextAction { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor UnderlineAction + */ + public UnderlineAction() { + super("TODO"); + // TODO + } // UnderlineAction() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * actionPerformed + * @param event TODO + */ + public void actionPerformed(ActionEvent event) { + // TODO + } // actionPerformed() + + + } // UnderlineAction + + /** + * ItalicAction + */ + public static class ItalicAction extends StyledEditorKit.StyledTextAction { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ItalicAction + */ + public ItalicAction() { + super("TODO"); + // TODO + } // ItalicAction() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * actionPerformed + * @param event TODO + */ + public void actionPerformed(ActionEvent event) { + // TODO + } // actionPerformed() + + + } // ItalicAction + + /** + * BoldAction + */ + public static class BoldAction extends StyledEditorKit.StyledTextAction { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor BoldAction + */ + public BoldAction() { + super("TODO"); + // TODO + } // BoldAction() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * actionPerformed + * @param event TODO + */ + public void actionPerformed(ActionEvent event) { + // TODO + } // actionPerformed() + + + } // BoldAction + + /** + * AlignmentAction + */ + public static class AlignmentAction extends StyledEditorKit.StyledTextAction { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * a + */ + private int a; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AlignmentAction + * @param nm TODO + * @param a TODO + */ + public AlignmentAction(String nm, int a) { + super("TODO"); + // TODO + } // AlignmentAction() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * actionPerformed + * @param event TODO + */ + public void actionPerformed(ActionEvent event) { + // TODO + } // actionPerformed() + + + } // AlignmentAction + + /** + * ForegroundAction + */ + public static class ForegroundAction extends StyledEditorKit.StyledTextAction { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * fg + */ + private Color fg; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor ForegroundAction + * @param nm TODO + * @param fg TODO + */ + public ForegroundAction(String nm, Color fg) { + super("TODO"); + // TODO + } // ForegroundAction() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * actionPerformed + * @param event TODO + */ + public void actionPerformed(ActionEvent event) { + // TODO + } // actionPerformed() + + + } // ForegroundAction + + /** + * FontSizeAction + */ + public static class FontSizeAction extends StyledEditorKit.StyledTextAction { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * size + */ + private int size; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor FontSizeAction + * @param nm TODO + * @param size TODO + */ + public FontSizeAction(String nm, int size) { + super("TODO"); + // TODO + } // FontSizeAction() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * actionPerformed + * @param event TODO + */ + public void actionPerformed(ActionEvent event) { + // TODO + } // actionPerformed() + + + } // FontSizeAction + + /** + * FontFamilyAction + */ + public static class FontFamilyAction extends StyledEditorKit.StyledTextAction { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * family + */ + private String family; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor FontFamilyAction + * @param nm TODO + * @param family TODO + */ + public FontFamilyAction(String nm, String family) { + super("TODO"); + // TODO + } // FontFamilyAction() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * actionPerformed + * @param event TODO + */ + public void actionPerformed(ActionEvent event) { + // TODO + } // actionPerformed() + + + } // FontFamilyAction + + /** + * StyledTextAction + */ + public abstract static class StyledTextAction extends TextAction { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor StyledTextAction + * @param nm TODO + */ + public StyledTextAction(String nm) { + super(nm); + // TODO + } // StyledTextAction() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getEditor + * @param event TODO + * @returns JEditorPane + */ + protected final JEditorPane getEditor(ActionEvent event) { + return null; // TODO + } // getEditor() + + /** + * setCharacterAttributes + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + protected final void setCharacterAttributes(JEditorPane value0, AttributeSet value1, boolean value2) { + // TODO + } // setCharacterAttributes() + + /** + * getStyledDocument + * @param value0 TODO + * @returns StyledDocument + */ + protected final StyledDocument getStyledDocument(JEditorPane value0) { + return null; // TODO + } // getStyledDocument() + + /** + * getStyledEditorKit + * @param value0 TODO + * @returns StyledEditorKit + */ + protected final StyledEditorKit getStyledEditorKit(JEditorPane value0) { + return null; // TODO + } // getStyledEditorKit() + + /** + * setParagraphAttributes + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + protected final void setParagraphAttributes(JEditorPane value0, AttributeSet value1, boolean value2) { + // TODO + } // setParagraphAttributes() + + + } // StyledTextAction + + /** + * StyledViewFactory + */ + static class StyledViewFactory implements ViewFactory { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor StyledViewFactory + */ + StyledViewFactory() { + // TODO + } // StyledViewFactory() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * create + * @param value0 TODO + * @returns View + */ + public View create(Element value0) { + return null; // TODO + } // create() + + + } // StyledViewFactory + + /** + * AttributeTracker + */ + class AttributeTracker implements CaretListener, PropertyChangeListener, Serializable { + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor AttributeTracker + * @param value0 TODO + */ + AttributeTracker(StyledEditorKit value0) { + // TODO + } // AttributeTracker() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * updateInputAttributes + * @param value0 TODO + * @param value1 TODO + * @param value2 TODO + */ + void updateInputAttributes(int value0, int value1, JTextComponent value2) { + // TODO + } // updateInputAttributes() + + /** + * propertyChange + * @param value0 TODO + */ + public void propertyChange(PropertyChangeEvent value0) { + // TODO + } // propertyChange() + + /** + * caretUpdate + * @param value0 TODO + */ + public void caretUpdate(CaretEvent value0) { + // TODO + } // caretUpdate() + + + } // AttributeTracker + + + //------------------------------------------------------------- + // Variables -------------------------------------------------- + //------------------------------------------------------------- + + /** + * currentRun + */ + Element currentRun; + + /** + * currentParagraph + */ + Element currentParagraph; + + /** + * inputAttributes + */ + MutableAttributeSet inputAttributes; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor StyledEditorKit + */ + public StyledEditorKit() { + // TODO + } // StyledEditorKit() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * clone + * @returns Object + */ + public Object clone() { + return null; // TODO + } // clone() + + /** + * getActions + * @returns Action[] + */ + public Action[] getActions() { + return null; // TODO + } // getActions() + + /** + * getInputAttributes + * @returns MutableAttributeSet + */ + public MutableAttributeSet getInputAttributes() { + return null; // TODO + } // getInputAttributes() + + /** + * getCharacterAttributeRun + * @returns Element + */ + public Element getCharacterAttributeRun() { + return null; // TODO + } // getCharacterAttributeRun() + + /** + * createDefaultDocument + * @returns Document + */ + public Document createDefaultDocument() { + return null; // TODO + } // createDefaultDocument() + + /** + * install + * @param component TODO + */ + public void install(JEditorPane component) { + // TODO + } // install() + + /** + * deinstall + * @param component TODO + */ + public void deinstall(JEditorPane component) { + // TODO + } // deinstall() + + /** + * getViewFactory + * @returns ViewFactory + */ + public ViewFactory getViewFactory() { + return null; // TODO + } // getViewFactory() + + /** + * createInputAttributes + * @param element TODO + * @param set TODO + */ + protected void createInputAttributes(Element element, + MutableAttributeSet set) { + // TODO + } // createInputAttributes() + + +} // StyledEditorKit diff --git a/libjava/javax/swing/text/TextAction.java b/libjava/javax/swing/text/TextAction.java new file mode 100644 index 00000000000..5af1ce03445 --- /dev/null +++ b/libjava/javax/swing/text/TextAction.java @@ -0,0 +1,96 @@ +/* TextAction.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + +// Imports +import java.awt.event.*; +import javax.swing.*; + +/** + * TextAction + * @author Andrew Selkirk + * @version 1.0 + */ +public abstract class TextAction extends AbstractAction { + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructor TextAction + * @param name TODO + */ + public TextAction(String name) { + // TODO + } // TextAction() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * getTextComponent + * @param event TODO + * @returns JTextComponent + */ + protected final JTextComponent getTextComponent(ActionEvent event) { + return null; // TODO + } // getTextComponent() + + /** + * augmentList + * @param list1 TODO + * @param list2 TODO + * @returns Action[] + */ + public static final Action[] augmentList(Action[] list1, Action[] list2) { + return null; // TODO + } // augmentList() + + /** + * getFocusedComponent + * @returns JTextComponent + */ + protected final JTextComponent getFocusedComponent() { + return null; // TODO + } // getFocusedComponent() + + +} // TextAction diff --git a/libjava/javax/swing/text/View.java b/libjava/javax/swing/text/View.java new file mode 100644 index 00000000000..b09ed7ebeba --- /dev/null +++ b/libjava/javax/swing/text/View.java @@ -0,0 +1,139 @@ +/* View.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + +import java.awt.*; +import javax.swing.*; +import java.util.*; + +public abstract class View implements SwingConstants +{ + static int BadBreakWeight; + static int ExcellentBreakWeight; + static int ForcedBreakWeight; + static int GoodBreakWeight; + + public final static int X_AXIS = 0; + public final static int Y_AXIS = 1; + + float width, height; + Element elt; + View parent; + + /** + * this vector contains the views ordered at offsets... + */ + Vector v = new Vector(); + + + public View(Element elem) + { + elt = elem; + } + + public int getViewCount() + { + return v.size(); + } + + public View getView(int a) + { + return (View) v.get(a); + } + + public void remove(int i) + { + v.removeElementAt(i); + } + + public void insert(int off, View view) + { + v.insertElementAt(view, off); + } + + public void append(View view) + { + v.addElement(view); + } + + public void paint(Graphics g, Shape allocation) + { + System.out.println("view.paint() !!!!"); + } + + public void setParent(View a) + { + parent = a; + } + + public View getParent() + { + return parent; + } + + public void setSize(int w, int h) + { + width = w; + height = h; + } + + public Document getDocument() + { + return getElement().getDocument(); + } + + public Element getElement() + { + return elt; + } + + public float getPreferredSpan(int a) + { + switch (a) + { + case X_AXIS: return width; + case Y_AXIS: return height; + default: + { + System.err.println("I sure wish Java had enums !!! "); + return 0; + } + } + } +} + diff --git a/libjava/javax/swing/text/ViewFactory.java b/libjava/javax/swing/text/ViewFactory.java new file mode 100644 index 00000000000..92be8f462fb --- /dev/null +++ b/libjava/javax/swing/text/ViewFactory.java @@ -0,0 +1,44 @@ +/* ViewFactory.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +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; + + +public interface ViewFactory +{ + public View create(Element elem); +} |