Commit 6a716777 by Michael Koch Committed by Michael Koch

MemoryImageSource.java, [...]: New versions from classpath.

2003-07-14  Michael Koch  <konqueror@gmx.de>

	* java/awt/image/MemoryImageSource.java,
	java/beans/PropertyEditorManager.java,
	javax/naming/CompoundName.java,
	javax/naming/spi/NamingManager.java,
	javax/swing/AbstractButton.java,
	javax/swing/ButtonModel.java,
	javax/swing/SwingUtilities.java,
	javax/swing/UIManager.java,
	javax/swing/colorchooser/DefaultColorSelectionModel.java,
	javax/swing/event/AncestorEvent.java,
	javax/swing/event/InternalFrameEvent.java,
	java/util/zip/ZipFile.java:
	New versions from classpath.

From-SVN: r69321
parent 6e985040
2003-07-14 Michael Koch <konqueror@gmx.de>
* java/awt/image/MemoryImageSource.java,
java/beans/PropertyEditorManager.java,
javax/naming/CompoundName.java,
javax/naming/spi/NamingManager.java,
javax/swing/AbstractButton.java,
javax/swing/ButtonModel.java,
javax/swing/SwingUtilities.java,
javax/swing/UIManager.java,
javax/swing/colorchooser/DefaultColorSelectionModel.java,
javax/swing/event/AncestorEvent.java,
javax/swing/event/InternalFrameEvent.java,
java/util/zip/ZipFile.java:
New versions from classpath.
2003-07-13 Michael Koch <konqueror@gmx.de> 2003-07-13 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/FileChannelImpl.java, * gnu/java/nio/FileChannelImpl.java,
......
...@@ -74,7 +74,7 @@ public class MemoryImageSource implements ImageProducer ...@@ -74,7 +74,7 @@ public class MemoryImageSource implements ImageProducer
this.props = props; this.props = props;
int max = (( scansize > width ) ? scansize : width ); int max = (( scansize > width ) ? scansize : width );
pixelb = new byte[ max * height ]; pixelb = new byte[ max * height ];
System.arraycopy( pix, 0, pixelb, 0, max ); System.arraycopy( pix, 0, pixelb, 0, max * height );
} }
/** /**
Constructs an ImageProducer from memory Constructs an ImageProducer from memory
...@@ -100,7 +100,7 @@ public class MemoryImageSource implements ImageProducer ...@@ -100,7 +100,7 @@ public class MemoryImageSource implements ImageProducer
this.props = props; this.props = props;
int max = (( scansize > width ) ? scansize : width ); int max = (( scansize > width ) ? scansize : width );
pixeli = new int[ max * height ]; pixeli = new int[ max * height ];
System.arraycopy( pix, 0, pixeli, 0, max ); System.arraycopy( pix, 0, pixeli, 0, max * height );
} }
/** /**
Constructs an ImageProducer from memory using the default RGB ColorModel Constructs an ImageProducer from memory using the default RGB ColorModel
...@@ -226,6 +226,7 @@ public class MemoryImageSource implements ImageProducer ...@@ -226,6 +226,7 @@ public class MemoryImageSource implements ImageProducer
if( props != null ) { if( props != null ) {
ic.setProperties( props ); ic.setProperties( props );
} }
ic.setDimensions(width, height);
if( pixeli != null ) { if( pixeli != null ) {
ic.setPixels( 0, 0, width, height, cm, pixeli, offset, scansize ); ic.setPixels( 0, 0, width, height, cm, pixeli, offset, scansize );
} else { } else {
......
...@@ -140,9 +140,13 @@ public class PropertyEditorManager ...@@ -140,9 +140,13 @@ public class PropertyEditorManager
return (PropertyEditor)found.newInstance(); return (PropertyEditor)found.newInstance();
} }
ClassLoader contextClassLoader
= Thread.currentThread().getContextClassLoader();
try try
{ {
found = Class.forName(editedClass.getName()+"Editor"); found = Class.forName(editedClass.getName()+"Editor", true,
contextClassLoader);
registerEditor(editedClass,found); registerEditor(editedClass,found);
return (PropertyEditor)found.newInstance(); return (PropertyEditor)found.newInstance();
} }
...@@ -150,14 +154,18 @@ public class PropertyEditorManager ...@@ -150,14 +154,18 @@ public class PropertyEditorManager
{ {
} }
String appendName = "." + ClassHelper.getTruncatedClassName(editedClass) + "Editor"; String appendName
= "."
+ ClassHelper.getTruncatedClassName(editedClass)
+ "Editor";
synchronized(editorSearchPath) synchronized(editorSearchPath)
{ {
for(int i=0;i<editorSearchPath.length;i++) for(int i=0;i<editorSearchPath.length;i++)
{ {
try try
{ {
found = Class.forName(editorSearchPath[i] + appendName); found = Class.forName(editorSearchPath[i] + appendName,
true, contextClassLoader);
registerEditor(editedClass,found); registerEditor(editedClass,found);
return (PropertyEditor)found.newInstance(); return (PropertyEditor)found.newInstance();
} }
......
...@@ -308,7 +308,7 @@ public class ZipFile implements ZipConstants ...@@ -308,7 +308,7 @@ public class ZipFile implements ZipConstants
*/ */
protected void finalize() throws IOException protected void finalize() throws IOException
{ {
if (!closed) close(); if (!closed && raf != null) close();
} }
/** /**
......
...@@ -142,13 +142,17 @@ public class CompoundName implements Name, Cloneable, Serializable ...@@ -142,13 +142,17 @@ public class CompoundName implements Name, Cloneable, Serializable
// Otherwise, fall through. // Otherwise, fall through.
} }
// Quotes are only special at the start of a component. // Quotes are only special at the start of a component.
else if (new_element.length () == 0 && special == beginQuote) else if (new_element.length () == 0
&& special == beginQuote
&& beginQuote != null)
{ {
quote = endQuote; quote = endQuote;
i += special.length (); i += special.length ();
continue; continue;
} }
else if (new_element.length () == 0 && special == beginQuote2) else if (new_element.length () == 0
&& special == beginQuote2
&& beginQuote2 != null)
{ {
quote = endQuote2; quote = endQuote2;
i += special.length (); i += special.length ();
......
...@@ -83,13 +83,17 @@ public class NamingManager ...@@ -83,13 +83,17 @@ public class NamingManager
try try
{ {
icf = (InitialContextFactory) Class.forName (java_naming_factory_initial).newInstance (); icf = (InitialContextFactory)Class.forName
(java_naming_factory_initial, true,
Thread.currentThread().getContextClassLoader())
.newInstance ();
} }
catch (Exception exception) catch (Exception exception)
{ {
NoInitialContextException e NoInitialContextException e
= new NoInitialContextException ("Can't load InitialContextFactory class: " = new NoInitialContextException
+ java_naming_factory_initial); ("Can't load InitialContextFactory class: "
+ java_naming_factory_initial);
e.setRootCause(exception); e.setRootCause(exception);
throw e; throw e;
} }
......
...@@ -76,12 +76,4 @@ public interface ButtonModel extends ItemSelectable ...@@ -76,12 +76,4 @@ public interface ButtonModel extends ItemSelectable
void setSelected(boolean b); void setSelected(boolean b);
boolean isSelected(); boolean isSelected();
// there are not in the spec !!
void fireItemStateChanged(ItemEvent event);
void fireStateChanged(ChangeEvent event);
void fireActionPerformed(ActionEvent event);
} }
...@@ -58,70 +58,71 @@ import javax.accessibility.AccessibleStateSet; ...@@ -58,70 +58,71 @@ import javax.accessibility.AccessibleStateSet;
public class SwingUtilities implements SwingConstants public class SwingUtilities implements SwingConstants
{ {
public static FontMetrics getFontMetrics (Font font) public static FontMetrics getFontMetrics (Font font)
{ {
return Toolkit.getDefaultToolkit().getFontMetrics(font); return Toolkit.getDefaultToolkit ().getFontMetrics (font);
} }
public static JRootPane getRootPane (Component a) public static JRootPane getRootPane (Component a)
{ {
if (a instanceof JRootPane) if (a instanceof JRootPane)
return (JRootPane) a; return (JRootPane) a;
a = a.getParent(); a = a.getParent();
if (a != null)
{
return getRootPane(a);
}
return null; if (a != null)
} {
return getRootPane(a);
}
return null;
}
public static void updateComponentTreeUI(JFrame comp) public static void updateComponentTreeUI(JFrame comp)
{ {
} }
public static String layoutCompoundLabel(JComponent c, public static String layoutCompoundLabel(JComponent c,
FontMetrics fm, FontMetrics fm,
String text, String text,
Icon i, Icon i,
int vert_a, int vert_a,
int hor_i, int hor_i,
int vert_text_pos, int vert_text_pos,
int hor_text_pos, int hor_text_pos,
Rectangle vr, Rectangle vr,
Rectangle ir, Rectangle ir,
Rectangle tr, Rectangle tr,
int gap) int gap)
{ {
// view rect 'vr' already ok, // view rect 'vr' already ok,
// we need to compute ir (icon rect) and tr (text-rect) // we need to compute ir (icon rect) and tr (text-rect)
int next_x = 0;//vr.x; int next_x = 0;//vr.x;
int next_y = 0;//vr.y; int next_y = 0;//vr.y;
ir.height = ir.width = ir.y = ir.x = 0; ir.height = ir.width = ir.y = ir.x = 0;
if (i != null) if (i != null)
{ {
ir.x = vr.x; ir.x = vr.x;
ir.y = vr.y; ir.y = vr.y;
ir.width = i.getIconWidth(); ir.width = i.getIconWidth();
ir.height = i.getIconWidth(); ir.height = i.getIconWidth();
next_x += gap + i.getIconWidth(); next_x += gap + i.getIconWidth();
next_y += gap + i.getIconHeight(); next_y += gap + i.getIconHeight();
} }
tr.x = next_x; tr.x = next_x;
tr.y = vr.y + (vr.height/2); tr.y = vr.y + (vr.height/2);
tr.width = fm.stringWidth(text);
tr.height = fm.getHeight() + fm.getAscent()/2;
tr.width = fm.stringWidth(text); return text;
tr.height = fm.getHeight() + fm.getAscent()/2; }
return text;
}
} }
......
...@@ -52,90 +52,90 @@ import javax.swing.event.EventListenerList; ...@@ -52,90 +52,90 @@ import javax.swing.event.EventListenerList;
public class DefaultColorSelectionModel public class DefaultColorSelectionModel
implements ColorSelectionModel, Serializable implements ColorSelectionModel, Serializable
{ {
static final long serialVersionUID = 580150227676302096L; private static final long serialVersionUID = -8117143602864778804L;
//------------------------------------------------------------- private Color selectedColor;
// Variables --------------------------------------------------
//------------------------------------------------------------- protected transient ChangeEvent changeEvent = new ChangeEvent (this);
protected EventListenerList listenerList = new EventListenerList ();
/**
* changeEvent /**
*/ * Creates a new color selection model.
protected transient ChangeEvent changeEvent; */
public DefaultColorSelectionModel()
/** {
* listenerList this (Color.white);
*/ }
protected EventListenerList listenerList;
/**
/** * Creates a new color selection model with a given selected color.
* selectedColor *
*/ * @param color The selected color.
private Color selectedColor; */
public DefaultColorSelectionModel (Color color)
{
//------------------------------------------------------------- super();
// Initialization --------------------------------------------- this.selectedColor = color;
//------------------------------------------------------------- }
/** /**
* Constructor DefaultColorSelectionModel * Returns the selected color.
*/ *
public DefaultColorSelectionModel() { * @return The selected color.
// TODO */
} // DefaultColorSelectionModel() public Color getSelectedColor()
{
/** return selectedColor;
* Constructor DefaultColorSelectionModel }
* @param color TODO
*/ /**
public DefaultColorSelectionModel(Color color) { * @param color The color to set.
// TODO */
} // DefaultColorSelectionModel() public void setSelectedColor (Color color)
{
this.selectedColor = color;
//------------------------------------------------------------- }
// Methods ----------------------------------------------------
//------------------------------------------------------------- /**
* Adds a listener to this model.
/** *
* getSelectedColor * @param listener The listener to add.
* @returns Color */
*/ public void addChangeListener (ChangeListener listener)
public Color getSelectedColor() { {
return null; // TODO listenerList.add (ChangeListener.class, listener);
} // getSelectedColor() }
/** /**
* setSelectedColor * Removes a listener from this model.
* @param color TODO *
*/ * @param listener The listener to remove.
public void setSelectedColor(Color color) { */
// TODO public void removeChangeListener (ChangeListener listener)
} // setSelectedColor() {
listenerList.remove (ChangeListener.class, listener);
/** }
* addChangeListener
* @param listener TODO /**
*/ * Returns all currently added <code>ChangeListener</code> objects.
public void addChangeListener(ChangeListener listener) { *
// TODO * @return Array of <code>ChangeListener</code> objects.
} // addChangeListener() */
public ChangeListener[] getChangeListeners()
/** {
* removeChangeListener return (ChangeListener[]) listenerList.getListeners (ChangeListener.class);
* @param listener TODO }
*/
public void removeChangeListener(ChangeListener listener) { /**
// TODO * Calls all the <code>stateChanged()</code> method of all added
} // removeChangeListener() * <code>ChangeListener</code> objects with <code>changeEvent</code>
* as argument.
/** */
* fireStateChanged protected void fireStateChanged()
*/ {
protected void fireStateChanged() { ChangeListener[] listeners = getChangeListeners();
// TODO
} // fireStateChanged() for (int i = 0; i < listeners.length; i++)
listeners [i].stateChanged (changeEvent);
}
} // DefaultColorSelectionModel }
...@@ -50,9 +50,9 @@ public class AncestorEvent extends AWTEvent ...@@ -50,9 +50,9 @@ public class AncestorEvent extends AWTEvent
{ {
private static final long serialVersionUID = -8079801679695605002L; private static final long serialVersionUID = -8079801679695605002L;
public static final int ANCESTOR_ADDED = 0; public static final int ANCESTOR_ADDED = 1;
public static final int ANCESTOR_MOVED = 1;
public static final int ANCESTOR_REMOVED = 2; public static final int ANCESTOR_REMOVED = 2;
public static final int ANCESTOR_MOVED = 3;
private JComponent sourceComponent; private JComponent sourceComponent;
private Container ancestor; private Container ancestor;
......
...@@ -81,7 +81,7 @@ public class InternalFrameEvent extends AWTEvent ...@@ -81,7 +81,7 @@ public class InternalFrameEvent extends AWTEvent
/** /**
* Internal frame iconified event * Internal frame iconified event
*/ */
public static final int INTERNAL_FRAME_ICONIFIED = 2552; public static final int INTERNAL_FRAME_ICONIFIED = 25552;
/** /**
* Internal frame last event * Internal frame last event
...@@ -91,7 +91,7 @@ public class InternalFrameEvent extends AWTEvent ...@@ -91,7 +91,7 @@ public class InternalFrameEvent extends AWTEvent
/** /**
* Internal frame opened event * Internal frame opened event
*/ */
public static final int INTERNAL_FRAME_OPENED = 25550; public static final int INTERNAL_FRAME_OPENED = 25549;
/** /**
* Creates a <code>JInternalFrameEvent</code> object. * Creates a <code>JInternalFrameEvent</code> object.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment