[Ejtools-cvs] libraries/adwt/src/main/org/ejtools/adwt/editor ArrayEditor.java,1.6,1.7 ClassEditor.j
Brought to you by:
letiemble
From: <let...@us...> - 2003-12-14 10:50:02
|
Update of /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/editor In directory sc8-pr-cvs1:/tmp/cvs-serv19233/adwt/src/main/org/ejtools/adwt/editor Modified Files: ArrayEditor.java ClassEditor.java CollectionEditor.java DateTimeEditor.java GenericEditor.java IteratorEditor.java ListEditor.java NumberEditor.java ObjectNameEditor.java URLEditor.java Log Message: Add more javadocs. Add package.html files. Index: ArrayEditor.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/editor/ArrayEditor.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ArrayEditor.java 15 Sep 2003 22:37:13 -0000 1.6 --- ArrayEditor.java 13 Dec 2003 21:29:34 -0000 1.7 *************** *** 1,139 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.editor; ! ! import java.awt.Component; ! import java.awt.GridLayout; ! import java.beans.PropertyChangeEvent; ! import java.beans.PropertyChangeListener; ! import java.beans.PropertyEditor; ! ! import javax.swing.JLabel; ! import javax.swing.JPanel; ! ! import org.ejtools.beans.CustomPropertyEditorManager; ! ! import com.dreambean.awt.GenericPropertyCustomizer; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class ArrayEditor extends GenericEditor ! { ! /** Description of the Field */ ! protected Object[] array = new Object[0]; ! /** Description of the Field */ ! protected Class clazz = null; ! /** Description of the Field */ ! protected JPanel panel = null; ! ! ! /** ! * Constructor for ArrayEditor. ! * ! * @param clazz Description of the Parameter ! */ ! public ArrayEditor(Class clazz) ! { ! this.clazz = clazz; ! this.panel = new JPanel(); ! } ! ! ! /** ! * @return The customEditor value ! */ ! public Component getCustomEditor() ! { ! return this.panel; ! } ! ! ! /** ! * @param value The new value value ! */ ! public void setValue(Object value) ! { ! super.setValue(value); ! if (this.value == null) ! { ! return; ! } ! this.array = (Object[]) this.value; ! this.buildPanel(); ! } ! ! ! /** ! * @return Description of the Return Value ! */ ! public boolean supportsCustomEditor() ! { ! return true; ! } ! ! ! /** Description of the Method */ ! private void buildPanel() ! { ! this.panel.removeAll(); ! ! PropertyEditor editor = CustomPropertyEditorManager.findEditor(this.clazz); ! if (editor == null) ! { ! editor = CustomPropertyEditorManager.findEditor(String.class); ! } ! ! this.panel = new JPanel(new GridLayout(this.array.length, 1)); ! for (int i = 0; i < this.array.length; i++) ! { ! try ! { ! PropertyEditor peInstance = (PropertyEditor) editor.getClass().newInstance(); ! peInstance.setValue(array[i]); ! ! Object component; ! ! if (peInstance.supportsCustomEditor()) ! { ! component = peInstance.getCustomEditor(); ! } ! else ! { ! String as[] = peInstance.getTags(); ! if (as != null) ! { ! component = new GenericPropertyCustomizer(peInstance, as); ! } ! else ! { ! final JLabel label = new JLabel(peInstance.getAsText()); ! final PropertyEditor pcEditor = peInstance; ! component = label; ! pcEditor.addPropertyChangeListener( ! new PropertyChangeListener() ! { ! public void propertyChange(PropertyChangeEvent evt) ! { ! label.setText(pcEditor.getAsText()); ! } ! }); ! } ! } ! this.panel.add((Component) component); ! } ! catch (Exception exception) ! { ! exception.printStackTrace(); ! } ! } ! ! this.panel.validate(); ! this.panel.repaint(); ! } ! } --- 1,139 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.editor; ! ! import java.awt.Component; ! import java.awt.GridLayout; ! import java.beans.PropertyChangeEvent; ! import java.beans.PropertyChangeListener; ! import java.beans.PropertyEditor; ! ! import javax.swing.JLabel; ! import javax.swing.JPanel; ! ! import org.ejtools.beans.CustomPropertyEditorManager; ! ! import com.dreambean.awt.GenericPropertyCustomizer; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class ArrayEditor extends GenericEditor ! { ! /** Description of the Field */ ! protected Object[] array = new Object[0]; ! /** Description of the Field */ ! protected Class clazz = null; ! /** Description of the Field */ ! protected JPanel panel = null; ! ! ! /** ! * Constructor for ArrayEditor. ! * ! * @param clazz Description of the Parameter ! */ ! public ArrayEditor(Class clazz) ! { ! this.clazz = clazz; ! this.panel = new JPanel(); ! } ! ! ! /** ! * @return The customEditor value ! */ ! public Component getCustomEditor() ! { ! return this.panel; ! } ! ! ! /** ! * @param value The new value value ! */ ! public void setValue(Object value) ! { ! super.setValue(value); ! if (this.value == null) ! { ! return; ! } ! this.array = (Object[]) this.value; ! this.buildPanel(); ! } ! ! ! /** ! * @return Description of the Return Value ! */ ! public boolean supportsCustomEditor() ! { ! return true; ! } ! ! ! /** Description of the Method */ ! private void buildPanel() ! { ! this.panel.removeAll(); ! ! PropertyEditor editor = CustomPropertyEditorManager.findEditor(this.clazz); ! if (editor == null) ! { ! editor = CustomPropertyEditorManager.findEditor(String.class); ! } ! ! this.panel = new JPanel(new GridLayout(this.array.length, 1)); ! for (int i = 0; i < this.array.length; i++) ! { ! try ! { ! PropertyEditor peInstance = (PropertyEditor) editor.getClass().newInstance(); ! peInstance.setValue(array[i]); ! ! Object component; ! ! if (peInstance.supportsCustomEditor()) ! { ! component = peInstance.getCustomEditor(); ! } ! else ! { ! String as[] = peInstance.getTags(); ! if (as != null) ! { ! component = new GenericPropertyCustomizer(peInstance, as); ! } ! else ! { ! final JLabel label = new JLabel(peInstance.getAsText()); ! final PropertyEditor pcEditor = peInstance; ! component = label; ! pcEditor.addPropertyChangeListener( ! new PropertyChangeListener() ! { ! public void propertyChange(PropertyChangeEvent evt) ! { ! label.setText(pcEditor.getAsText()); ! } ! }); ! } ! } ! this.panel.add((Component) component); ! } ! catch (Exception exception) ! { ! exception.printStackTrace(); ! } ! } ! ! this.panel.validate(); ! this.panel.repaint(); ! } ! } Index: ClassEditor.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/editor/ClassEditor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ClassEditor.java 15 Sep 2003 22:37:13 -0000 1.4 --- ClassEditor.java 13 Dec 2003 21:29:34 -0000 1.5 *************** *** 1,62 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.editor; ! ! ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class ClassEditor extends GenericEditor ! { ! /** Constructor */ ! public ClassEditor() ! { ! this.value = Class.class; ! } ! ! ! /** ! * Getter for the asText attribute ! * ! * @return The value ! */ ! public String getAsText() ! { ! if (this.value != null) ! { ! return ((Class) this.value).getName(); ! } ! else ! { ! return null; ! } ! } ! ! ! /** ! * Setter for the asText attribute ! * ! * @param s The new value ! */ ! public void setAsText(String s) ! { ! try ! { ! this.value = Thread.currentThread().getContextClassLoader().loadClass(s); ! } ! catch (Exception e) ! { ! } ! this.firePropertyChange(); ! } ! } ! --- 1,62 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.editor; ! ! ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class ClassEditor extends GenericEditor ! { ! /** Constructor */ ! public ClassEditor() ! { ! this.value = Class.class; ! } ! ! ! /** ! * Getter for the asText attribute ! * ! * @return The value ! */ ! public String getAsText() ! { ! if (this.value != null) ! { ! return ((Class) this.value).getName(); ! } ! else ! { ! return null; ! } ! } ! ! ! /** ! * Setter for the asText attribute ! * ! * @param s The new value ! */ ! public void setAsText(String s) ! { ! try ! { ! this.value = Thread.currentThread().getContextClassLoader().loadClass(s); ! } ! catch (Exception e) ! { ! } ! this.firePropertyChange(); ! } ! } ! Index: CollectionEditor.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/editor/CollectionEditor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CollectionEditor.java 15 Sep 2003 22:37:13 -0000 1.4 --- CollectionEditor.java 13 Dec 2003 21:29:34 -0000 1.5 *************** *** 1,68 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.editor; ! ! import java.util.Collection; ! import java.util.Iterator; ! import java.util.StringTokenizer; ! import java.util.Vector; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! * @todo Swing editor to complete ! */ ! public class CollectionEditor extends GenericEditor ! { ! /** Constructor for the PropertiesEditor object */ ! public CollectionEditor() ! { ! this.value = new Vector(); ! } ! ! ! /** ! * Getter for the asText attribute ! * ! * @return The value of asText attribute ! */ ! public String getAsText() ! { ! String result = ""; ! Iterator iterator = ((Collection) this.value).iterator(); ! while (iterator.hasNext()) ! { ! result = result + iterator.next(); ! if (iterator.hasNext()) ! { ! result = result + ","; ! } ! } ! return result; ! } ! ! ! /** ! * Setter for the asText attribute ! * ! * @param s The new value for asText attribute ! */ ! public void setAsText(String s) ! { ! StringTokenizer st = new StringTokenizer(s, ","); ! this.value = new Vector(); ! while (st.hasMoreTokens()) ! { ! ((Collection) this.value).add(st.nextToken()); ! } ! this.firePropertyChange(); ! } ! ! } --- 1,68 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.editor; ! ! import java.util.Collection; ! import java.util.Iterator; ! import java.util.StringTokenizer; ! import java.util.Vector; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! * @todo Swing editor to complete ! */ ! public class CollectionEditor extends GenericEditor ! { ! /** Constructor for the PropertiesEditor object */ ! public CollectionEditor() ! { ! this.value = new Vector(); ! } ! ! ! /** ! * Getter for the asText attribute ! * ! * @return The value of asText attribute ! */ ! public String getAsText() ! { ! String result = ""; ! Iterator iterator = ((Collection) this.value).iterator(); ! while (iterator.hasNext()) ! { ! result = result + iterator.next(); ! if (iterator.hasNext()) ! { ! result = result + ","; ! } ! } ! return result; ! } ! ! ! /** ! * Setter for the asText attribute ! * ! * @param s The new value for asText attribute ! */ ! public void setAsText(String s) ! { ! StringTokenizer st = new StringTokenizer(s, ","); ! this.value = new Vector(); ! while (st.hasMoreTokens()) ! { ! ((Collection) this.value).add(st.nextToken()); ! } ! this.firePropertyChange(); ! } ! ! } Index: DateTimeEditor.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/editor/DateTimeEditor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DateTimeEditor.java 15 Sep 2003 22:37:13 -0000 1.4 --- DateTimeEditor.java 13 Dec 2003 21:29:34 -0000 1.5 *************** *** 1,84 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.editor; ! ! import java.text.DateFormat; ! import java.text.ParseException; ! import java.text.SimpleDateFormat; ! import java.util.Date; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class DateTimeEditor extends GenericEditor ! { ! /** Description of the Field */ ! protected DateFormat fmts[]; ! ! ! /** Constructor for the DateEditor object */ ! public DateTimeEditor() ! { ! fmts = new DateFormat[5]; ! fmts[0] = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); ! fmts[1] = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); ! fmts[2] = new SimpleDateFormat("yyyy-MM-dd HH:mm"); ! fmts[3] = new SimpleDateFormat("yyMMdd HH:mm:ss"); ! fmts[4] = new SimpleDateFormat("yyMMdd HH:mm"); ! } ! ! ! /** ! * Gets the asText attribute of the DateEditor object ! * ! * @return The asText value ! */ ! public String getAsText() ! { ! if (this.value != null) ! { ! return this.fmts[0].format((Date) this.value); ! } ! else ! { ! return ""; ! } ! } ! ! ! /** ! * Sets the asText attribute of the DateEditor object ! * ! * @param s The new asText value ! */ ! public void setAsText(String s) ! { ! if (s.equals("")) ! { ! this.value = null; ! return; ! } ! for (int i = 0; i < fmts.length; i++) ! { ! try ! { ! this.value = fmts[i].parse(s); ! this.firePropertyChange(); ! return; ! } ! catch (ParseException pe) ! { ! // Do nothing ! } ! } ! } ! } ! --- 1,84 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.editor; ! ! import java.text.DateFormat; ! import java.text.ParseException; ! import java.text.SimpleDateFormat; ! import java.util.Date; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class DateTimeEditor extends GenericEditor ! { ! /** Description of the Field */ ! protected DateFormat fmts[]; ! ! ! /** Constructor for the DateEditor object */ ! public DateTimeEditor() ! { ! fmts = new DateFormat[5]; ! fmts[0] = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); ! fmts[1] = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); ! fmts[2] = new SimpleDateFormat("yyyy-MM-dd HH:mm"); ! fmts[3] = new SimpleDateFormat("yyMMdd HH:mm:ss"); ! fmts[4] = new SimpleDateFormat("yyMMdd HH:mm"); ! } ! ! ! /** ! * Gets the asText attribute of the DateEditor object ! * ! * @return The asText value ! */ ! public String getAsText() ! { ! if (this.value != null) ! { ! return this.fmts[0].format((Date) this.value); ! } ! else ! { ! return ""; ! } ! } ! ! ! /** ! * Sets the asText attribute of the DateEditor object ! * ! * @param s The new asText value ! */ ! public void setAsText(String s) ! { ! if (s.equals("")) ! { ! this.value = null; ! return; ! } ! for (int i = 0; i < fmts.length; i++) ! { ! try ! { ! this.value = fmts[i].parse(s); ! this.firePropertyChange(); ! return; ! } ! catch (ParseException pe) ! { ! // Do nothing ! } ! } ! } ! } ! Index: GenericEditor.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/editor/GenericEditor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GenericEditor.java 15 Sep 2003 22:37:13 -0000 1.4 --- GenericEditor.java 13 Dec 2003 21:29:34 -0000 1.5 *************** *** 1,53 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.editor; ! ! import java.beans.PropertyEditorSupport; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public abstract class GenericEditor extends PropertyEditorSupport ! { ! /** Description of the Field */ ! protected Object value = null; ! ! ! /** Constructor for the PropertiesEditor object */ ! public GenericEditor() { } ! ! ! /** ! * Gets the value attribute of the FileEditor object ! * ! * @return The value value ! */ ! public Object getValue() ! { ! return this.value; ! } ! ! ! /** ! * Setter for the value attribute ! * ! * @param object The new value value ! */ ! public void setValue(Object object) ! { ! if (object == null) ! { ! return; ! } ! this.value = object; ! this.firePropertyChange(); ! } ! } --- 1,53 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.editor; ! ! import java.beans.PropertyEditorSupport; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public abstract class GenericEditor extends PropertyEditorSupport ! { ! /** Description of the Field */ ! protected Object value = null; ! ! ! /** Constructor for the PropertiesEditor object */ ! public GenericEditor() { } ! ! ! /** ! * Gets the value attribute of the FileEditor object ! * ! * @return The value value ! */ ! public Object getValue() ! { ! return this.value; ! } ! ! ! /** ! * Setter for the value attribute ! * ! * @param object The new value value ! */ ! public void setValue(Object object) ! { ! if (object == null) ! { ! return; ! } ! this.value = object; ! this.firePropertyChange(); ! } ! } Index: IteratorEditor.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/editor/IteratorEditor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IteratorEditor.java 15 Sep 2003 22:37:13 -0000 1.4 --- IteratorEditor.java 13 Dec 2003 21:29:34 -0000 1.5 *************** *** 1,67 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.editor; ! ! import java.util.Iterator; ! import java.util.StringTokenizer; ! import java.util.Vector; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! * @todo Swing editor to complete ! */ ! public class IteratorEditor extends GenericEditor ! { ! /** Constructor for the PropertiesEditor object */ ! public IteratorEditor() ! { ! this.value = (new Vector()).iterator(); ! } ! ! ! /** ! * Getter for the asText attribute ! * ! * @return The value of asText attribute ! */ ! public String getAsText() ! { ! String result = ""; ! Iterator iterator = (Iterator) this.value; ! while (iterator.hasNext()) ! { ! result = result + iterator.next(); ! if (iterator.hasNext()) ! { ! result = result + ","; ! } ! } ! return result; ! } ! ! ! /** ! * Setter for the asText attribute ! * ! * @param s The new value for asText attribute ! */ ! public void setAsText(String s) ! { ! StringTokenizer st = new StringTokenizer(s, ","); ! Vector parsed = new Vector(); ! while (st.hasMoreTokens()) ! { ! parsed.add(st.nextToken()); ! } ! this.value = parsed.iterator(); ! this.firePropertyChange(); ! } ! } --- 1,67 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.editor; ! ! import java.util.Iterator; ! import java.util.StringTokenizer; ! import java.util.Vector; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! * @todo Swing editor to complete ! */ ! public class IteratorEditor extends GenericEditor ! { ! /** Constructor for the PropertiesEditor object */ ! public IteratorEditor() ! { ! this.value = (new Vector()).iterator(); ! } ! ! ! /** ! * Getter for the asText attribute ! * ! * @return The value of asText attribute ! */ ! public String getAsText() ! { ! String result = ""; ! Iterator iterator = (Iterator) this.value; ! while (iterator.hasNext()) ! { ! result = result + iterator.next(); ! if (iterator.hasNext()) ! { ! result = result + ","; ! } ! } ! return result; ! } ! ! ! /** ! * Setter for the asText attribute ! * ! * @param s The new value for asText attribute ! */ ! public void setAsText(String s) ! { ! StringTokenizer st = new StringTokenizer(s, ","); ! Vector parsed = new Vector(); ! while (st.hasMoreTokens()) ! { ! parsed.add(st.nextToken()); ! } ! this.value = parsed.iterator(); ! this.firePropertyChange(); ! } ! } Index: ListEditor.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/editor/ListEditor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ListEditor.java 15 Sep 2003 22:37:13 -0000 1.4 --- ListEditor.java 13 Dec 2003 21:29:34 -0000 1.5 *************** *** 1,20 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.editor; ! ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! * @todo Swing editor to complete ! */ ! public class ListEditor extends GenericEditor ! { ! } --- 1,20 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.editor; ! ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! * @todo Swing editor to complete ! */ ! public class ListEditor extends GenericEditor ! { ! } Index: NumberEditor.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/editor/NumberEditor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NumberEditor.java 15 Sep 2003 22:37:13 -0000 1.4 --- NumberEditor.java 13 Dec 2003 21:29:34 -0000 1.5 *************** *** 1,87 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.editor; ! ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class NumberEditor extends GenericEditor ! { ! /** Description of the Field */ ! protected Class clazz = Number.class; ! ! ! /** Constructor */ ! public NumberEditor() ! { ! this.value = new Integer(0); ! } ! ! ! /** ! * Getter for the asText attribute ! * ! * @return The value ! */ ! public String getAsText() ! { ! return value.toString(); ! } ! ! ! /** ! * Setter for the asText attribute ! * ! * @param s The new value ! */ ! public void setAsText(String s) ! { ! if (this.clazz.equals(Integer.class)) ! { ! this.value = new Integer(s); ! } ! else if (this.clazz.equals(Float.class)) ! { ! this.value = new Float(s); ! } ! else if (this.clazz.equals(Double.class)) ! { ! this.value = new Double(s); ! } ! else if (this.clazz.equals(Byte.class)) ! { ! this.value = new Byte(s); ! } ! else if (this.clazz.equals(Short.class)) ! { ! this.value = new Short(s); ! } ! else if (this.clazz.equals(Long.class)) ! { ! this.value = new Long(s); ! } ! this.firePropertyChange(); ! } ! ! ! /** ! * Setter for the value attribute ! * ! * @param object The new value value ! */ ! public void setValue(Object object) ! { ! super.setValue(object); ! this.clazz = object.getClass(); ! } ! } ! --- 1,87 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.editor; ! ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class NumberEditor extends GenericEditor ! { ! /** Description of the Field */ ! protected Class clazz = Number.class; ! ! ! /** Constructor */ ! public NumberEditor() ! { ! this.value = new Integer(0); ! } ! ! ! /** ! * Getter for the asText attribute ! * ! * @return The value ! */ ! public String getAsText() ! { ! return value.toString(); ! } ! ! ! /** ! * Setter for the asText attribute ! * ! * @param s The new value ! */ ! public void setAsText(String s) ! { ! if (this.clazz.equals(Integer.class)) ! { ! this.value = new Integer(s); ! } ! else if (this.clazz.equals(Float.class)) ! { ! this.value = new Float(s); ! } ! else if (this.clazz.equals(Double.class)) ! { ! this.value = new Double(s); ! } ! else if (this.clazz.equals(Byte.class)) ! { ! this.value = new Byte(s); ! } ! else if (this.clazz.equals(Short.class)) ! { ! this.value = new Short(s); ! } ! else if (this.clazz.equals(Long.class)) ! { ! this.value = new Long(s); ! } ! this.firePropertyChange(); ! } ! ! ! /** ! * Setter for the value attribute ! * ! * @param object The new value value ! */ ! public void setValue(Object object) ! { ! super.setValue(object); ! this.clazz = object.getClass(); ! } ! } ! Index: ObjectNameEditor.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/editor/ObjectNameEditor.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ObjectNameEditor.java 15 Sep 2003 22:37:13 -0000 1.6 --- ObjectNameEditor.java 13 Dec 2003 21:29:34 -0000 1.7 *************** *** 1,175 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.editor; ! ! import java.awt.Component; ! import java.awt.Container; ! import java.awt.GridBagConstraints; ! import java.awt.GridBagLayout; ! import java.awt.event.ActionEvent; ! import java.awt.event.ActionListener; ! import java.awt.event.FocusAdapter; ! import java.awt.event.FocusEvent; ! import java.util.ResourceBundle; ! ! import javax.management.ObjectName; ! import javax.swing.JButton; ! import javax.swing.JPanel; ! import javax.swing.JTextField; ! import javax.swing.SwingUtilities; ! ! import org.ejtools.adwt.util.ObjectSearcher; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class ObjectNameEditor extends GenericEditor ! { ! /** Description of the Field */ ! protected JButton button; ! /** Description of the Field */ ! protected Container panel; ! /** Description of the Field */ ! protected JTextField text; ! /** Description of the Field */ ! private final static ResourceBundle resources = ResourceBundle.getBundle("org.ejtools.adwt.editor.Resources"); ! ! ! /** Constructor */ ! public ObjectNameEditor() ! { ! this.text = new JTextField(30); ! ! // Update value when edited ! this.text.addFocusListener( ! new FocusAdapter() ! { ! public void focusLost(FocusEvent e) ! { ! setAsText(text.getText()); ! } ! } ! ); ! } ! ! ! /** ! * Getter for the asText attribute ! * ! * @return The value ! */ ! public String getAsText() ! { ! if (this.value != null) ! { ! return ((ObjectName) this.value).getCanonicalName(); ! } ! return ""; ! } ! ! ! /** ! * Gets the customEditor attribute of the ObjectNameEditor object ! * ! * @return The customEditor value ! */ ! public Component getCustomEditor() ! { ! if (Boolean.getBoolean("ejtools.objectname.hyperlink")) ! { ! if (this.panel == null) ! { ! GridBagConstraints gridbagconstraints = new GridBagConstraints(); ! ! this.panel = new JPanel(); ! this.panel.setLayout(new GridBagLayout()); ! this.button = new JButton(resources.getString("ObjectNameEditor.button.view")); ! ! gridbagconstraints.gridwidth = GridBagConstraints.RELATIVE; ! this.panel.add(button, gridbagconstraints); ! ! gridbagconstraints.gridwidth = GridBagConstraints.REMAINDER; ! gridbagconstraints.weightx = 1.0; ! gridbagconstraints.fill = GridBagConstraints.HORIZONTAL; ! this.panel.add(text, gridbagconstraints); ! ! this.button.addActionListener( ! new ActionListener() ! { ! /** ! * @param e Event action ! */ ! public void actionPerformed(ActionEvent e) ! { ! ObjectSearcher finder = (ObjectSearcher) SwingUtilities.getAncestorOfClass(ObjectSearcher.class, ObjectNameEditor.this.panel); ! if ((finder != null) && (ObjectNameEditor.this.value != null)) ! { ! finder.find(ObjectNameEditor.this.getAsText()); ! } ! } ! } ! ); ! } ! return this.panel; ! } ! else ! { ! return this.text; ! } ! } ! ! ! /** ! * Setter for the asText attribute ! * ! * @param s The new value ! */ ! public void setAsText(String s) ! { ! try ! { ! this.value = new ObjectName(s); ! } ! catch (Exception e) ! { ! this.value = null; ! } ! this.text.setText(this.getAsText()); ! this.firePropertyChange(); ! } ! ! ! /** ! * Setter for the value attribute ! * ! * @param object The new value value ! */ ! public void setValue(Object object) ! { ! super.setValue(object); ! if (this.value != null) ! { ! this.text.setText(this.getAsText()); ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! public boolean supportsCustomEditor() ! { ! return true; ! } ! } ! --- 1,175 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.editor; ! ! import java.awt.Component; ! import java.awt.Container; ! import java.awt.GridBagConstraints; ! import java.awt.GridBagLayout; ! import java.awt.event.ActionEvent; ! import java.awt.event.ActionListener; ! import java.awt.event.FocusAdapter; ! import java.awt.event.FocusEvent; ! import java.util.ResourceBundle; ! ! import javax.management.ObjectName; ! import javax.swing.JButton; ! import javax.swing.JPanel; ! import javax.swing.JTextField; ! import javax.swing.SwingUtilities; ! ! import org.ejtools.adwt.util.ObjectSearcher; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class ObjectNameEditor extends GenericEditor ! { ! /** Description of the Field */ ! protected JButton button; ! /** Description of the Field */ ! protected Container panel; ! /** Description of the Field */ ! protected JTextField text; ! /** Description of the Field */ ! private final static ResourceBundle resources = ResourceBundle.getBundle("org.ejtools.adwt.editor.Resources"); ! ! ! /** Constructor */ ! public ObjectNameEditor() ! { ! this.text = new JTextField(30); ! ! // Update value when edited ! this.text.addFocusListener( ! new FocusAdapter() ! { ! public void focusLost(FocusEvent e) ! { ! setAsText(text.getText()); ! } ! } ! ); ! } ! ! ! /** ! * Getter for the asText attribute ! * ! * @return The value ! */ ! public String getAsText() ! { ! if (this.value != null) ! { ! return ((ObjectName) this.value).getCanonicalName(); ! } ! return ""; ! } ! ! ! /** ! * Gets the customEditor attribute of the ObjectNameEditor object ! * ! * @return The customEditor value ! */ ! public Component getCustomEditor() ! { ! if (Boolean.getBoolean("ejtools.objectname.hyperlink")) ! { ! if (this.panel == null) ! { ! GridBagConstraints gridbagconstraints = new GridBagConstraints(); ! ! this.panel = new JPanel(); ! this.panel.setLayout(new GridBagLayout()); ! this.button = new JButton(resources.getString("ObjectNameEditor.button.view")); ! ! gridbagconstraints.gridwidth = GridBagConstraints.RELATIVE; ! this.panel.add(button, gridbagconstraints); ! ! gridbagconstraints.gridwidth = GridBagConstraints.REMAINDER; ! gridbagconstraints.weightx = 1.0; ! gridbagconstraints.fill = GridBagConstraints.HORIZONTAL; ! this.panel.add(text, gridbagconstraints); ! ! this.button.addActionListener( ! new ActionListener() ! { ! /** ! * @param e Event action ! */ ! public void actionPerformed(ActionEvent e) ! { ! ObjectSearcher finder = (ObjectSearcher) SwingUtilities.getAncestorOfClass(ObjectSearcher.class, ObjectNameEditor.this.panel); ! if ((finder != null) && (ObjectNameEditor.this.value != null)) ! { ! finder.find(ObjectNameEditor.this.getAsText()); ! } ! } ! } ! ); ! } ! return this.panel; ! } ! else ! { ! return this.text; ! } ! } ! ! ! /** ! * Setter for the asText attribute ! * ! * @param s The new value ! */ ! public void setAsText(String s) ! { ! try ! { ! this.value = new ObjectName(s); ! } ! catch (Exception e) ! { ! this.value = null; ! } ! this.text.setText(this.getAsText()); ! this.firePropertyChange(); ! } ! ! ! /** ! * Setter for the value attribute ! * ! * @param object The new value value ! */ ! public void setValue(Object object) ! { ! super.setValue(object); ! if (this.value != null) ! { ! this.text.setText(this.getAsText()); ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! public boolean supportsCustomEditor() ! { ! return true; ! } ! } ! Index: URLEditor.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/editor/URLEditor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** URLEditor.java 15 Sep 2003 22:37:13 -0000 1.4 --- URLEditor.java 13 Dec 2003 21:29:34 -0000 1.5 *************** *** 1,59 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.editor; ! ! import java.net.URL; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class URLEditor extends GenericEditor ! { ! /** Constructor */ ! public URLEditor() { } ! ! ! /** ! * Getter for the asText attribute ! * ! * @return The value ! */ ! public String getAsText() ! { ! if (this.value != null) ! { ! return value.toString(); ! } ! else ! { ! return null; ! } ! } ! ! ! /** ! * Setter for the asText attribute ! * ! * @param s The new value ! */ ! public void setAsText(String s) ! { ! try ! { ! value = new URL(s); ! } ! catch (Exception e) ! { ! } ! this.firePropertyChange(); ! } ! } ! --- 1,59 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.editor; ! ! import java.net.URL; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class URLEditor extends GenericEditor ! { ! /** Constructor */ ! public URLEditor() { } ! ! ! /** ! * Getter for the asText attribute ! * ! * @return The value ! */ ! public String getAsText() ! { ! if (this.value != null) ! { ! return value.toString(); ! } ! else ! { ! return null; ! } ! } ! ! ! /** ! * Setter for the asText attribute ! * ! * @param s The new value ! */ ! public void setAsText(String s) ! { ! try ! { ! value = new URL(s); ! } ! catch (Exception e) ! { ! } ! this.firePropertyChange(); ! } ! } ! |