[cp-patches] Patch: CSS Parser

2005-12-20 Thread Lillian Angel
After looking into StyleSheets quite a bit, I found we needed a
CSSParser. This is not a public class, so it has been hard to implement
with almost no documentation. It is partially implemented so far. I am
still working on it.

2005-12-19  Lillian Angel  [EMAIL PROTECTED]

* javax/swing/text/html/BlockView.java
(getStyleSheet): Implemented.
* javax/swing/text/html/CSSParser.java: New private class,
partially implemented.
* javax/swing/text/html/HTMLEditorKit.java
(createDefaultDocument): Fixed to create HTMLDocument with
default style sheet.
(getStyleSheet): Fixed to initialize style sheet if null.
* javax/swing/text/html/StyleSheet.java
(CssParser): New private inner class, partially implemented.

Index: javax/swing/text/html/BlockView.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/html/BlockView.java,v
retrieving revision 1.2
diff -u -r1.2 BlockView.java
--- javax/swing/text/html/BlockView.java	15 Dec 2005 19:20:07 -	1.2
+++ javax/swing/text/html/BlockView.java	20 Dec 2005 15:53:32 -
@@ -294,7 +294,8 @@
*/
   protected StyleSheet getStyleSheet()
   {
-// FIXME: Not implemented properly.
-return new StyleSheet();
+StyleSheet styleSheet = new StyleSheet();
+styleSheet.importStyleSheet(getClass().getResource(HTMLEditorKit.DEFAULT_CSS));
+return styleSheet;
   }
 }
Index: javax/swing/text/html/CSSParser.java
===
RCS file: javax/swing/text/html/CSSParser.java
diff -N javax/swing/text/html/CSSParser.java
--- /dev/null	1 Jan 1970 00:00:00 -
+++ javax/swing/text/html/CSSParser.java	20 Dec 2005 15:53:32 -
@@ -0,0 +1,512 @@
+/* CSSParser.java --
+   Copyright (C) 2005 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., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 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.html;
+
+import java.io.*;
+
+/**
+ * Parses a CSS document. This works by way of a delegate that implements the
+ * CSSParserCallback interface. The delegate is notified of the following
+ * events: 
+ * - Import statement: handleImport 
+ * - Selectors handleSelector. This is invoked for each string. For example if 
+ * the Reader contained p, bar , a {}, the delegate would be notified 4 times, 
+ * for 'p,' 'bar' ',' and 'a'. 
+ * - When a rule starts, startRule 
+ * - Properties in the rule via the handleProperty. This
+ * is invoked one per property/value key, eg font size: foo;, would cause the
+ * delegate to be notified once with a value of 'font size'. 
+ * - Values in the rule via the handleValue, this is notified for the total value. 
+ * - When a rule ends, endRule
+ * 
+ * @author Lillian Angel ([EMAIL PROTECTED])
+ */
+class CSSParser
+{
+
+  /**
+   * Receives all information about the CSS document structure while parsing it.
+   * The methods are invoked by parser.
+   */
+  static interface CSSParserCallback
+  {
+/**
+ * Handles the import statment in the document.
+ * 
+ * @param imp - the import string
+ */
+public abstract void handleImport(String imp);
+
+/**
+ * Called when the start of a rule is encountered.
+ */
+public abstract void startRule();
+
+/**
+ * Called when the end of a rule is 

Re: [cp-patches] Patch: several fixes for DefaultStyledDocument

2005-12-20 Thread Anthony Balkissoon
On Mon, 2005-12-19 at 17:54 -0500, Anthony Balkissoon wrote:
 This is the first part of the work I'm doing on DefaultStyledDocument.
 This fixes a couple issues associated with PR 24744 but the bug is not
 completely fixed yet, so the testcase for that PR still crashes.  I will
 continue to work on this but these changes are ready to go in and may
 help get some text/html test apps up and running so I'm committing this
 now.

This patch caused some Mauve regressions because it's causing an
unexpected exception, I'm working on this and will also be checking in
the Mauve tests I wrote while creating this patch.

--Tony



___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Patch: CSS Parser

2005-12-20 Thread Lillian Angel
Implemented some more parts of the CSS parser. I added some more
comments in to help with implementation later. I have reached a point
where I can no longer properly implement the functions since I am
currently unable to throughly test. I will come back to this and finish
the implementation soon.

2005-12-19  Lillian Angel  [EMAIL PROTECTED]

* javax/swing/text/html/CSSParser.java
(CSSParser): Initialized tokenBuffer with some
arbitrary size. This makes append much more efficent since
a new array will not been created with each append.
(append): Fixed append to create a new larger array if
needed.
(nextToken): Finished implemented. Should decrease the
tokenBufferLength if an identifier was read. This way  and '
are not added to the buffer.
(parse): Implemented to call the appropriate parsing function
based on parameter.
(getNextStatement): Implemented.
(parseAtRule): Added some helpful comments for implementing.
(parseRuleSet): Likewise.
(parseIdentifiers): Likewise.
(readComment): Likewise.
* javax/swing/text/html/StyleSheet.java
(addRule): Implemented.
(loadRules): Implemented.
(importStyleSheet): Removed implementation for now. It causes
a loop. Added FIXME
(startRule): Implemented.
(handleProperty): Implemented.
(addSelector): Implemented.

Index: ChangeLog
===
RCS file: /cvsroot/classpath/classpath/ChangeLog,v
retrieving revision 1.5866
diff -u -r1.5866 ChangeLog
--- ChangeLog	20 Dec 2005 15:59:45 -	1.5866
+++ ChangeLog	20 Dec 2005 18:54:07 -
@@ -1,5 +1,32 @@
 2005-12-19  Lillian Angel  [EMAIL PROTECTED]
 
+	* javax/swing/text/html/CSSParser.java
+	(CSSParser): Initialized tokenBuffer with some
+	arbitrary size. This makes append much more efficent since
+	a new array will not been created with each append.
+	(append): Fixed append to create a new larger array if
+	needed.
+	(nextToken): Finished implemented. Should decrease the
+	tokenBufferLength if an identifier was read. This way  and '
+	are not added to the buffer.
+	(parse): Implemented to call the appropriate parsing function
+	based on parameter.
+	(getNextStatement): Implemented.
+	(parseAtRule): Added some helpful comments for implementing.
+	(parseRuleSet): Likewise.
+	(parseIdentifiers): Likewise.
+	(readComment): Likewise.
+	* javax/swing/text/html/StyleSheet.java
+	(addRule): Implemented.
+	(loadRules): Implemented.
+	(importStyleSheet): Removed implementation for now. It causes
+	a loop. Added FIXME
+	(startRule): Implemented.
+	(handleProperty): Implemented.
+	(addSelector): Implemented.
+
+2005-12-19  Lillian Angel  [EMAIL PROTECTED]
+
 	* javax/swing/text/html/BlockView.java
 	(getStyleSheet): Implemented.
 	* javax/swing/text/html/CSSParser.java: New private class,
Index: javax/swing/text/html/CSSParser.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/html/CSSParser.java,v
retrieving revision 1.1
diff -u -r1.1 CSSParser.java
--- javax/swing/text/html/CSSParser.java	20 Dec 2005 15:59:45 -	1.1
+++ javax/swing/text/html/CSSParser.java	20 Dec 2005 18:54:09 -
@@ -149,7 +149,8 @@
   /**
* The character mapping in the document.
*/
-  private static final char[] charMapping = null; // FIXME
+  // FIXME: What is this used for?
+  private static final char[] charMapping = null;
 
   /**
* Set to true if one character has been read ahead.
@@ -162,7 +163,7 @@
   private int pushedChar;
 
   /**
-   *  Temporary place to hold identifiers.
+   * Temporary place to hold identifiers.
*/
   private StringBuffer unitBuffer;
 
@@ -212,6 +213,7 @@
   CSSParser()
   {
 unitBuffer = new StringBuffer();
+tokenBuffer = new char[10];
   }
 
   /**
@@ -221,12 +223,18 @@
*/
   private void append(char c)
   {
-char[] temp = new char[tokenBufferLength + 1];
-if (tokenBuffer != null)
-  System.arraycopy(tokenBuffer, 0, temp, 0, tokenBufferLength);
-temp[tokenBufferLength] = c;
+if (tokenBuffer.length = tokenBufferLength)
+  {
+char[] temp = new char[tokenBufferLength * 2];
+if (tokenBuffer != null)
+  System.arraycopy(tokenBuffer, 0, temp, 0, tokenBufferLength);
+
+temp[tokenBufferLength] = c;
+tokenBuffer = temp;
+  }
+else
+  tokenBuffer[tokenBufferLength] = c;
 tokenBufferLength++;
-tokenBuffer = temp;
   }
 
   /**
@@ -244,10 +252,12 @@
 switch (next)
   {
   case '\':
-// FIXME: Not Implemented
+if (tokenBufferLength  0)
+  tokenBufferLength--;
 return IDENTIFIER;
   case '\'':
-// FIXME: Not Implemented
+if (tokenBufferLength  0)
+  tokenBufferLength--;
 return IDENTIFIER;
   case '(':
 return PAREN_OPEN;
@@ 

Re: [cp-patches] Patch: several fixes for DefaultStyledDocument

2005-12-20 Thread Anthony Balkissoon
On Tue, 2005-12-20 at 11:01 -0500, Anthony Balkissoon wrote:
 On Mon, 2005-12-19 at 17:54 -0500, Anthony Balkissoon wrote:
  This is the first part of the work I'm doing on DefaultStyledDocument.
  This fixes a couple issues associated with PR 24744 but the bug is not
  completely fixed yet, so the testcase for that PR still crashes.  I will
  continue to work on this but these changes are ready to go in and may
  help get some text/html test apps up and running so I'm committing this
  now.
 
 This patch caused some Mauve regressions because it's causing an
 unexpected exception, I'm working on this and will also be checking in
 the Mauve tests I wrote while creating this patch.
 
 --Tony

Okay, I've fixed the regressions and made progress with the attached
patch.  Yesterday I put code in ElementBuffer.insertContentTag to join
Elements if they had the same attribute sets.  This was incorrect and
led to the Mauve regressions.  The problem was that the wrong
information was being passed to insertContentTag.
DefaultStyledDocument.insertUpdate basically makes a list of
ElementSpecs that it wants the ElementBuffer to turn into Elements.
There was a problem in this method that was causing the wrong
ElementSpecs to be sent to the ElementBuffer (and eventually to
insertContentTag).  This is fixed, but the solution is somewhat of a
hack.  

The reason for the hack is as follows.  To create a LeafElement (a
structural object) we call AbstractDocument.createLeafElement which
takes as one of its parameters an AttributeSet that you want the
LeafElement to have.  However, in the process of creating the
LeafElement we actually add an attribute to the set that describes the
LeafElement's start and end offset positions.  So for instance, the
following code would print false (the parent, start_offset, end_offset
arguments are not important to this discussion):

SimpleAttributeSet set = new SimpleAttributeSet();
set.addAttribute(A, B);
Element e = createLeafElement(parent, set, start_offset, end_offset);
System.out.println (e.isEqual(set));

And this is the basis of our problem .. before we were comparing the
AttributeSet that we were going to use to create an Element with the
attribute set from an Element that already existed and so we'd always
get that they were not equal.  So the hack basically calls
createLeafElement to create an Element from which we get an
AttributeSet, and we use _that_ set in our comparisons.  The element
returned from createLeafElement is then thrown away, we don't actually
add it to the Document structure.

Since I consider this a bit of a hack, comments are appreciated (Roman?)
in case another solution is preferred.

2005-12-20  Anthony Balkissoon  [EMAIL PROTECTED]

* javax/swing/text/DefaultStyledDocument.java:
(ElementBuffer.insertContentTag): If the direction is 
OriginateDirection split all the time, don't check the attribute sets.
Removed the special case for the first insertion.  These cases should
fall under the direction JoinPreviousDirection. Changed the comments to
reflect this.
(insertUpdate): Added a hack to get the right result when comparing
the attributes of the new ElementSpec to the attributes of either
the previous or next Element.

--Tony
Index: javax/swing/text/DefaultStyledDocument.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultStyledDocument.java,v
retrieving revision 1.21
diff -u -r1.21 DefaultStyledDocument.java
--- javax/swing/text/DefaultStyledDocument.java	19 Dec 2005 22:52:32 -	1.21
+++ javax/swing/text/DefaultStyledDocument.java	20 Dec 2005 18:24:13 -
@@ -866,89 +866,36 @@
   removed = new Element[0];
   index++;
 }
-  else if (current.getStartOffset() == offset
-current.getEndOffset() - 1 == endOffset)
-{
-  // This is if the new insertion covers the entire range of 
-  // codecurrent/code.  This will generally happen for the 
-  // first insertion into a new paragraph.
-  added = new Element[1];
-  added[0] = createLeafElement(paragraph, tagAtts,
-   offset, endOffset + 1);  
-}
   else if (current.getStartOffset() == offset)
-{
+{ 
   // This is if the new insertion happens immediately before 
-  // the codecurrent/code Element.  In this case, if there is
-  // a split, there are 2 resulting Elements.
-  
-  AttributeSet splitAtts = splitRes[1].getAttributes();  
-  if (attributeSetsAreSame(tagAtts, splitAtts))
-{
-  // If the attributes of the adjacent Elements are the same
-  // then we don't split them, we join them into 

Re: [cp-patches] FYI: BasicMenuItemUI fix

2005-12-20 Thread Lillian Angel
Can you send the patch for this?

On Mon, 2005-12-19 at 16:05 +0100, Roman Kennke wrote:
 My previous optimization for JComponent painting exposed a bug in
 BasicMenuItemUI which causes MenuItems to be rendered badly. This is
 fixed by this patch.
 
 
 2005-12-19  Roman Kennke  [EMAIL PROTECTED]
 
 * javax/swing/plaf/basic/BasicMenuItemUI.java
 (paintBackground): Also fill background for unselected items here.
 (paintMenuItem): Call paintBackground() with the background
 parameter.
 
 
 /Roman
 
 
 ___
 Classpath-patches mailing list
 Classpath-patches@gnu.org
 http://lists.gnu.org/mailman/listinfo/classpath-patches



___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Patch for AbstractDocument fixes PR 25506

2005-12-20 Thread Anthony Balkissoon
Small fixlet fixes a long standing and annoying problem with text
components.

2005-12-20  Anthony Balkissoon  [EMAIL PROTECTED]

Fixes bug #25506
* javax/swing/text/AbstractDocument.java:
(insertString): Fire insert update whether the DocumentEvent was
changed or not.

--Tony
Index: javax/swing/text/AbstractDocument.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/AbstractDocument.java,v
retrieving revision 1.41
diff -u -r1.41 AbstractDocument.java
--- javax/swing/text/AbstractDocument.java	15 Dec 2005 21:17:46 -	1.41
+++ javax/swing/text/AbstractDocument.java	20 Dec 2005 21:25:57 -
@@ -544,8 +544,7 @@
 insertUpdate(event, attributes);
 writeUnlock();
 
-if (event.modified)
-  fireInsertUpdate(event);
+fireInsertUpdate(event);
 if (undo != null)
   fireUndoableEditUpdate(new UndoableEditEvent(this, undo));
   }
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Patch: JTree null root fix

2005-12-20 Thread Lillian Angel
For some reason, an exception was being thrown for a null root. It is
legal to set the root of a tree to null. This is now fixed. I took out
some revalidate calls that were not needed.

2005-12-20  Lillian Angel  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicTreeUI.java
(pathWasExpanded): Removed unneeded revalidate call.
(pathWasCollapsed): Likewise.
(installUI): Fixed to check for null root.
(paint): Fixed to always update path.
(toggleExpandState): Removed call to update path.
(editingStopped): Likewise.
(editingCanceled): Likewise.
(treeStructureChanged): Likewise.
(treeExpanded): Likewise.
(treeCollapsed): Likewise.
(treeNodesChanged): Likewise.
(treeNodesInserted): Likewise.
(treeNodesRemoved): Likewise.
(updateCurrentVisiblePath): Added check for null root. If root 
is null, nothing should be painted or in the path.
* javax/swing/tree/DefaultTreeModel.java
(setRoot): Root can be null.

Index: javax/swing/plaf/basic/BasicTreeUI.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTreeUI.java,v
retrieving revision 1.115
diff -u -r1.115 BasicTreeUI.java
--- javax/swing/plaf/basic/BasicTreeUI.java	16 Nov 2005 16:55:20 -	1.115
+++ javax/swing/plaf/basic/BasicTreeUI.java	20 Dec 2005 21:29:00 -
@@ -1201,7 +1201,6 @@
   protected void pathWasExpanded(TreePath path)
   {
 validCachedPreferredSize = false;
-tree.revalidate();
 tree.repaint();
   }
 
@@ -1211,7 +1210,6 @@
   protected void pathWasCollapsed(TreePath path)
   {
 validCachedPreferredSize = false;
-tree.revalidate();
 tree.repaint();
   }
 
@@ -1354,9 +1352,13 @@
 setModel(mod);
 if (mod != null)
   {
-TreePath path = new TreePath(mod.getRoot());
-if (!tree.isExpanded(path))
-  toggleExpandState(path);
+Object root = mod.getRoot();
+if (root != null)
+  {
+TreePath path = new TreePath(root);
+if (!tree.isExpanded(path))
+  toggleExpandState(path);
+  }
   }
 treeSelectionModel = tree.getSelectionModel();
 
@@ -1406,8 +1408,7 @@
   public void paint(Graphics g, JComponent c)
   {
 JTree tree = (JTree) c;
-if (currentVisiblePath == null)
-  updateCurrentVisiblePath();
+updateCurrentVisiblePath();
 
 Rectangle clip = g.getClipBounds();
 Insets insets = tree.getInsets();
@@ -1636,7 +1637,7 @@
 tree.add(editingComponent.getParent());
 editingComponent.getParent().validate();
 validCachedPreferredSize = false;
-tree.revalidate();
+
 ((JTextField) editingComponent).requestFocusInWindow(false);
 editorTimer.start();
 return true;
@@ -1725,7 +1726,6 @@
   tree.collapsePath(path);
 else
   tree.expandPath(path);
-updateCurrentVisiblePath();
   }
 
   /**
@@ -2082,7 +2082,6 @@
   tree.requestFocusInWindow(false);
   editorTimer.stop();
   validCachedPreferredSize = false;
-  tree.revalidate();
   tree.repaint();
 }
 
@@ -2113,7 +2112,6 @@
   editorTimer.stop();
   isEditing = false;
   validCachedPreferredSize = false;
-  tree.revalidate();
   tree.repaint();
 }
   }// CellEditorHandler
@@ -2544,8 +2542,6 @@
   if ((event.getPropertyName()).equals(rootVisible))
 {
   validCachedPreferredSize = false;
-  updateCurrentVisiblePath();
-  tree.revalidate();
   tree.repaint();
 }
 }
@@ -2642,8 +2638,6 @@
 public void treeExpanded(TreeExpansionEvent event)
 {
   validCachedPreferredSize = false;
-  updateCurrentVisiblePath();
-  tree.revalidate();
   tree.repaint();
 }
 
@@ -2656,8 +2650,6 @@
 public void treeCollapsed(TreeExpansionEvent event)
 {
   validCachedPreferredSize = false;
-  updateCurrentVisiblePath();
-  tree.revalidate();
   tree.repaint();
 }
   }// TreeExpansionHandler
@@ -2847,8 +2839,6 @@
 public void treeNodesChanged(TreeModelEvent e)
 {
   validCachedPreferredSize = false;
-  updateCurrentVisiblePath();
-  tree.revalidate();
   tree.repaint();
 }
 
@@ -2863,8 +2853,6 @@
 public void treeNodesInserted(TreeModelEvent e)
 {
   validCachedPreferredSize = false;
-  updateCurrentVisiblePath();
-  tree.revalidate();
   tree.repaint();
 }
 
@@ -2882,8 +2870,6 @@
 public void treeNodesRemoved(TreeModelEvent e)
 {
   validCachedPreferredSize = false;
-  updateCurrentVisiblePath();
-  tree.revalidate();
   tree.repaint();
 }
 
@@ -2902,9 +2888,7 @@
   if (e.getPath().length == 1
!e.getPath()[0].equals(treeModel.getRoot()))
 tree.expandPath(new TreePath(treeModel.getRoot()));
-  updateCurrentVisiblePath();
   

[cp-patches] Patch: Text components home and end actions

2005-12-20 Thread Lillian Angel
Tony and I implemented HOME and END actions for text components.
Unfortunately, we tried to implement a more efficient solution but
viewToModel was not returning the proper values. I added a TODO comment
in there, so it could get looked at later once we have viewToModel
fixed.

2005-12-20  Lillian Angel [EMAIL PROTECTED]

* javax/swing/text/DefaultEditorKit.java:
Added implementation for beginLineAction and
endLineAction.
* javax/swing/text/JTextComponent.java
(JTextComponent): Added key bindings for HOME and END.

Index: javax/swing/text/DefaultEditorKit.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultEditorKit.java,v
retrieving revision 1.25
diff -u -r1.25 DefaultEditorKit.java
--- javax/swing/text/DefaultEditorKit.java	21 Nov 2005 20:59:32 -	1.25
+++ javax/swing/text/DefaultEditorKit.java	20 Dec 2005 22:37:42 -
@@ -38,8 +38,10 @@
 
 package javax.swing.text;
 
+import java.awt.Point;
 import java.awt.Toolkit;
 import java.awt.event.ActionEvent;
+
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
@@ -698,6 +700,53 @@
 new InsertContentAction(),
 new InsertTabAction(),
 new PasteAction(),
+new TextAction(beginLineAction)
+{
+  public void actionPerformed(ActionEvent event)
+  {
+JTextComponent t = getTextComponent(event);
+try
+{
+  // TODO: There is a more efficent solution, but
+  // viewToModel doesn't work properly.
+  Point p = t.modelToView(t.getCaret().getDot()).getLocation();
+  int cur = t.getCaretPosition();
+  int y = p.y;
+  while (y == p.y  cur  0)
+y = t.modelToView(--cur).getLocation().y;
+  if (cur != 0)
+cur++;
+  t.setCaretPosition(cur);
+}
+catch (BadLocationException ble)
+{
+  // Do nothing here.
+}
+  }
+},
+new TextAction(endLineAction)
+{
+  public void actionPerformed(ActionEvent event)
+  {
+JTextComponent t = getTextComponent(event);
+   try
+   {
+ Point p = t.modelToView(t.getCaret().getDot()).getLocation();
+ int cur = t.getCaretPosition();
+ int y = p.y;
+ int length = t.getDocument().getLength();
+ while (y == p.y  cur  length)
+   y = t.modelToView(++cur).getLocation().y;
+ if (cur != length)
+   cur--;
+ t.setCaretPosition(cur);
+   }
+   catch (BadLocationException ble)
+   {
+ // Nothing to do here
+   }
+  }
+},
 new TextAction(deleteNextCharAction) 
 { 
   public void actionPerformed(ActionEvent event)
Index: javax/swing/text/JTextComponent.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/JTextComponent.java,v
retrieving revision 1.46
diff -u -r1.46 JTextComponent.java
--- javax/swing/text/JTextComponent.java	21 Nov 2005 20:59:32 -	1.46
+++ javax/swing/text/JTextComponent.java	20 Dec 2005 22:37:42 -
@@ -945,6 +945,10 @@
  new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 
KeyEvent.SHIFT_DOWN_MASK),
 DefaultEditorKit.selectionForwardAction),
+ new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_HOME, 0),
+   DefaultEditorKit.beginLineAction),
+ new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_END, 0),
+   DefaultEditorKit.endLineAction),
  new KeyBinding(KeyStroke.getKeyStroke(typed \u007f),
 DefaultEditorKit.deleteNextCharAction)
 },
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


javax.swing.JTextField

2005-12-20 Thread Christopher Lansdown
Hi,

JTextField doesn't seem to send any ActionEvent's when VK_ENTER is pressed,
and looking through the source it doesn't seem to try to catch this.

Is anyone working on this currently?

Thanks,
Chris Lansdown

-- 
Let us endeavor so to live that when we come to die even the undertaker 
will be sorry.  -- Mark Twain, Pudd'nhead Wilson's Calendar
== Evil Overlord Quote of the Day (www.eviloverlord.com) =
7. When I've captured my adversary and he says, Look, before you kill me,
will you at least tell me what this is all about? I'll say, No. and
shoot him. No, on second thought I'll shoot him then say No. 


___
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath


builder setup

2005-12-20 Thread Mark Wielaard
Hi all, Hi list,

builder.classpath.org seems to shape up nicely.

There were 3 reboot last night. I assume that was Jim doing a Xen
upgrade?

There were a couple of issues with email (the scripts now fake the
envelop sender with sendmail to look like emails come from
developer.classpath.org) that I have asked the gnu.org sysadmin to look
at (we had the same issue with developer.classpath.org in the past,
gnu.org thinks it handles all of classpath.org, but developer and
builder are special).

I tweaked the Ecj script that Anthony contributed a bit (also created a
toplevel Nightly/ecj dir that the script expects to be there) and
together with Tom debugged gcjx a little. The script now builds/runs 5
versions of ecj:
- build ecj bytecode with gcj -C
- build native ecj with gcj
- build ecj bytecode with gcjx
- build ecj with jamvm using gcj bytecode version
- build ecj bytecode with native-ecj
There should probably be a jacks run added to check that
ecj-built-by-ecj version is completely sane. The produced ecj hasn't
been wired into the other build/check scripts.

I currently have a screen session running with one screen doing:
source setup; while true; do Everything; Report Idle; sleep 3600; done
(The sleep is there to prevent builder going insane and spamming
classpath-testresults with failure messages.)
And another doing:
source setup; cd Nightly;
gij -cp /home/cpdev/ircbot/pircbot.jar:/home/cpdev/ircbot/cpbot.jar
gnu.classpath.ircbot.Main
(irc seems a bit flaky so sometimes our little bot needs to be restarted
by hand)

I haven't figured out how to easily share this screen setup. Screen
seems to not like being run from a sudo su cpdev session :{
Any hints or tips appreciated.

There is no real web frontend yet, but I did do:
ln -s /home/cpdev/Nightly/CurrentStatus /var/www/index.html 
so you can see what builder is doing by looking at
http://builder.classpath.org/

I am planning to create a new builder module in mauve to more easily
share the code next week with others as soon as we are reasonable happy
about the current script setup.

Cheers,

Mark

-- 
Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html

Join the community at http://planet.classpath.org/


signature.asc
Description: This is a digitally signed message part
___
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath


Re: javax.swing.JTextField

2005-12-20 Thread Roman Kennke
Hi Christopher,

Am Montag, den 19.12.2005, 22:40 -0500 schrieb Christopher Lansdown:
 Hi,
 
 JTextField doesn't seem to send any ActionEvent's when VK_ENTER is pressed,
 and looking through the source it doesn't seem to try to catch this.
 
 Is anyone working on this currently?

Which version of Classpath have you tried? I tested with current CVS
HEAD and there it seems to work. And I believe, nobody worked on that in
the last weeks, so it should at least be in 0.19 too. You can find the
associated sourcecode in javax/swing/JTextField.java starting at line 95
(the notifyAction stuff).

If you still have problems, I would like to see a testcase where it
fails.

Cheers, Roman



signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
___
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath


Re: javax.swing.JTextField

2005-12-20 Thread Christopher Lansdown
On 12/20, Roman Kennke wrote:
 Hi Christopher,
 
 Am Montag, den 19.12.2005, 22:40 -0500 schrieb Christopher Lansdown:
  Hi,
  
  JTextField doesn't seem to send any ActionEvent's when VK_ENTER is pressed,
  and looking through the source it doesn't seem to try to catch this.
  
  Is anyone working on this currently?
 
 Which version of Classpath have you tried?

CVS as of a day or two ago.

 I tested with current CVS HEAD and there it seems to work. And I believe,
 nobody worked on that in the last weeks, so it should at least be in 0.19
 too. You can find the associated sourcecode in javax/swing/JTextField.java
 starting at line 95 (the notifyAction stuff).

I apologize; I thought that the fileTextField of JFileChooser (in the Metal
plaf) had an action listener (as it should), but I looked more closely and
it doesn't. When I added it, the action event was indeed fired.

(In passing, I had read the code that you referred to; I simply didn't
know enough about the way keymaps were installed to recognize it as such.)

What's strange is that JFormattedTextField, which inherits from JTextField,
doesn't fire the action event... Oh, I see, it specifically overrides the
action map. Is it correct that JFormattedTextField's getActions() just
returns null, rather than invoking its super-class, or at least providing
the same action for the enter key?

 If you still have problems, I would like to see a testcase where it
 fails.

Many thanks,
Chris Lansdown

-- 
Let us endeavor so to live that when we come to die even the undertaker 
will be sorry.  -- Mark Twain, Pudd'nhead Wilson's Calendar
== Evil Overlord Quote of the Day (www.eviloverlord.com) =
97. My dungeon cells will not be furnished with objects that contain
reflective surfaces or anything that can be unravelled. 


___
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath


Re: builder setup

2005-12-20 Thread Jim Pick
Actually, the reboots were due to the fact the colo physically moved the
server between different sites.  They're moving everything from AboveNet
in San Jose to Market Post Tower in San Jose (home of MAE-West).  I had
an email about a week ago about the move, but I didn't know when they'd
actually do it until about an hour before they did it.  It seems to have
gone fairly smoothly though.  Some of the extra reboots were just
because I wanted to test to make sure the IPMI setup was working and I
could still access the BIOS.

Also, they're going to ask us to switch to new IP addresses in a month
or so.

I do want to upgrade to Xen 3.0 sometime in the future.  I don't think
I'll have time for that until after the holidays though.

Overall, I think things have been pretty stable.  :-)

Cheers,

 - Jim

Mark Wielaard wrote:
 Hi all, Hi list,
 
 builder.classpath.org seems to shape up nicely.
 
 There were 3 reboot last night. I assume that was Jim doing a Xen
 upgrade?
 
 There were a couple of issues with email (the scripts now fake the
 envelop sender with sendmail to look like emails come from
 developer.classpath.org) that I have asked the gnu.org sysadmin to look
 at (we had the same issue with developer.classpath.org in the past,
 gnu.org thinks it handles all of classpath.org, but developer and
 builder are special).
 
 I tweaked the Ecj script that Anthony contributed a bit (also created a
 toplevel Nightly/ecj dir that the script expects to be there) and
 together with Tom debugged gcjx a little. The script now builds/runs 5
 versions of ecj:
 - build ecj bytecode with gcj -C
 - build native ecj with gcj
 - build ecj bytecode with gcjx
 - build ecj with jamvm using gcj bytecode version
 - build ecj bytecode with native-ecj
 There should probably be a jacks run added to check that
 ecj-built-by-ecj version is completely sane. The produced ecj hasn't
 been wired into the other build/check scripts.
 
 I currently have a screen session running with one screen doing:
 source setup; while true; do Everything; Report Idle; sleep 3600; done
 (The sleep is there to prevent builder going insane and spamming
 classpath-testresults with failure messages.)
 And another doing:
 source setup; cd Nightly;
 gij -cp /home/cpdev/ircbot/pircbot.jar:/home/cpdev/ircbot/cpbot.jar
 gnu.classpath.ircbot.Main
 (irc seems a bit flaky so sometimes our little bot needs to be restarted
 by hand)
 
 I haven't figured out how to easily share this screen setup. Screen
 seems to not like being run from a sudo su cpdev session :{
 Any hints or tips appreciated.
 
 There is no real web frontend yet, but I did do:
 ln -s /home/cpdev/Nightly/CurrentStatus /var/www/index.html 
 so you can see what builder is doing by looking at
 http://builder.classpath.org/
 
 I am planning to create a new builder module in mauve to more easily
 share the code next week with others as soon as we are reasonable happy
 about the current script setup.
 
 Cheers,
 
 Mark
 



___
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath


Re: javax.swing.JTextField

2005-12-20 Thread Anthony Balkissoon
On Mon, 2005-12-19 at 22:40 -0500, Christopher Lansdown wrote:
 Hi,
 
 JTextField doesn't seem to send any ActionEvent's when VK_ENTER is pressed,
 and looking through the source it doesn't seem to try to catch this.
 

Hi Chris, I ran a little test program and it seems to work for me.  Are
you trying to activate the ActionEvent programmatically, or were you
actually typing the ENTER key into the text area?  Are you using the
newest Classpath?  

Here's a little test program to run, type in some text and hit enter.
Every time you hit enter hi is printed to the console.  Works for me.
If this little program doesn't work for anyone, or if you can write a
small program that shows what's wrong, please file a bug or email the
list again.

Test Program:
import java.awt.event.*;
import javax.swing.*;

public class Test
{ 
  public static void main(String[] args)
  {
JFrame jf = new JFrame();
final JTextField text = new JTextField(10);
text.addActionListener (new ActionListener()
  {
public void actionPerformed(ActionEvent e)
{
  System.out.println (hi);
}
  }
);
jf.add(text);
jf.pack();
jf.setVisible(true);
  }
} 

--Tony





___
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath


Re: builder setup

2005-12-20 Thread Tom Tromey
 Mark == Mark Wielaard [EMAIL PROTECTED] writes:

Mark And another doing:
Mark source setup; cd Nightly;
Mark gij -cp /home/cpdev/ircbot/pircbot.jar:/home/cpdev/ircbot/cpbot.jar
Mark gnu.classpath.ircbot.Main
Mark (irc seems a bit flaky so sometimes our little bot needs to be restarted
Mark by hand)

Could we change the bot to restart itself on failure?

Mark I haven't figured out how to easily share this screen setup. Screen
Mark seems to not like being run from a sudo su cpdev session :{
Mark Any hints or tips appreciated.

Instead of screen we could run it in the background, and provide a
couple scripts to start and stop it.  We could also add an '@reboot'
cron job to make sure it starts when the machine is rebooted.

Mark I am planning to create a new builder module in mauve to more easily
Mark share the code next week with others as soon as we are reasonable happy
Mark about the current script setup.

The scripts could use a serious scrubbing.  Let's do that after they
are in cvs though.

Tom


___
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath


Re: builder setup

2005-12-20 Thread Mark Wielaard
Hi Tom,

On Tue, 2005-12-20 at 09:17 -0700, Tom Tromey wrote:
  Mark == Mark Wielaard [EMAIL PROTECTED] writes:
 
 Mark And another doing:
 Mark source setup; cd Nightly;
 Mark gij -cp /home/cpdev/ircbot/pircbot.jar:/home/cpdev/ircbot/cpbot.jar
 Mark gnu.classpath.ircbot.Main
 Mark (irc seems a bit flaky so sometimes our little bot needs to be restarted
 Mark by hand)
 
 Could we change the bot to restart itself on failure?

Probably, but I haven't looked very closely at the source. What seems to
happen is that the irc server sometimes just traps the bot and doesn't
let it join a channel, I haven't found out why. Often it happens for a
couple times so I need to restart the bot till it clear up.

 Mark I haven't figured out how to easily share this screen setup. Screen
 Mark seems to not like being run from a sudo su cpdev session :{
 Mark Any hints or tips appreciated.
 
 Instead of screen we could run it in the background, and provide a
 couple scripts to start and stop it.  We could also add an '@reboot'
 cron job to make sure it starts when the machine is rebooted.

Yeah, that is probably better. I thought the screen idea was nicer since
you can in principle share it, but apparently that doesn't work well
when su-ing to a different user since screen gets confused about the
controlling terminal.

Cheers,

Mark


signature.asc
Description: This is a digitally signed message part
___
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath


Re: Collections.binarySearch and poorly written comparators

2005-12-20 Thread Tom Tromey
 Jim == Jim Murphy [EMAIL PROTECTED] writes:

Jim The bad comparator implementation assumes that o1 is a Foo and o2
Jim is a Bar.  This works when running on the Sum JRE
Jim implementation of Ccollections.binarySearch but fails with the
Jim CLASSPATH's implementation because the types are transposed.

Yeah.  We actually hit this in Eclipse once.  In that case we were
able to fix it upstream.

Jim If a goal of CLASSPATH is to be broadly useful does being bug for bug
Jim compatible matter to you guys?  Would you consider this a bug?

There's no question that there is a bug in the library you're using
:-)

I'm ambivalent about fixing this in Classpath.  There was a similar
case recently where in the end I think we decided not to make a
decision... I guess you could force the issue by writing a patch for
review.  Then somebody would actually have to take a stand.

Tom


___
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath


Hacking Classpath in Eclipse

2005-12-20 Thread Tom Tromey
Recently Raif wrote a nice white paper on how to hack on Classpath
using Eclipse.  Mark turned this into a wiki page, and then the three
of us spent some time editing it.

We think it is now ready for a wider audience.  You can read it here:

http://developer.classpath.org/mediation/ClasspathHackingWithEclipse

This document will walk you through setting up Eclipse, checking out
Classpath, Cacao, and Mauve, and then trying them out.  This is still
a work in progress, but we think the instructions here should
generally work ok.

Tom


___
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath


[commit-cp] classpath ./ChangeLog javax/swing/text/DefaultS...

2005-12-20 Thread Anthony Balkissoon
CVSROOT:/cvsroot/classpath
Module name:classpath
Branch: 
Changes by: Anthony Balkissoon [EMAIL PROTECTED]  05/12/20 18:35:22

Modified files:
.  : ChangeLog 
javax/swing/text: DefaultStyledDocument.java 

Log message:
2005-12-20  Anthony Balkissoon  [EMAIL PROTECTED]

* javax/swing/text/DefaultStyledDocument.java:
(ElementBuffer.insertContentTag): If the direction is
OriginateDirection split all the time, don't check the attribute sets.
Removed the special case for the first insertion.  These cases should
fall under the direction JoinPreviousDirection. Changed the comments to
reflect this.
(insertUpdate): Added a hack to get the right result when comparing
the attributes of the new ElementSpec to the attributes of either
the previous or next Element.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5866tr2=1.5867r1=textr2=text
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/javax/swing/text/DefaultStyledDocument.java.diff?tr1=1.21tr2=1.22r1=textr2=text




[commit-cp] classpath ./ChangeLog javax/swing/text/Abstract...

2005-12-20 Thread Anthony Balkissoon
CVSROOT:/cvsroot/classpath
Module name:classpath
Branch: 
Changes by: Anthony Balkissoon [EMAIL PROTECTED]  05/12/20 21:28:16

Modified files:
.  : ChangeLog 
javax/swing/text: AbstractDocument.java 

Log message:
2005-12-20  Anthony Balkissoon  [EMAIL PROTECTED]

Fixes bug #25506
* javax/swing/text/AbstractDocument.java:
(insertString): Fire insert update whether the DocumentEvent was
changed or not.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5868tr2=1.5869r1=textr2=text
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/javax/swing/text/AbstractDocument.java.diff?tr1=1.41tr2=1.42r1=textr2=text