ejtools-cvs Mailing List for EJTools (Page 115)
Brought to you by:
letiemble
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
(471) |
May
(303) |
Jun
(176) |
Jul
(67) |
Aug
(64) |
Sep
(84) |
Oct
(148) |
Nov
(57) |
Dec
(272) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(356) |
Feb
(304) |
Mar
(214) |
Apr
(22) |
May
(7) |
Jun
(25) |
Jul
|
Aug
(5) |
Sep
(106) |
Oct
|
Nov
(95) |
Dec
(193) |
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2016 |
Jan
(2) |
Feb
(1) |
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
(2) |
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
From: Laurent E. <let...@us...> - 2002-04-19 07:03:04
|
Update of /cvsroot/ejtools/libraries/common/src/main/net/sourceforge/ejtools/beans In directory usw-pr-cvs1:/tmp/cvs-serv19318/beans Log Message: Directory /cvsroot/ejtools/libraries/common/src/main/net/sourceforge/ejtools/beans added to the repository |
From: Laurent E. <let...@us...> - 2002-04-19 07:02:51
|
Update of /cvsroot/ejtools/libraries/common/src/main/net/sourceforge/ejtools In directory usw-pr-cvs1:/tmp/cvs-serv19185/ejtools Log Message: Directory /cvsroot/ejtools/libraries/common/src/main/net/sourceforge/ejtools added to the repository |
From: Laurent E. <let...@us...> - 2002-04-19 07:02:38
|
Update of /cvsroot/ejtools/libraries/common/src/main/net/sourceforge In directory usw-pr-cvs1:/tmp/cvs-serv19004/sourceforge Log Message: Directory /cvsroot/ejtools/libraries/common/src/main/net/sourceforge added to the repository |
From: Laurent E. <let...@us...> - 2002-04-19 07:02:25
|
Update of /cvsroot/ejtools/libraries/common/src/main/net In directory usw-pr-cvs1:/tmp/cvs-serv18812/net Log Message: Directory /cvsroot/ejtools/libraries/common/src/main/net added to the repository |
From: Laurent E. <let...@us...> - 2002-04-19 07:02:10
|
Update of /cvsroot/ejtools/libraries/common/src/etc In directory usw-pr-cvs1:/tmp/cvs-serv18668/etc Log Message: Directory /cvsroot/ejtools/libraries/common/src/etc added to the repository |
From: Laurent E. <let...@us...> - 2002-04-19 07:02:00
|
Update of /cvsroot/ejtools/libraries/common/src/main In directory usw-pr-cvs1:/tmp/cvs-serv18507/main Log Message: Directory /cvsroot/ejtools/libraries/common/src/main added to the repository |
From: Laurent E. <let...@us...> - 2002-04-19 07:00:44
|
Update of /cvsroot/ejtools/libraries/common/src/resources In directory usw-pr-cvs1:/tmp/cvs-serv17518/resources Log Message: Directory /cvsroot/ejtools/libraries/common/src/resources added to the repository |
From: Laurent E. <let...@us...> - 2002-04-19 07:00:32
|
Update of /cvsroot/ejtools/libraries/common/src In directory usw-pr-cvs1:/tmp/cvs-serv17367/src Log Message: Directory /cvsroot/ejtools/libraries/common/src added to the repository |
From: Laurent E. <let...@us...> - 2002-04-18 21:11:15
|
Update of /cvsroot/ejtools/libraries/adwt In directory usw-pr-cvs1:/tmp/cvs-serv10207/adwt Added Files: module.properties Log Message: Initial Import --- NEW FILE: module.properties --- version.major=1 version.minor=0 version.revision=0 version.tag=alpha module.name=adwt module.display.name=AdWT module.archive.name=ejtools.adwt module.package=net.sourceforge.ejtools.* module.javadoc.title=EJTools - ADvanced Window Tools |
From: Laurent E. <let...@us...> - 2002-04-18 21:10:39
|
Update of /cvsroot/ejtools/libraries/adwt/src/etc In directory usw-pr-cvs1:/tmp/cvs-serv9933/etc Added Files: default.mf Log Message: Initial Import --- NEW FILE: default.mf --- Specification-Title: @module.name@ @version.major@.@version.minor@.@version.revision@-@version.tag@ Specification-Version: @version.major@.@version.minor@.@version.revision@-@version.tag@ Specification-Vendor: EJTools Project Implementation-Title: @module.name@ @version.major@.@version.minor@.@version.revision@-@version.tag@ Implementation-Version: @version.major@.@version.minor@.@version.revision@-@version.tag@ Implementation-Vendor: EJTools Project |
From: Laurent E. <let...@us...> - 2002-04-18 21:10:38
|
Update of /cvsroot/ejtools/libraries/adwt/src/main/net/sourceforge/ejtools/awt In directory usw-pr-cvs1:/tmp/cvs-serv9933/main/net/sourceforge/ejtools/awt Added Files: BeanContextPanel.java BeanContextTreeView.java GenericCustomizer.java GenericMBeanCustomizer.java GenericMBeanMethodDialog.java GenericTitledBorder.java Log Message: Initial Import --- NEW FILE: BeanContextPanel.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt; import java.awt.Container; import java.awt.Dimension; import java.beans.beancontext.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.tree.*; import net.sourceforge.ejtools.jmx.ObjectNameFinder; /** * Description of the Class * * @author letiembl * @created 19 octobre 2001 * @todo Javadoc to complete * @todo Import to clean */ public class BeanContextPanel extends JSplitPane implements ObjectNameFinder { /** Description of the Field */ protected BeanContextTreeView tree; /** * Constructor for the BeanContextPanel object * * @param beancontext Description of Parameter */ public BeanContextPanel(BeanContext beancontext) { this(beancontext, null); } /** * Constructor for the BeanContextPanel object * * @param beancontext Description of Parameter * @param s Description of Parameter */ public BeanContextPanel(BeanContext beancontext, String s) { super(1); if (s != null) { setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), s)); } tree = new BeanContextTreeView(beancontext); JScrollPane jscrollpane = new JScrollPane(tree); jscrollpane.setMinimumSize(new Dimension(300, 400)); jscrollpane.setPreferredSize(new Dimension(300, 400)); final JPanel dummyMsg = new JPanel(); dummyMsg.add(new JLabel("", 0)); setLeftComponent(jscrollpane); setRightComponent(dummyMsg); tree.addTreeSelectionListener( new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent treeselectionevent) { final TreePath selPath = treeselectionevent.getNewLeadSelectionPath(); SwingUtilities.invokeLater( new Runnable() { public void run() { try { Object obj = ((DefaultMutableTreeNode) selPath.getLastPathComponent()).getUserObject(); if (obj instanceof BeanContextChildComponentProxy) { BeanContextChildComponentProxy beancontextchildcomponentproxy = (BeanContextChildComponentProxy) obj; setRightComponent(beancontextchildcomponentproxy.getComponent()); } else if (obj instanceof BeanContextContainerProxy) { BeanContextContainerProxy beancontextcontainerproxy = (BeanContextContainerProxy) obj; setRightComponent(beancontextcontainerproxy.getContainer()); } validate(); } catch (Exception _ex) { } } }); } }); tree.getModel().addTreeModelListener( new TreeModelListener() { public void treeNodesChanged(TreeModelEvent treemodelevent) { } public void treeNodesInserted(TreeModelEvent treemodelevent) { } public void treeNodesRemoved(TreeModelEvent treemodelevent) { setRightComponent(dummyMsg); validate(); } public void treeStructureChanged(TreeModelEvent treemodelevent) { setRightComponent(dummyMsg); validate(); } }); } /** * Gets the tree attribute of the BeanContextPanel object * * @return The tree value */ public JTree getTree() { return tree; } /** * Description of the Method * * @param searchString Description of the Parameter */ public void searchObjectName(String objectName) { System.out.println("BeanContextPanel In searchReference(" + objectName+ ")"); tree.searchObjectName(objectName); } /** * Sets the showRoot attribute of the BeanContextPanel object * * @param flag The new showRoot value */ public void setShowRoot(boolean flag) { if (!flag) { tree.expandPath(tree.getPathForRow(0)); } tree.setRootVisible(flag); } } --- NEW FILE: BeanContextTreeView.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt; import java.awt.*; import java.awt.event.*; import java.beans.*; import java.beans.beancontext.*; import java.io.*; import java.lang.reflect.*; import java.util.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.tree.*; import com.dreambean.awt.*; import net.sourceforge.ejtools.jmx.ObjectNameFinder; import org.apache.log4j.*; /** * Description of the Class * * @author letiembl * @created 24 septembre 2001 * @todo Javadoc to complete * @todo Import to clean */ public class BeanContextTreeView extends JTree implements ObjectNameFinder { /** Description of the Field */ protected Hashtable indexes = new Hashtable(); /** Description of the Field */ private static Category cat = Category.getInstance(BeanContextTreeView.class.getName()); /** * Constructor for the BeanContextTreeView object * * @param context Description of Parameter */ public BeanContextTreeView(BeanContext context) { ((DefaultTreeModel) getModel()).setRoot(new DefaultMutableTreeNode(new ContextNode(context), true)); setShowsRootHandles(true); setExpandsSelectedPaths(true); putClientProperty("JTree.lineStyle", "Angled"); setCellRenderer( new DefaultTreeCellRenderer() { public Component getTreeCellRendererComponent(JTree jtree, Object obj, boolean flag, boolean flag1, boolean flag2, int i, boolean flag3) { try { ContextNode contextnode = (ContextNode) ((DefaultMutableTreeNode) obj).getUserObject(); Object obj1 = contextnode.getUserObject(); Icon icon = null; Icon icon1 = null; Icon icon2 = null; if (contextnode.icon != null) { icon = getLeafIcon(); icon1 = getOpenIcon(); icon2 = getClosedIcon(); setLeafIcon(contextnode.icon); setOpenIcon(contextnode.open); setClosedIcon(contextnode.closed); } super.getTreeCellRendererComponent(jtree, obj, flag, flag1, flag2, i, flag3); if (contextnode.icon != null) { setLeafIcon(icon); setOpenIcon(icon1); setClosedIcon(icon2); } return this; } catch (Exception _ex) { return super.getTreeCellRendererComponent(jtree, obj, flag, flag1, flag2, i, flag3); } } }); updateTree(context, (DefaultMutableTreeNode) getModel().getRoot()); addMouseListener( new MouseAdapter() { public void mousePressed(MouseEvent mouseevent) { try { int i = getRowForLocation(mouseevent.getX(), mouseevent.getY()); TreePath treepath = getPathForLocation(mouseevent.getX(), mouseevent.getY()); if (i != -1) { Object obj = ((ContextNode) ((DefaultMutableTreeNode) treepath.getLastPathComponent()).getUserObject()).getUserObject(); // Right mouse button pressed if (SwingUtilities.isRightMouseButton(mouseevent)) { setSelectionPath(treepath); JPopupMenu jpopupmenu = new JPopupMenu(obj.toString()); BeanInfo beaninfo = Introspector.getBeanInfo(obj.getClass()); MethodDescriptor amethoddescriptor[] = beaninfo.getMethodDescriptors(); if (amethoddescriptor.length == 0) { return; } for (int j = 0; j < amethoddescriptor.length; j++) { jpopupmenu.add(new PopupAction(obj, amethoddescriptor[j])); } jpopupmenu.show(BeanContextTreeView.this, mouseevent.getX(), mouseevent.getY()); } } } catch (Exception exception) { exception.printStackTrace(); } } }); addTreeSelectionListener( new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent treeselectionevent) { final TreePath selPath = treeselectionevent.getNewLeadSelectionPath(); SwingUtilities.invokeLater( new Runnable() { public void run() { /* * try { * Object obj = ((ContextNode) ((DefaultMutableTreeNode) selPath.getLastPathComponent()).getUserObject()).getUserObject(); * if (obj instanceof BeanContextEditable) { * ((BeanContextEditable) obj).setSelection(); * } * } catch (Exception _ex) { * } */ } }); } }); } /** * Description of the Method * * @param searchString Description of the Parameter */ public void searchObjectName(String objectName) { System.out.println("BeanContextTreeView In searchReference(" + objectName+ ")"); TreeNode[] nodes = (TreeNode[]) indexes.get(objectName); if (nodes != null) { TreePath path = new TreePath(nodes); setSelectionPath(path); } } /** * Description of the Method * * @param collection Description of Parameter * @param defaultmutabletreenode Description of Parameter */ private void updateTree(Collection collection, DefaultMutableTreeNode defaultmutabletreenode) { for (Iterator iterator = collection.iterator(); iterator.hasNext(); ) { Object obj = iterator.next(); if (obj instanceof BeanContextContainerProxy) { DefaultMutableTreeNode defaultmutabletreenode1 = new DefaultMutableTreeNode(new ContextNode(obj), true); defaultmutabletreenode.add(defaultmutabletreenode1); indexes.put(obj.toString(), defaultmutabletreenode1.getPath()); // System.out.println(obj.toString() + " linked to " + defaultmutabletreenode1.getPath()); } else if (obj instanceof BeanContextChildComponentProxy) { DefaultMutableTreeNode defaultmutabletreenode2 = new DefaultMutableTreeNode(new ContextNode(obj), true); defaultmutabletreenode.add(defaultmutabletreenode2); if (obj instanceof Collection) { updateTree((Collection) obj, defaultmutabletreenode2); } indexes.put(obj.toString(), defaultmutabletreenode2.getPath()); // System.out.println(obj.toString() + " linked to " + defaultmutabletreenode2.getPath()); } } if (collection instanceof BeanContext) { ((BeanContext) collection).addBeanContextMembershipListener(new ServerTreeSync(defaultmutabletreenode)); } } /** * Description of the Class * * @author letiembl * @created 24 septembre 2001 */ public class ContextNode implements BeanContextChildComponentProxy { /** Description of the Field */ Icon closed; /** Description of the Field */ Icon icon; /** Description of the Field */ Object obj; /** Description of the Field */ Icon open; /** Description of the Field */ String txt; /** * Constructor for the ContextNode object * * @param obj1 Description of Parameter */ ContextNode(Object obj1) { obj = obj1; try { BeanInfo beaninfo = Introspector.getBeanInfo(obj1.getClass()); { // Custom rendering for Resource // Classic rendering for others if ((icon == null) && (beaninfo.getIcon(1) != null)) { icon = new ImageIcon(beaninfo.getIcon(1)); open = new ImageIcon(beaninfo.getIcon(1)); closed = new ImageIcon(beaninfo.getIcon(1)); } } Method method = obj1.getClass().getMethod("toString", new Class[0]); if (method.getDeclaringClass().equals(Object.class)) { txt = beaninfo.getBeanDescriptor().getDisplayName(); } } catch (Exception exception) { exception.printStackTrace(); } } /** * Gets the Component attribute of the ContextNode object * * @return The Component value */ public Component getComponent() { if (obj instanceof Component) { return (Component) obj; } if (obj instanceof BeanContextContainerProxy) { return ((BeanContextContainerProxy) obj).getContainer(); } if (obj instanceof BeanContextChildComponentProxy) { return ((BeanContextChildComponentProxy) obj).getComponent(); } else { return new JLabel("No GUI available for this service", 0); } } /** * Gets the UserObject attribute of the ContextNode object * * @return The UserObject value */ public Object getUserObject() { return obj; } /** * Description of the Method * * @return Description of the Returned Value */ public String toString() { return txt != null ? txt : obj.toString(); } } /** * Description of the Class * * @author letiembl * @created 24 septembre 2001 */ public class PopupAction extends AbstractAction { /** Description of the Field */ MethodDescriptor md; /** Description of the Field */ Object obj; /** * Constructor for the PopupAction object * * @param obj1 Description of Parameter * @param methoddescriptor Description of Parameter */ PopupAction(Object obj1, MethodDescriptor methoddescriptor) { super(methoddescriptor.getDisplayName()); obj = obj1; md = methoddescriptor; } /** * Description of the Method * * @param actionevent Description of Parameter */ public void actionPerformed(ActionEvent actionevent) { if (md.getParameterDescriptors() != null && md.getParameterDescriptors().length > 0) { new GenericMethodDialog(obj, md, (JFrame) SwingUtilities.getRoot(BeanContextTreeView.this)); } else { try { md.getMethod().invoke(obj, new Object[0]); } catch (Exception exception) { exception.printStackTrace(); } } } } /** * Description of the Class * * @author letiembl * @created 24 septembre 2001 */ protected class ServerTreeSync implements BeanContextMembershipListener { /** Description of the Field */ DefaultMutableTreeNode node; /** * Constructor for the ServerTreeSync object * * @param defaultmutabletreenode Description of Parameter */ ServerTreeSync(DefaultMutableTreeNode defaultmutabletreenode) { node = defaultmutabletreenode; } /** * Description of the Method * * @param beancontextmembershipevent Description of Parameter */ public void childrenAdded(BeanContextMembershipEvent beancontextmembershipevent) { node.removeAllChildren(); for (Iterator iterator = ((Collection) beancontextmembershipevent.getSource()).iterator(); iterator.hasNext(); ) { Object obj = iterator.next(); if (obj instanceof BeanContextContainerProxy) { DefaultMutableTreeNode defaultmutabletreenode = new DefaultMutableTreeNode(new ContextNode(obj)); node.add(defaultmutabletreenode); indexes.put(obj.toString(), defaultmutabletreenode.getPath()); } else if (obj instanceof BeanContextChildComponentProxy) { DefaultMutableTreeNode defaultmutabletreenode1 = new DefaultMutableTreeNode(new ContextNode(obj)); node.add(defaultmutabletreenode1); indexes.put(obj.toString(), defaultmutabletreenode1.getPath()); if (obj instanceof Collection) { updateTree((Collection) obj, defaultmutabletreenode1); } } } ((DefaultTreeModel) getModel()).reload(node); } /** * Description of the Method * * @param beancontextmembershipevent Description of Parameter */ public void childrenRemoved(BeanContextMembershipEvent beancontextmembershipevent) { Object aobj[] = beancontextmembershipevent.toArray(); for (int i = 0; i < aobj.length; i++) { for (Enumeration enumeration = node.children(); enumeration.hasMoreElements(); ) { DefaultMutableTreeNode defaultmutabletreenode = (DefaultMutableTreeNode) enumeration.nextElement(); if (((ContextNode) defaultmutabletreenode.getUserObject()).getUserObject() == aobj[i]) { node.remove(defaultmutabletreenode); indexes.remove(aobj[i].toString()); break; } } } ((DefaultTreeModel) getModel()).reload(node); } } } --- NEW FILE: GenericCustomizer.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at gnu.org. */ package net.sourceforge.ejtools.awt; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.*; import java.beans.beancontext.*; import java.io.*; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.*; import javax.swing.*; import javax.swing.border.*; import com.dreambean.awt.*; /** * Description of the Class * * @author letiembl * @created 8 avril 2002 * @todo Non Supported classes displayed * @todo Result of Command put into an Output List */ public class GenericCustomizer extends JScrollPane implements Customizer { /** Description of the Field */ private JPanel beanGui; /** Description of the Field */ private MethodDescriptor md[]; /** Description of the Field */ private Object object; /** Description of the Field */ private JPanel p; /** Description of the Field */ private PropertyDescriptor pd[]; /** Description of the Field */ private JComponent previous; /** Description of the Field */ private boolean showMethods; /** Constructor for the GenericCustomizer object */ public GenericCustomizer() { this(true); } /** * Constructor for the GenericCustomizer object * * @param obj Description of Parameter */ public GenericCustomizer(Object obj) { this(); setObject(obj); } /** * Constructor for the GenericCustomizer object * * @param flag Description of Parameter */ public GenericCustomizer(boolean flag) { super(new JPanel()); previous = null; p = (JPanel) getViewport().getView(); // To check p.setLayout(new GridBagLayout()); showMethods = flag; } /** * Constructor for the GenericCustomizer object * * @param flag Description of Parameter * @param obj Description of Parameter */ public GenericCustomizer(boolean flag, Object obj) { this(flag); setObject(obj); } /** * Adds a feature to the ArrayProperty attribute of the GenericCustomizer * object * * @param propertyeditor The feature to be added to the ArrayProperty * attribute * @param propertydescriptor The feature to be added to the ArrayProperty * attribute */ public void addArrayProperty(PropertyEditor propertyeditor, PropertyDescriptor propertydescriptor) { Object obj = null; Object[] array = null; JPanel jpanel = null; GridBagConstraints gridbagconstraints = new GridBagConstraints(); gridbagconstraints.insets = new Insets(3, 3, 3, 3); try { obj = propertydescriptor.getReadMethod().invoke(object, new Object[0]); if (obj != null) { array = (Object[]) obj; } } catch (Exception _ex) { } JLabel jlabel = new JLabel(propertydescriptor.getDisplayName() + " :", JLabel.RIGHT); jlabel.setToolTipText(propertydescriptor.getShortDescription()); gridbagconstraints.anchor = GridBagConstraints.NORTH; gridbagconstraints.weightx = 0.0D; gridbagconstraints.weighty = 1.0D; gridbagconstraints.gridwidth = GridBagConstraints.RELATIVE; gridbagconstraints.fill = GridBagConstraints.HORIZONTAL; beanGui.add(jlabel, gridbagconstraints); if (array == null) { jpanel = new JPanel(); } else { jpanel = new JPanel(new GridLayout(array.length, 1)); for (int i = 0; i < array.length; i++) { try { PropertyEditor propertyeditor1 = (PropertyEditor) propertyeditor.getClass().newInstance(); propertyeditor1.setValue(array[i]); Object obj1; if (propertyeditor1.supportsCustomEditor()) { obj1 = propertyeditor1.getCustomEditor(); if (obj1 instanceof JComponent) { if (previous != null) { previous.setNextFocusableComponent(((Component) (obj1))); } previous = (JComponent) obj1; } } else { String as[] = propertyeditor1.getTags(); if (as != null) { obj1 = new GenericPropertyCustomizer(propertyeditor1, as); if (previous != null) { previous.setNextFocusableComponent(((Component) (obj1))); } previous = (JComponent) obj1; } else { final JLabel lbl = new JLabel(propertyeditor1.getAsText()); final PropertyEditor pcEditor = propertyeditor1; obj1 = lbl; pcEditor.addPropertyChangeListener( new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent propertychangeevent) { lbl.setText(pcEditor.getAsText()); } }); } } jpanel.add((Component) obj1); } catch (Exception _ex) { } } } gridbagconstraints.gridwidth = GridBagConstraints.REMAINDER; gridbagconstraints.weightx = 1.0D; beanGui.add(jpanel, gridbagconstraints); } /** * Adds a feature to the Property attribute of the GenericCustomizer object * * @param propertyeditor The feature to be added to the Property * attribute * @param propertydescriptor The feature to be added to the Property * attribute */ public void addProperty(PropertyEditor propertyeditor, PropertyDescriptor propertydescriptor) { GridBagConstraints gridbagconstraints = new GridBagConstraints(); gridbagconstraints.insets = new Insets(3, 3, 3, 3); try { Object obj = propertydescriptor.getReadMethod().invoke(object, new Object[0]); if (obj != null) { propertyeditor.setValue(obj); } if (!obj.equals(propertyeditor.getValue())) { propertydescriptor.getWriteMethod().invoke(object, new Object[]{ propertyeditor.getValue() }); } } catch (Exception _ex) { } JLabel jlabel = new JLabel(propertydescriptor.getDisplayName() + " :", JLabel.RIGHT); jlabel.setToolTipText(propertydescriptor.getShortDescription()); gridbagconstraints.anchor = GridBagConstraints.NORTH; gridbagconstraints.weightx = 0.0D; gridbagconstraints.weighty = 1.0D; gridbagconstraints.gridwidth = GridBagConstraints.RELATIVE; gridbagconstraints.fill = GridBagConstraints.HORIZONTAL; beanGui.add(jlabel, gridbagconstraints); Object obj1; if (propertyeditor.supportsCustomEditor()) { obj1 = propertyeditor.getCustomEditor(); if (obj1 instanceof JComponent) { if (previous != null) { previous.setNextFocusableComponent(((Component) (obj1))); } previous = (JComponent) obj1; } } else { String as[] = propertyeditor.getTags(); if (as != null) { obj1 = new GenericPropertyCustomizer(propertyeditor, as); if (previous != null) { previous.setNextFocusableComponent(((Component) (obj1))); } previous = (JComponent) obj1; } else if (propertydescriptor.getWriteMethod() != null) { obj1 = new GenericPropertyCustomizer(propertyeditor); if (previous != null) { previous.setNextFocusableComponent(((Component) (obj1))); } previous = (JComponent) obj1; } else { final JLabel lbl = new JLabel(propertyeditor.getAsText()); final PropertyEditor pcEditor = propertyeditor; obj1 = lbl; pcEditor.addPropertyChangeListener( new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent propertychangeevent) { lbl.setText(pcEditor.getAsText()); } }); } } gridbagconstraints.gridwidth = GridBagConstraints.REMAINDER; gridbagconstraints.weightx = 1.0D; beanGui.add(((Component) (obj1)), gridbagconstraints); if (propertydescriptor.getWriteMethod() != null) { propertyeditor.addPropertyChangeListener(new BeanUpdater(propertydescriptor)); } try { Method method = object.getClass().getMethod("addPropertyChangeListener", new Class[]{java.lang.String.class, java.beans.PropertyChangeListener.class}); method.invoke(object, new Object[]{propertydescriptor.getName(), new EditorUpdater(propertyeditor, propertydescriptor.getName())}); } catch (Exception _ex) { try { Method method1 = object.getClass().getMethod("addPropertyChangeListener", new Class[]{java.beans.PropertyChangeListener.class}); method1.invoke(object, new Object[]{new EditorUpdater(propertyeditor, propertydescriptor)}); } catch (Exception _ex2) { System.out.println("Exception occurred"); _ex2.printStackTrace(); } } } /** * Sets the Object attribute of the GenericCustomizer object * * @param obj The new Object value */ public void setObject(Object obj) { try { p.removeAll(); if (obj == null) { validate(); repaint(); return; } object = obj; GridBagConstraints gridbagconstraints = new GridBagConstraints(); gridbagconstraints.insets = new Insets(3, 3, 3, 3); gridbagconstraints.anchor = GridBagConstraints.NORTH; gridbagconstraints.weighty = 1.0D; BeanInfo beaninfo; if (obj instanceof BeanInfo) { beaninfo = (BeanInfo) obj; } else { beaninfo = Introspector.getBeanInfo(obj.getClass()); } beanGui = new JPanel(new GridBagLayout()); beanGui.setBorder(new TitledBorder(BorderFactory.createEtchedBorder(), beaninfo.getBeanDescriptor().getDisplayName())); /* * if (beaninfo.getIcon(BeanInfo.ICON_COLOR_32x32) != null) * { * beanGui.setBorder(new GenericTitledBorder(BorderFactory.createEtchedBorder(), beaninfo.getBeanDescriptor().getDisplayName(), new ImageIcon(beaninfo.getIcon(BeanInfo.ICON_COLOR_32x32)))); * } * else * { * beanGui.setBorder(new TitledBorder(BorderFactory.createEtchedBorder(), beaninfo.getBeanDescriptor().getDisplayName())); * } */ pd = beaninfo.getPropertyDescriptors(); if (pd != null) { if (beaninfo.getBeanDescriptor().getValue("propertyorder") == null) { for (int i = 0; i < pd.length; i++) { if (!pd[i].getReadMethod().getDeclaringClass().equals(java.lang.Object.class) && !pd[i].isHidden()) { PropertyEditor propertyeditor = null; // Test if there is an editor Class class1 = pd[i].getPropertyEditorClass(); if (class1 != null) { propertyeditor = (PropertyEditor) class1.newInstance(); } // System.out.println("Property " + pd[i].getPropertyType()); // If it's an array, take if (pd[i].getPropertyType().isArray()) { Class componentType = pd[i].getPropertyType().getComponentType(); propertyeditor = PropertyEditorManager.findEditor(componentType); addArrayProperty(propertyeditor, pd[i]); } else { if (propertyeditor == null) { propertyeditor = PropertyEditorManager.findEditor(pd[i].getPropertyType()); } if (propertyeditor != null) { addProperty(propertyeditor, pd[i]); } } gridbagconstraints.weighty = 1.0D; } } } else { for (StringTokenizer stringtokenizer = new StringTokenizer((String) beaninfo.getBeanDescriptor().getValue("propertyorder"), ":"); stringtokenizer.hasMoreTokens(); ) { String s = stringtokenizer.nextToken(); for (int k = 0; k < pd.length; k++) { if (pd[k].getName().equals(s) && !pd[k].isHidden()) { PropertyEditor propertyeditor1 = null; Class class2 = pd[k].getPropertyEditorClass(); if (class2 != null) { propertyeditor1 = (PropertyEditor) class2.newInstance(); } // System.out.println("Property " + pd[k].getPropertyType()); // If it's an array, take if (pd[k].getPropertyType().isArray()) { Class componentType = pd[k].getPropertyType().getComponentType(); propertyeditor1 = PropertyEditorManager.findEditor(componentType); addArrayProperty(propertyeditor1, pd[k]); } else { if (propertyeditor1 == null) { propertyeditor1 = PropertyEditorManager.findEditor(pd[k].getPropertyType()); } if (propertyeditor1 != null) { addProperty(propertyeditor1, pd[k]); } } gridbagconstraints.weighty = 1.0D; } } } } } if (showMethods) { md = beaninfo.getMethodDescriptors(); gridbagconstraints.weighty = 1.0D; gridbagconstraints.gridwidth = GridBagConstraints.REMAINDER; gridbagconstraints.fill = GridBagConstraints.HORIZONTAL; if (md != null) { for (int j = 0; j < md.length; j++) { if (!md[j].getName().startsWith("get") && !md[j].getName().startsWith("set") && !md[j].getName().startsWith("is")) { JButton jbutton = new JButton(md[j].getDisplayName()); jbutton.setToolTipText(md[j].getShortDescription()); beanGui.add(jbutton, gridbagconstraints); jbutton.addActionListener(new MethodInvoker(md[j])); } } } } gridbagconstraints.weighty = 0.0D; gridbagconstraints.weightx = 1.0D; gridbagconstraints.fill = GridBagConstraints.BOTH; p.add(beanGui, gridbagconstraints); // Add a spacer gridbagconstraints.weighty = 1.0D; p.add(new JLabel(" "), gridbagconstraints); validate(); repaint(); } catch (Exception exception) { System.out.println("Exception occurred"); exception.printStackTrace(); } } /** * Description of the Method * * @param s Description of Parameter * @param obj Description of Parameter * @param obj1 Description of Parameter */ protected void updated(String s, Object obj, Object obj1) { firePropertyChange(s, obj, obj1); } /** * Description of the Class * * @author root * @created 7 octobre 2001 */ protected class BeanUpdater implements PropertyChangeListener { /** Description of the Field */ PropertyDescriptor pd; /** * Constructor for the BeanUpdater object * * @param propertydescriptor Description of Parameter */ public BeanUpdater(PropertyDescriptor propertydescriptor) { pd = propertydescriptor; } /** * Description of the Method * * @param propertychangeevent Description of Parameter */ public void propertyChange(PropertyChangeEvent propertychangeevent) { Object obj = null; try { Object obj1 = pd.getReadMethod().invoke(object, new Object[0]); Object obj2 = ((PropertyEditor) propertychangeevent.getSource()).getValue(); pd.getWriteMethod().invoke(object, new Object[]{obj2}); updated(pd.getName(), obj1, obj2); } catch (InvocationTargetException invocationtargetexception) { if (invocationtargetexception.getTargetException() instanceof PropertyVetoException) { JOptionPane.showMessageDialog((Frame) SwingUtilities.windowForComponent(GenericCustomizer.this), "Could not change value:" + invocationtargetexception.getTargetException().getMessage(), "Error", 0); } } catch (Exception exception) { System.err.println(exception); } } } /** * Description of the Class * * @author root * @created 7 octobre 2001 */ protected class EditorUpdater implements PropertyChangeListener { /** Description of the Field */ PropertyEditor editor; /** Description of the Field */ PropertyDescriptor pd; /** Description of the Field */ String propName; /** * Constructor for the EditorUpdater object * * @param propertyeditor Description of Parameter * @param propertydescriptor Description of Parameter */ public EditorUpdater(PropertyEditor propertyeditor, PropertyDescriptor propertydescriptor) { propName = null; editor = propertyeditor; pd = propertydescriptor; } /** * Constructor for the EditorUpdater object * * @param propertyeditor Description of Parameter * @param s Description of Parameter */ public EditorUpdater(PropertyEditor propertyeditor, String s) { propName = null; editor = propertyeditor; propName = s; } /** * Description of the Method * * @param propertychangeevent Description of Parameter */ public void propertyChange(PropertyChangeEvent propertychangeevent) { if (propName != null && propertychangeevent.getPropertyName() != null && !propertychangeevent.getPropertyName().equals(propName)) { return; } if (propertychangeevent.getPropertyName() != null) { if (!editor.getValue().equals(propertychangeevent.getNewValue())) { editor.setValue(propertychangeevent.getNewValue()); } } else { try { Object obj = pd.getReadMethod().invoke(propertychangeevent.getSource(), new Object[0]); if (obj != null && !obj.equals(editor.getValue())) { editor.setValue(obj); } } catch (Exception _ex) { } } } } /** * Description of the Class * * @author root * @created 7 octobre 2001 */ protected class MethodInvoker implements ActionListener { /** Description of the Field */ MethodDescriptor md; /** * Constructor for the MethodInvoker object * * @param methoddescriptor Description of Parameter */ MethodInvoker(MethodDescriptor methoddescriptor) { md = methoddescriptor; } /** * Description of the Method * * @param actionevent Description of Parameter */ public void actionPerformed(ActionEvent actionevent) { Object obj; for (obj = p; !(obj instanceof Frame); obj = ((Component) (obj)).getParent()) { ; } if (md.getParameterDescriptors() == null && md.getMethod().getParameterTypes().length == 0 || md.getParameterDescriptors() != null && md.getParameterDescriptors().length == 0) { try { md.getMethod().invoke(object, new Object[0]); } catch (InvocationTargetException invocationtargetexception) { invocationtargetexception.getTargetException().printStackTrace(); JOptionPane.showMessageDialog(((Component) (obj)), invocationtargetexception.getTargetException().getMessage(), "Error", 0); } catch (Exception exception) { System.err.println(exception); JOptionPane.showMessageDialog(((Component) (obj)), "An exception occured. Check log for details", "Error", 0); } } else { new GenericMethodDialog(object, md, (Frame) obj); } } } static { PropertyEditorManager.setEditorSearchPath(new String[]{"sun.beans.editors", "net.sourceforge.ejtools.awt.editors"}); } } --- NEW FILE: GenericMBeanCustomizer.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at gnu.org. */ package net.sourceforge.ejtools.awt; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.*; import java.beans.beancontext.*; import java.io.*; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.*; import javax.management.*; import javax.swing.*; import javax.swing.border.*; import com.dreambean.awt.*; import net.sourceforge.ejtools.jmx.MBeanAccessor; /** * Description of the Class * * @author letiembl * @created 8 avril 2002 * @todo Protected method to choose PropertyEditor by Class and Name * @todo Constructor Info * @todo Notification Info * @todo Layout for Contructor Attribute Operation and Notification * @todo Non Supported classes displayed * @todo Result of Command put into an Output List */ public class GenericMBeanCustomizer extends JScrollPane implements Customizer { /** Description of the Field */ private JPanel beanGui; /** Description of the Field */ private MBeanAttributeInfo mbai[]; /** Description of the Field */ private MBeanNotificationInfo mbni[]; /** Description of the Field */ private MBeanOperationInfo mboi[]; /** Description of the Field */ private MBeanAccessor object; /** Description of the Field */ private JPanel p; /** Description of the Field */ private JComponent previous; /** Description of the Field */ private boolean showMethods; /** Constructor for the GenericCustomizer object */ public GenericMBeanCustomizer() { this(true); } /** * Constructor for the GenericCustomizer object * * @param obj Description of Parameter */ public GenericMBeanCustomizer(Object obj) { this(); setObject(obj); } /** * Constructor for the GenericCustomizer object * * @param flag Description of Parameter */ public GenericMBeanCustomizer(boolean flag) { super(new JPanel()); previous = null; p = (JPanel) getViewport().getView(); p.setLayout(new GridBagLayout()); showMethods = flag; } /** * Constructor for the GenericCustomizer object * * @param flag Description of Parameter * @param obj Description of Parameter */ public GenericMBeanCustomizer(boolean flag, Object obj) { this(flag); setObject(obj); } /** * Adds a feature to the ArrayProperty attribute of the GenericCustomizer * object * * @param propertyeditor The feature to be added to the ArrayProperty * attribute * @param attributeInfo The feature to be added to the ArrayProperty * attribute */ public void addArrayProperty(PropertyEditor propertyeditor, MBeanAttributeInfo attributeInfo) { Object obj = null; Object[] array = null; JPanel jpanel = null; GridBagConstraints gridbagconstraints = new GridBagConstraints(); gridbagconstraints.insets = new Insets(3, 3, 3, 3); try { if (attributeInfo.isReadable()) { obj = object.getAttribute(object.getObjectName(), attributeInfo.getName()); } if (obj != null) { array = (Object[]) obj; } } catch (Throwable _ex) { } JLabel jlabel = new JLabel(attributeInfo.getName() + " :", JLabel.RIGHT); jlabel.setToolTipText(attributeInfo.getDescription()); gridbagconstraints.anchor = GridBagConstraints.NORTH; gridbagconstraints.weightx = 0.0D; gridbagconstraints.weighty = 1.0D; gridbagconstraints.gridwidth = GridBagConstraints.RELATIVE; gridbagconstraints.fill = GridBagConstraints.HORIZONTAL; beanGui.add(jlabel, gridbagconstraints); if (array == null) { jpanel = new JPanel(); } else { jpanel = new JPanel(new GridLayout(array.length, 1)); for (int i = 0; i < array.length; i++) { try { PropertyEditor propertyeditor1 = (PropertyEditor) propertyeditor.getClass().newInstance(); propertyeditor1.setValue(array[i]); Object obj1; if (propertyeditor1.supportsCustomEditor()) { obj1 = propertyeditor1.getCustomEditor(); if (obj1 instanceof JComponent) { if (previous != null) { previous.setNextFocusableComponent(((Component) (obj1))); } previous = (JComponent) obj1; } } else { String as[] = propertyeditor1.getTags(); if (as != null) { obj1 = new GenericPropertyCustomizer(propertyeditor1, as); if (previous != null) { previous.setNextFocusableComponent(((Component) (obj1))); } previous = (JComponent) obj1; } else { final JLabel lbl = new JLabel(propertyeditor1.getAsText()); final PropertyEditor pcEditor = propertyeditor1; obj1 = lbl; pcEditor.addPropertyChangeListener( new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { lbl.setText(pcEditor.getAsText()); } }); } } jpanel.add((Component) obj1); } catch (Exception _ex) { } } } gridbagconstraints.gridwidth = GridBagConstraints.REMAINDER; gridbagconstraints.weightx = 1.0D; beanGui.add(jpanel, gridbagconstraints); } /** * Adds a feature to the Property attribute of the GenericCustomizer object * * @param propertyeditor The feature to be added to the Property attribute * @param attributeInfo The feature to be added to the Property attribute */ public void addProperty(PropertyEditor propertyeditor, MBeanAttributeInfo attributeInfo) { GridBagConstraints gridbagconstraints = new GridBagConstraints(); gridbagconstraints.insets = new Insets(3, 3, 3, 3); try { if (attributeInfo.isReadable()) { propertyeditor.setValue(object.getAttribute(object.getObjectName(), attributeInfo.getName())); } } catch (Throwable _ex) { } JLabel jlabel = new JLabel(attributeInfo.getName() + " :", JLabel.RIGHT); jlabel.setToolTipText(attributeInfo.getDescription()); gridbagconstraints.anchor = GridBagConstraints.NORTH; gridbagconstraints.weightx = 0.0D; gridbagconstraints.weighty = 1.0D; gridbagconstraints.gridwidth = GridBagConstraints.RELATIVE; gridbagconstraints.fill = GridBagConstraints.HORIZONTAL; beanGui.add(jlabel, gridbagconstraints); Object obj1; if (propertyeditor.supportsCustomEditor()) { obj1 = propertyeditor.getCustomEditor(); if (obj1 instanceof JComponent) { if (previous != null) { previous.setNextFocusableComponent(((Component) (obj1))); } previous = (JComponent) obj1; } } else { String[] tags = propertyeditor.getTags(); if (tags != null) { obj1 = new GenericPropertyCustomizer(propertyeditor, tags); if (previous != null) { previous.setNextFocusableComponent((Component) (obj1)); } previous = (JComponent) obj1; } else { if (attributeInfo.isWritable()) { obj1 = new GenericPropertyCustomizer(propertyeditor); if (previous != null) { previous.setNextFocusableComponent((Component) (obj1)); } previous = (JComponent) obj1; } else { final JLabel lbl = new JLabel(propertyeditor.getAsText()); final PropertyEditor pcEditor = propertyeditor; obj1 = lbl; pcEditor.addPropertyChangeListener( new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { lbl.setText(pcEditor.getAsText()); } }); } } } gridbagconstraints.weightx = 1.0D; gridbagconstraints.gridwidth = GridBagConstraints.REMAINDER; gridbagconstraints.fill = GridBagConstraints.HORIZONTAL; beanGui.add(((Component) (obj1)), gridbagconstraints); if (attributeInfo.isWritable()) { propertyeditor.addPropertyChangeListener(new BeanUpdater(attributeInfo)); } try { Method method = object.getClass().getMethod("addPropertyChangeListener", new Class[]{java.lang.String.class, java.beans.PropertyChangeListener.class}); method.invoke(object, new Object[]{attributeInfo.getName(), new EditorUpdater(propertyeditor, attributeInfo.getName())}); } catch (Exception _ex) { try { Method method1 = object.getClass().getMethod("addPropertyChangeListener", new Class[]{java.beans.PropertyChangeListener.class}); method1.invoke(object, new Object[]{new EditorUpdater(propertyeditor, attributeInfo)}); } catch (Exception _ex2) { } } } public void addUnsupportedProperty(MBeanAttributeInfo attributeInfo) { System.out.println("In addUnsupportedProperty " + attributeInfo.getType()); GridBagConstraints gridbagconstraints = new GridBagConstraints(); gridbagconstraints.insets = new Insets(3, 3, 3, 3); JLabel jlabel = new JLabel(attributeInfo.getName() + " :", JLabel.RIGHT); jlabel.setToolTipText(attributeInfo.getDescription()); gridbagconstraints.anchor = GridBagConstraints.NORTH; gridbagconstraints.weightx = 0.0D; gridbagconstraints.weighty = 1.0D; gridbagconstraints.gridwidth = GridBagConstraints.RELATIVE; gridbagconstraints.fill = GridBagConstraints.HORIZONTAL; beanGui.add(jlabel, gridbagconstraints); JLabel lbl = new JLabel("Unloadabled class " + attributeInfo.getType()); gridbagconstraints.weightx = 1.0D; gridbagconstraints.gridwidth = GridBagConstraints.REMAINDER; beanGui.add(lbl, gridbagconstraints); } /** * Sets the Object attribute of the GenericCustomizer object * * @param obj The new Object value */ public void setObject(Object obj) { try { p.removeAll(); if (obj == null) { validate(); repaint(); return; } object = (MBeanAccessor) obj; MBeanInfo beaninfo = object.getMBeanInfo(); GridBagConstraints gridbagconstraints = new GridBagConstraints(); gridbagconstraints.insets = new Insets(3, 3, 3, 3); gridbagconstraints.anchor = GridBagConstraints.NORTH; gridbagconstraints.weighty = 1.0D; beanGui = new JPanel(new GridBagLayout()); beanGui.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), object.getCanonicalName())); mbai = beaninfo.getAttributes(); if (mbai != null) { for (int i = 0; i < mbai.length; i++) { PropertyEditor propertyeditor = null; Class c = getClass(mbai[i].getType()); if (c == null) { addUnsupportedProperty(mbai[i]); } else { if (c.isArray()) { Class componentType = c.getComponentType(); propertyeditor = PropertyEditorManager.findEditor(componentType); addArrayProperty(propertyeditor, mbai[i]); } else { propertyeditor = PropertyEditorManager.findEditor(c); if (propertyeditor == null) { propertyeditor = PropertyEditorManager.findEditor(String.class); } addProperty(propertyeditor, mbai[i]); } gridbagconstraints.weighty = 1.0D; } } } if (showMethods) { mboi = beaninfo.getOperations(); gridbagconstraints.gridwidth = GridBagConstraints.REMAINDER; gridbagconstraints.fill = GridBagConstraints.BOTH; if (mboi != null) { for (int j = 0; j < mboi.length; j++) { if (!mboi[j].getName().startsWith("get") && !mboi[j].getName().startsWith("set") && !mboi[j].getName().startsWith("is")) { JButton jbutton = new JButton(mboi[j].getName()); jbutton.setToolTipText(mboi[j].getDescription()); beanGui.add(jbutton, gridbagconstraints); jbutton.addActionListener(new MethodInvoker(mboi[j])); } } } } gridbagconstraints.weighty = 0.0D; gridbagconstraints.weightx = 1.0D; gridbagconstraints.fill = GridBagConstraints.BOTH; p.add(beanGui, gridbagconstraints); // Add a spacer gridbagconstraints.weighty = 1.0D; p.add(new JLabel(" "), gridbagconstraints); validate(); repaint(); } catch (Exception exception) { System.out.println("Exception occurred"); exception.printStackTrace(); } } /** * Description of the Method * * @param s Description of Parameter * @param obj Description of Parameter * @param obj1 Description of Parameter */ protected void updated(String s, Object obj, Object obj1) { firePropertyChange(s, obj, obj1); } /** * Gets the class attribute of the GenericMBeanCustomizer class * * @param fullPathClassName Description of the Parameter * @return The class value */ static Class getClass(String fullPathClassName) { if (fullPathClassName.equals("int")) { return Integer.TYPE; } if (fullPathClassName.equals("short")) { return Short.TYPE; } if (fullPathClassName.equals("long")) { return Long.TYPE; } if (fullPathClassName.equals("byte")) { return Byte.TYPE; } if (fullPathClassName.equals("char")) { return Character.TYPE; } if (fullPathClassName.equals("float")) { return Float.TYPE; } if (fullPathClassName.equals("double")) { return Double.TYPE; } if (fullPathClassName.equals("boolean")) { return Boolean.TYPE; } Class c = null; try { c = Class.forName(fullPathClassName); } catch (Throwable e) { } System.out.println("Class is " + c); return c; } /** * Description of the Class * * @author laurent * @created 11 avril 2002 */ class BeanUpdater implements PropertyChangeListener { /** Description of the Field */ MBeanAttributeInfo info; /** * Constructor for the BeanUpdater object * * @param info Description of Parameter */ public BeanUpdater(MBeanAttributeInfo info) { this.info = info; } /** * Description of the Method * * @param event Description of Parameter */ public void propertyChange(PropertyChangeEvent event) { Object old = null; try { if (info.isReadable()) { old = object.getAttribute(object.getObjectName(), info.getName()); } Object obj = ((PropertyEditor) event.getSource()).getValue(); object.setAttribute(object.getObjectName(), new Attribute(info.getName(), obj)); updated(info.getName(), old, obj); } /* * AS Adapt to the JMXConnector exceptions * catch( InvocationTargetException e ) { * if( e.getTargetException() instanceof PropertyVetoException ) { * JOptionPane.showMessageDialog( * (Frame) SwingUtilities.windowForComponent( GenericMBeanCustomizer.this ), * "Could not change value:" + e.getTargetException().getMessage(), * "Error", * JOptionPane.ERROR_MESSAGE * ); * } * } */ catch (Exception e) { System.err.println(e); } } } /** * This class makes sure that the customizer is updated with the object * changes * * @author andreass * @created November 24, 2000 */ class EditorUpdater implements PropertyChangeListener { /** Description of the Field */ PropertyEditor editor; /** Description of the Field */ MBeanAttributeInfo info; /** Description of the Field */ String name; /** * Constructor for the EditorUpdater object * * @param editor Description of Parameter * @param info Description of Parameter */ public EditorUpdater(PropertyEditor editor, MBeanAttributeInfo info) { this.editor = editor; ... [truncated message content] |
From: Laurent E. <let...@us...> - 2002-04-18 21:10:38
|
Update of /cvsroot/ejtools/libraries/adwt/src/resources In directory usw-pr-cvs1:/tmp/cvs-serv9933/resources Added Files: action.properties action_fr_FR.properties Log Message: Initial Import --- NEW FILE: action.properties --- # actions action.file=File action.edit=Edit action.tools=Tools action.options=Options action.help=Help action.window=Window # actions action.file.new=New action.file.open=Open action.file.save=Save action.file.save.as=Save As action.file.exit=Exit action.file.history=N/A action.edit.cut=Cut action.edit.copy=Copy action.edit.paste=Paste action.edit.delete=Delete action.edit.delete.selected=Delete Selected action.edit.select.all=Select All action.edit.deselect.all=Deselect All action.window.cascade=Cascade Windows action.window.tile=Tile Windows action.window.close=Close action.window.close.all=Close action.window.frame=Window action.help.about=About --- NEW FILE: action_fr_FR.properties --- # Actions action.file=Fichier action.file.mnemonic=70 action.edit=Edition action.edit.mnemonic=69 action.tools=Outils action.tools.mnemonic=78 action.options=Options action.options.mnemonic=79 action.help=Aide action.help.mnemonic=65 action.window=Fenêtres action.window.mnemonic=78 # Actions action.file.new=Nouveau action.file.new.mnemonic=78 action.file.new.accelerator=control N action.file.open=Ouvrir action.file.open.mnemonic=79 action.file.open.accelerator=control O action.file.save=Sauver action.file.save.mnemonic=83 action.file.save.accelerator=control S action.file.save.as=Sauver Sous... action.file.exit=Quitter action.file.exit.mnemonic=81 action.file.exit.accelerator=control Q action.file.history=... action.edit.cut=Cut action.edit.copy=Copy action.edit.paste=Paste action.edit.delete=Delete action.edit.delete.selected=Delete Selected action.edit.select.all=Select All action.edit.deselect.all=Deselect All action.window.cascade=Cascade action.window.tile=Pavé action.window.close=Fermer action.window.close.all=Fermer Tout action.window.frame=... action.help.about=A Propos |
Update of /cvsroot/ejtools/libraries/adwt/src/main/net/sourceforge/ejtools/awt/services In directory usw-pr-cvs1:/tmp/cvs-serv9837 Added Files: AboutService.java AboutServiceProvider.java ActionToolBar.java BeanContextInternalFrame.java FrameService.java FrameServiceProvider.java HistoryService.java HistoryServiceProvider.java MDIDesktopPane.java MDIFrameService.java MenuBarService.java MenuBarServiceProvider.java PreferencesService.java SDIFrameService.java StatusBarService.java StatusBarServiceProvider.java ToolBarService.java ToolBarServiceProvider.java Log Message: Initial Import --- NEW FILE: AboutService.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.services; import java.awt.Container; /** * Description of the Class * * @author letiembl * @created 25 octobre 2001 * @todo Javadoc to complete */ public interface AboutService { /** * Description of the Method * * @return The value of panel attribute */ public Container getPanel(); } --- NEW FILE: AboutServiceProvider.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.services; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.GridLayout; import java.beans.beancontext.BeanContextServiceProvider; import java.beans.beancontext.BeanContextServices; import java.beans.beancontext.BeanContextServicesSupport; import java.util.Iterator; import java.util.Vector; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.help.AboutAction; import org.apache.log4j.Category; /** * Description of the Class * * @author letiembl * @created 2 novembre 2001 * @todo Javadoc to complete * @todo I18N to complete */ public class AboutServiceProvider extends BeanContextServicesSupport implements BeanContextServiceProvider, AboutService { /** Description of the Field */ private JPanel panel = null; /** Description of the Field */ private AboutService service = null; /** Description of the Field */ private static Category cat = Category.getInstance(AboutServiceProvider.class.getName()); /** Constructor for the AboutServiceProvider object */ public AboutServiceProvider() { service = this; } /** * Constructor for the AboutServiceProvider object * * @param service Description of Parameter */ public AboutServiceProvider(AboutService service) { this.service = service; } /** * Gets the currentServiceSelectors attribute of the * ApplicationServiceProvider object * * @param bcs Description of Parameter * @param serviceClass Description of Parameter * @return The currentServiceSelectors value */ public Iterator getCurrentServiceSelectors(BeanContextServices bcs, Class serviceClass) { return new Vector().iterator(); } /** * Gets the panel attribute of the AboutServiceProvider object * * @return The panel value */ public Container getPanel() { if (panel == null) { createPanel(); } return panel; } /** * Gets the service attribute of the ApplicationServiceProvider object * * @param bcs Description of Parameter * @param requestor Description of Parameter * @param serviceClass Description of Parameter * @param serviceSelector Description of Parameter * @return The service value */ public Object getService(BeanContextServices bcs, Object requestor, Class serviceClass, Object serviceSelector) { return service; } /** * Description of the Method * * @param bcs Description of Parameter * @param requestor Description of Parameter * @param service Description of Parameter */ public void releaseService(BeanContextServices bcs, Object requestor, Object service) { } /** Description of the Method */ protected void initializeBeanContextResources() { ((BeanContextServices) getBeanContext()).addService(AboutService.class, this); // Add the service getBeanContext().add(service); // Add the About button getBeanContext().add(new AboutAction( new Command() { public void execute() { show(); } } )); cat.debug("AboutService added"); } /** Description of the Method */ protected void releaseBeanContextResources() { ((BeanContextServices) getBeanContext()).revokeService(AboutService.class, this, true); remove(service); cat.debug("AboutService removed"); } /** Description of the Method */ protected void show() { BeanContextServices context = (BeanContextServices) getBeanContext(); if (context.hasService(FrameService.class)) { cat.debug("Using service FrameService..."); try { FrameService fservice = (FrameService) context.getService(this, this, FrameService.class, this, this); JFrame frame = (JFrame) fservice.getContainer(); // I18N Todo JOptionPane.showMessageDialog(frame, service.getPanel(), "About Service", JOptionPane.PLAIN_MESSAGE); context.releaseService(this, this, FrameService.class); } catch (Exception e) { cat.error("Error during utilisation ofgetBeanContext() service FrameService (" + e.getMessage() + ")"); } } } /** Description of the Method */ private void createPanel() { panel = new JPanel(new BorderLayout()); String display = null; JLabel label = null; // North part panel.add("North", new JLabel("Insert your logo here")); // Center part panel.add("Center", new JLabel("This is the default AboutService")); // South part JPanel info = new JPanel(new GridLayout(2, 1)); JLabel java = new JLabel("Java version:" + System.getProperty("java.version"), JLabel.CENTER); java.setForeground(Color.black); info.add(java); JLabel vm = new JLabel("VM:" + System.getProperty("java.vm.name") + ", " + System.getProperty("java.vm.version"), JLabel.CENTER); vm.setForeground(Color.black); info.add(vm); panel.add("South", info); } } --- NEW FILE: ActionToolBar.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.services; import java.util.Hashtable; import javax.swing.Action; import javax.swing.JButton; import javax.swing.JToolBar; /** * Description of the Class * * @author letiembl * @created 2 novembre 2001 * @todo Javadoc to complete */ public class ActionToolBar extends JToolBar { /** Description of the Field */ protected Hashtable buttons = new Hashtable(); /** * Description of the Method * * @param action Description of Parameter * @return Description of the Returned Value */ public JButton add(Action action) { JButton button = super.add(action); this.buttons.put(action, button); return button; } /** * Description of the Method * * @param action Description of Parameter */ public void remove(Action action) { JButton button = (JButton) this.buttons.get(action); this.remove(button); } } --- NEW FILE: BeanContextInternalFrame.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.services; import java.awt.Component; import java.beans.PropertyVetoException; import java.beans.beancontext.BeanContextServices; import java.beans.beancontext.BeanContextServicesSupport; import javax.swing.Action; import javax.swing.ButtonGroup; import javax.swing.JInternalFrame; import javax.swing.event.InternalFrameAdapter; import javax.swing.event.InternalFrameEvent; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; import net.sourceforge.ejtools.awt.action.window.InternalFrameAction; import org.apache.log4j.Category; /** * Description of the Class * * @author letiembl * @created 25 octobre 2001 * @todo Javadoc to complete */ public class BeanContextInternalFrame extends BeanContextServicesSupport { /** Description of the Field */ protected static ButtonGroup group = new ButtonGroup(); private static Category cat = Category.getInstance(BeanContextInternalFrame.class.getName()); /** Description of the Field */ protected JInternalFrame frame; /** Description of the Field */ protected CommandAction action; /** Description of the Field */ protected MDIFrameService service; /** Description of the Field */ protected ViewerManager viewer; /** Constructor for the BeanContextInternalFrame object */ public BeanContextInternalFrame() { } /** * Sets the title attribute of the BeanContextInternalFrame object * * @param title The new title value */ public void setTitle(String title) { frame.setTitle(title); action.putValue(Action.NAME, title); } /** * Gets the component attribute of the BeanContextInternalFrame object * * @return The component value */ public Component getComponent() { return this.frame; } /** * Gets the action attribute of the BeanContextInternalFrame object * * @return The action value */ public CommandAction getAction() { return this.action; } /** Description of the Method */ public void close() { frame.doDefaultCloseAction(); } /** Description of the Method */ protected void initializeBeanContextResources() { cat.info("In initializeBeanContextResources"); BeanContextServices context = (BeanContextServices) getBeanContext(); register(context); frame = new JInternalFrame("", true, true, true, true); viewer = new ViewerManager(); frame.addInternalFrameListener(viewer); frame.setSize(400, 300); if (service != null) { service.register(this); } action = new InternalFrameAction( new Command() { public void execute() { activate(); } }); context.add(action); this.createFrame(); group.add(action.getMenuItem()); frame.setSize(400, 300); frame.validate(); frame.setVisible(true); try { frame.setMaximum(true); } catch (PropertyVetoException e) { } activate(); } /** Description of the Method */ protected void activate() { try { if (service != null) { service.activate(BeanContextInternalFrame.this); } if (action != null) { action.getMenuItem().setSelected(true); } } catch (Exception e) { } } /** * Description of the Method * * @param context Description of Parameter */ protected void register(BeanContextServices context) { if (context.hasService(MDIFrameService.class)) { cat.debug("Using service MDIFrameService..."); try { service = (MDIFrameService) context.getService(this, this, MDIFrameService.class, this.frame, this); cat.debug("Service MDIFrameService registered"); } catch (Exception e) { cat.error("Error during utilisation of service MDIFrameService (" + e.getMessage() + ")"); e.printStackTrace(); } } } /** * Description of the Method * * @param context Description of Parameter */ protected void unregister(BeanContextServices context) { if (context.hasService(MDIFrameService.class)) { cat.debug("Using service MDIFrameService..."); try { context.releaseService(this, this, MDIFrameService.class); } catch (Exception e) { cat.error("Error during utilisation of service MDIFrameService (" + e.getMessage() + ")"); e.printStackTrace(); } } } /** Description of the Method */ protected void releaseBeanContextResources() { cat.info("In releaseBeanContextResources"); BeanContextServices context = (BeanContextServices) getBeanContext(); if (service != null) { service.unregister(this); } group.remove(action.getMenuItem()); context.remove(action); unregister(context); } /** Description of the Method */ protected void createFrame() { } /** * Description of the Method * * @exception Exception Description of Exception */ protected void destroyFrame() throws Exception { } /** * Description of the Class * * @author laurent * @created 12 janvier 2002 */ class ViewerManager extends InternalFrameAdapter { /** * Description of the Method * * @param e Description of Parameter */ public void internalFrameActivated(InternalFrameEvent e) { activate(); } /** * Description of the Method * * @param e Description of Parameter */ public void internalFrameClosed(InternalFrameEvent e) { try { destroyFrame(); setBeanContext(null); } catch (Exception ex) { ex.printStackTrace(); } } } } --- NEW FILE: FrameService.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.services; import java.beans.beancontext.BeanContextContainerProxy; /** * Description of the Class * * @author letiembl * @created 25 octobre 2001 * @todo Javadoc to complete */ public interface FrameService extends BeanContextContainerProxy, MenuBarService.Listener { /** Description of the Field */ public final static String MDI_FRAME = "MDI"; /** Description of the Field */ public final static String SDI_FRAME = "SDI"; /** * Setter for the title attribute * * @param title The new value */ public void setTitle(String title); } --- NEW FILE: FrameServiceProvider.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.services; import java.awt.Container; import java.awt.Dimension; import java.awt.Toolkit; import java.beans.PropertyVetoException; import java.beans.beancontext.BeanContextServiceProvider; import java.beans.beancontext.BeanContextServices; import java.beans.beancontext.BeanContextServicesSupport; import java.util.Iterator; import java.util.Vector; import javax.swing.JFrame; import javax.swing.JInternalFrame; import javax.swing.JMenuBar; import javax.swing.JPanel; import javax.swing.JScrollPane; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; import net.sourceforge.ejtools.awt.action.window.CascadeAction; import net.sourceforge.ejtools.awt.action.window.CloseAction; import net.sourceforge.ejtools.awt.action.window.CloseAllAction; import net.sourceforge.ejtools.awt.action.window.TileAction; import org.apache.log4j.Category; /** * Description of the Class * * @author letiembl * @created 2 novembre 2001 * @todo Javadoc to complete */ public class FrameServiceProvider extends BeanContextServicesSupport implements BeanContextServiceProvider, MDIFrameService, SDIFrameService { private static Category cat = Category.getInstance(FrameServiceProvider.class.getName()); private FrameService service = null; private String type = null; private JFrame frame = new JFrame(); private MDIDesktopPane desktop = new MDIDesktopPane(); private Container content = new JPanel(); private JScrollPane scrollPane = new JScrollPane(); private Vector frames = new Vector(); /** * Constructor for the FrameServiceProvider object * * @param type Description of Parameter */ public FrameServiceProvider(String type) { service = this; this.type = type; } /** * Sets the content attribute of the FrameServiceProvider object * * @param c The new content value */ public void setContent(Container c) { this.content = c; } /** * Setter for the title attribute * * @param title The new value */ public void setTitle(String title) { this.frame.setTitle(title); } /** * Gets the container attribute of the FrameServiceProvider object * * @return The container value */ public Container getContainer() { return this.frame; } /** * Gets the service attribute of the ApplicationServiceProvider object * * @param bcs Description of Parameter * @param requestor Description of Parameter * @param serviceClass Description of Parameter * @param serviceSelector Description of Parameter * @return The service value */ public Object getService(BeanContextServices bcs, Object requestor, Class serviceClass, Object serviceSelector) { if (serviceClass.equals(FrameService.class)) { return (FrameService) service; } if ((serviceClass.equals(MDIFrameService.class)) && (FrameService.MDI_FRAME.equals(this.type))) { return (MDIFrameService) service; } if ((serviceClass.equals(SDIFrameService.class)) && (FrameService.SDI_FRAME.equals(this.type))) { return (SDIFrameService) service; } cat.warn("The requested service doesn't match the current service"); return null; } /** * Gets the currentServiceSelectors attribute of the * ApplicationServiceProvider object * * @param bcs Description of Parameter * @param serviceClass Description of Parameter * @return The currentServiceSelectors value */ public Iterator getCurrentServiceSelectors(BeanContextServices bcs, Class serviceClass) { return new Vector().iterator(); } /** * Gets the activated attribute of the FrameServiceProvider object * * @param frame Description of Parameter * @return The activated value */ public boolean isActivated(BeanContextInternalFrame frame) { JInternalFrame f = desktop.getSelectedFrame(); return f.equals((JInternalFrame) frame.getComponent()); } /** * Gets the activated attribute of the FrameServiceProvider object * * @return The activated value */ public BeanContextInternalFrame getActivated() { Iterator enum = frames.iterator(); while (enum.hasNext()) { Object obj = enum.next(); if (obj instanceof BeanContextInternalFrame) { if (isActivated((BeanContextInternalFrame) obj)) { return ((BeanContextInternalFrame) obj); } } } return null; } /** * Description of the Method * * @param menuBar Description of Parameter */ public void update(JMenuBar menuBar) { this.frame.setJMenuBar(menuBar); this.frame.setVisible(true); } /** * Description of the Method * * @param frame Description of Parameter */ public void register(BeanContextInternalFrame frame) { desktop.add(((JInternalFrame) frame.getComponent())); frames.add(frame); } /** * Description of the Method * * @param frame Description of Parameter */ public void unregister(BeanContextInternalFrame frame) { frames.remove(frame); desktop.remove(((JInternalFrame) frame.getComponent())); } /** * Description of the Method * * @param frame Description of Parameter */ public void activate(BeanContextInternalFrame frame) { desktop.getDesktopManager().activateFrame(((JInternalFrame) frame.getComponent())); try { ((JInternalFrame) frame.getComponent()).setSelected(true); } catch (PropertyVetoException e) { } } /** * Description of the Method * * @param bcs Description of Parameter * @param requestor Description of Parameter * @param service Description of Parameter */ public void releaseService(BeanContextServices bcs, Object requestor, Object service) { } /** * Description of the Method * * @param context Description of Parameter */ protected void register(BeanContextServices context) { // Set up MenuBar if (context.hasService(MenuBarService.class)) { cat.debug("Using service MenuBarService..."); try { MenuBarService service = (MenuBarService) context.getService(this, this, MenuBarService.class, this.frame, this); service.addMenuBarListener(this); } catch (Exception e) { cat.error("Error during utilisation of service MenuBarService (" + e.getMessage() + ")"); e.printStackTrace(); } } // Set up ToolBar if (context.hasService(ToolBarService.class)) { cat.debug("Using service ToolBarService..."); try { ToolBarService service = (ToolBarService) context.getService(this, this, ToolBarService.class, this.frame, this); frame.getContentPane().add("North", service.getContainer()); } catch (Exception e) { cat.error("Error during utilisation of service ToolBarService (" + e.getMessage() + ")"); e.printStackTrace(); } } // Set up StatusBar if (context.hasService(StatusBarService.class)) { cat.debug("Using service StatusBarService..."); try { StatusBarService service = (StatusBarService) context.getService(this, this, StatusBarService.class, this.frame, this); frame.getContentPane().add("South", service.getContainer()); } catch (Exception e) { cat.error("Error during utilisation of service StatusBarService (" + e.getMessage() + ")"); e.printStackTrace(); } } } /** * Description of the Method * * @param context Description of Parameter */ protected void unregister(BeanContextServices context) { } /** Description of the Method */ protected void initializeBeanContextResources() { BeanContextServices context = (BeanContextServices) getBeanContext(); context.addService(FrameService.class, this); context.addService(MDIFrameService.class, this); context.addService(SDIFrameService.class, this); frame.setSize(new Dimension(700, 500)); if (FrameService.MDI_FRAME.equals(this.type)) { scrollPane.getViewport().add(desktop); } else { scrollPane.getViewport().add(content); } frame.getContentPane().add("Center", scrollPane); Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); frame.setLocation(screen.width / 2 - frame.getSize().width / 2, screen.height / 2 - frame.getSize().height / 2); frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); if (FrameService.MDI_FRAME.equals(this.type)) { context.add(new CascadeAction( new Command() { public void execute() { desktop.cascadeFrames(); } } )); context.add(new TileAction( new Command() { public void execute() { desktop.tileFrames(); } } )); context.add(new CloseAction( new Command() { public void execute() { BeanContextInternalFrame frame = getActivated(); if (frame != null) { frame.close(); } } } )); context.add(new CloseAllAction( new Command() { public void execute() { BeanContextInternalFrame frame; while ((frame = getActivated()) != null) { frame.close(); } } } )); } register(context); frame.setVisible(true); cat.debug("FrameService added"); } /** Description of the Method */ protected void releaseBeanContextResources() { BeanContextServices context = (BeanContextServices) getBeanContext(); frame.setVisible(false); unregister(context); context.revokeService(SDIFrameService.class, this, true); context.revokeService(MDIFrameService.class, this, true); context.revokeService(FrameService.class, this, true); cat.debug("FrameService removed"); } } --- NEW FILE: HistoryService.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.services; import java.net.URL; /** * Description of the Class * * @author letiembl * @created 25 octobre 2001 * @todo Javadoc to complete */ public interface HistoryService { /** * Description of the Method * * @param url Description of Parameter * @param context Description of Parameter */ public void push(URL url, Object context); /** * Description of the Class * * @author letiembl * @created 7 novembre 2001 */ public interface Holder { /** * Description of the Method * * @param url Description of Parameter * @param context Description of Parameter */ public void loadResource(URL url, Object context); } } --- NEW FILE: HistoryServiceProvider.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.services; import java.beans.beancontext.BeanContextServiceProvider; import java.beans.beancontext.BeanContextServices; import java.beans.beancontext.BeanContextServicesSupport; import java.net.URL; import java.util.Iterator; import java.util.Vector; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; import net.sourceforge.ejtools.awt.action.file.FileHistoryAction; import net.sourceforge.ejtools.awt.action.file.FileHistoryActionTop; import net.sourceforge.ejtools.util.LimitedStack; import org.apache.log4j.Category; /** * Description of the Class * * @author letiembl * @created 2 novembre 2001 * @todo Javadoc to complete */ public class HistoryServiceProvider extends BeanContextServicesSupport implements BeanContextServiceProvider, HistoryService { private final static int MAX_WIDTH = 30; private static Category cat = Category.getInstance(HistoryServiceProvider.class.getName()); private HistoryService service = null; private LimitedStack stack = null; private Vector menus = null; private HistoryService.Holder holder = null; private int maxHistory; /** * Constructor for the HistoryServiceProvider object * * @param maxHistory Description of Parameter * @param holder Description of Parameter */ public HistoryServiceProvider(HistoryService.Holder holder, int maxHistory) { this.service = this; this.holder = holder; this.maxHistory = maxHistory; this.stack = new LimitedStack(maxHistory); this.menus = new Vector(maxHistory); } /** * Gets the service attribute of the HistoryServiceProvider object * * @param bcs Description of Parameter * @param requestor Description of Parameter * @param serviceClass Description of Parameter * @param serviceSelector Description of Parameter * @return The service value */ public Object getService(BeanContextServices bcs, Object requestor, Class serviceClass, Object serviceSelector) { return service; } /** * Gets the currentServiceSelectors attribute of the HistoryServiceProvider * object * * @param bcs Description of Parameter * @param serviceClass Description of Parameter * @return The currentServiceSelectors value */ public Iterator getCurrentServiceSelectors(BeanContextServices bcs, Class serviceClass) { return new Vector().iterator(); } /** * Description of the Method * * @param bcs Description of Parameter * @param requestor Description of Parameter * @param service Description of Parameter */ public void releaseService(BeanContextServices bcs, Object requestor, Object service) { } /** * Description of the Method * * @param url Description of Parameter * @param context Description of Parameter */ public void push(URL url, Object context) { this.stack.push(new HistoryContext(url, context)); for (int i = 0; i < stack.size(); i++) { HistoryContext hc = (HistoryContext) this.stack.elementAt(i); URL theUrl = hc.getURL(); String s = theUrl.toString(); if (s.length() > MAX_WIDTH) { s = "" + (i + 1) + ": " + theUrl.getProtocol() + "..." + s.substring(s.length() - 25); } else { s = "" + (i + 1) + ": " + theUrl.toString(); } CommandAction action = (CommandAction) menus.elementAt(i); action.putValue(CommandAction.NAME, s); action.setEnabled(true); } } /** Description of the Method */ protected void initializeBeanContextResources() { BeanContextServices context = (BeanContextServices) getBeanContext(); context.addService(HistoryService.class, this); CommandAction action; for (int i = 0; i < this.maxHistory; i++) { if (i == 0) { action = new FileHistoryActionTop( new FileHistoryCommand(i) ); } else { action = new FileHistoryAction( new FileHistoryCommand(i) ); } action.setEnabled(false); menus.add(action); context.add(action); } cat.debug("HistoryService added"); } /** Description of the Method */ protected void releaseBeanContextResources() { BeanContextServices context = (BeanContextServices) getBeanContext(); context.revokeService(HistoryService.class, this, true); cat.debug("HistoryService removed"); } /** * Description of the Class * * @author letiembl * @created 7 novembre 2001 */ private class HistoryContext { private URL url; private Object context; /** * Constructor for the HistoryContext object * * @param url Description of Parameter * @param context Description of Parameter */ public HistoryContext(URL url, Object context) { this.url = url; this.context = context; } /** * Gets the uRL attribute of the HistoryContext object * * @return The uRL value */ public URL getURL() { return this.url; } /** * Gets the context attribute of the HistoryContext object * * @return The context value */ public Object getContext() { return this.context; } /** * Description of the Method * * @param o Description of Parameter * @return Description of the Returned Value */ public boolean equals(Object o) { cat.debug("Object to test " + ((HistoryContext) o).getURL().toString()); cat.debug("The URL " + this.url.toString()); return ((HistoryContext) o).getURL().equals(this.url); } } /** * Description of the Class * * @author letiembl * @created 7 novembre 2001 */ private class FileHistoryCommand implements Command { private int position; /** * Constructor for the FileHistoryCommand object * * @param position Description of Parameter */ public FileHistoryCommand(int position) { this.position = position; } /** Description of the Method */ public void execute() { HistoryContext hc = (HistoryContext) HistoryServiceProvider.this.stack.elementAt(position); cat.info("Loading " + hc.getURL()); HistoryServiceProvider.this.holder.loadResource(hc.getURL(), hc.getContext()); } } } --- NEW FILE: MDIDesktopPane.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.services; import java.awt.Component; import java.awt.Dimension; import java.awt.Insets; import java.awt.Point; import java.beans.PropertyVetoException; import javax.swing.DefaultDesktopManager; import javax.swing.JComponent; import javax.swing.JDesktopPane; import javax.swing.JInternalFrame; import javax.swing.JScrollPane; import javax.swing.JViewport; import javax.swing.filechooser.FileFilter; import org.apache.log4j.Category; /** * An extension of WDesktopPane that supports often used MDI functionality. * This class also handles setting scroll bars for when windows move too far to * the left or bottom, providing the MDIDesktopPane is in a ScrollPane. * * @author laurent * @created 29 décembre 2001 * @todo Javadoc to complete */ public class MDIDesktopPane extends JDesktopPane { private static Category cat = Category.getInstance(MDIDesktopPane.class.getName()); private static int FRAME_OFFSET = 30; private MDIDesktopManager manager; /** Constructor for the MDIDesktopPane object */ public MDIDesktopPane() { manager = new MDIDesktopManager(this); setDesktopManager(manager); setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); } /** * Sets the Bounds attribute of the MDIDesktopPane object * * @param x The new Bounds value * @param y The new Bounds value * @param w The new Bounds value * @param h The new Bounds value */ public void setBounds(int x, int y, int w, int h) { super.setBounds(x, y, w, h); checkDesktopSize(); } /** * Sets all component size properties ( maximum, minimum, preferred) to the * given dimension. * * @param d The new AllSize value */ public void setAllSize(Dimension d) { setMinimumSize(d); setMaximumSize(d); setPreferredSize(d); } /** * Sets all component size properties ( maximum, minimum, preferred) to the * given width and height. * * @param width The new AllSize value * @param height The new AllSize value */ public void setAllSize(int width, int height) { setAllSize(new Dimension(width, height)); } /** * Description of the Method * * @param frame Description of Parameter * @return Description of the Returned Value */ public Component add(JInternalFrame frame) { JInternalFrame[] array = getAllFrames(); Point p; int w; int h; Component retval = super.add(frame); checkDesktopSize(); if (array.length > 0) { p = array[0].getLocation(); p.x = p.x + FRAME_OFFSET; p.y = p.y + FRAME_OFFSET; } else { p = new Point(0, 0); } frame.setLocation(p.x, p.y); if (frame.isResizable()) { w = getWidth() - (getWidth() / 3); h = getHeight() - (getHeight() / 3); if (w < frame.getMinimumSize().getWidth()) { w = (int) frame.getMinimumSize().getWidth(); } if (h < frame.getMinimumSize().getHeight()) { h = (int) frame.getMinimumSize().getHeight(); } frame.setSize(w, h); } moveToFront(frame); frame.setVisible(true); try { frame.setSelected(true); } catch (PropertyVetoException e) { frame.toBack(); } return retval; } /** * Description of the Method * * @param c Description of Parameter */ public void remove(Component c) { super.remove(c); checkDesktopSize(); } /** Cascade all internal frames */ public void cascadeFrames() { int x = 0; int y = 0; JInternalFrame allFrames[] = getAllFrames(); manager.setNormalSize(); int frameHeight = (getBounds().height - 5) - allFrames.length * FRAME_OFFSET; int frameWidth = (getBounds().width - 5) - allFrames.length * FRAME_OFFSET; for (int i = allFrames.length - 1; i >= 0; i--) { allFrames[i].setSize(frameWidth, frameHeight); allFrames[i].setLocation(x, y); x = x + FRAME_OFFSET; y = y + FRAME_OFFSET; } } /** Tile all internal frames */ public void tileFrames() { java.awt.Component allFrames[] = getAllFrames(); manager.setNormalSize(); int frameHeight = getBounds().height / allFrames.length; int y = 0; for (int i = 0; i < allFrames.length; i++) { allFrames[i].setSize(getBounds().width, frameHeight); allFrames[i].setLocation(0, y); y = y + frameHeight; } } /** Description of the Method */ private void checkDesktopSize() { if (getParent() != null && isVisible()) { manager.resizeDesktop(); } } /** * Private class used to replace the standard DesktopManager for * JDesktopPane. Used to provide scrollbar functionality. * * @author laurent * @created 29 décembre 2001 */ class MDIDesktopManager extends DefaultDesktopManager { private MDIDesktopPane desktop; /** * Constructor for the MDIDesktopManager object * * @param desktop Description of Parameter */ public MDIDesktopManager(MDIDesktopPane desktop) { this.desktop = desktop; } /** * Sets the NormalSize attribute of the MDIDesktopManager object */ public void setNormalSize() { JScrollPane scrollPane = getScrollPane(); int x = 0; int y = 0; Insets scrollInsets = getScrollPaneInsets(); if (scrollPane != null) { Dimension d = scrollPane.getVisibleRect().getSize(); if (scrollPane.getBorder() != null) { d.setSize(d.getWidth() - scrollInsets.left - scrollInsets.right, d.getHeight() - scrollInsets.top - scrollInsets.bottom); } d.setSize(d.getWidth() - 20, d.getHeight() - 20); desktop.setAllSize(x, y); scrollPane.invalidate(); scrollPane.validate(); } } /** * Description of the Method * * @param f Description of Parameter */ public void endResizingFrame(JComponent f) { super.endResizingFrame(f); resizeDesktop(); } /** * Description of the Method * * @param f Description of Parameter */ public void endDraggingFrame(JComponent f) { super.endDraggingFrame(f); resizeDesktop(); } /** Description of the Method */ protected void resizeDesktop() { int x = 0; int y = 0; JScrollPane scrollPane = getScrollPane(); Insets scrollInsets = getScrollPaneInsets(); if (scrollPane != null) { JInternalFrame allFrames[] = desktop.getAllFrames(); for (int i = 0; i < allFrames.length; i++) { if (allFrames[i].getX() + allFrames[i].getWidth() > x) { x = allFrames[i].getX() + allFrames[i].getWidth(); } if (allFrames[i].getY() + allFrames[i].getHeight() > y) { y = allFrames[i].getY() + allFrames[i].getHeight(); } } Dimension d = scrollPane.getVisibleRect().getSize(); if (scrollPane.getBorder() != null) { d.setSize(d.getWidth() - scrollInsets.left - scrollInsets.right, d.getHeight() - scrollInsets.top - scrollInsets.bottom); } if (x <= d.getWidth()) { x = ((int) d.getWidth()) - 20; } if (y <= d.getHeight()) { y = ((int) d.getHeight()) - 20; } desktop.setAllSize(x, y); scrollPane.invalidate(); scrollPane.validate(); } } /** * Gets the ScrollPaneInsets attribute of the MDIDesktopManager object * * @return The ScrollPaneInsets value */ private Insets getScrollPaneInsets() { JScrollPane scrollPane = getScrollPane(); if (scrollPane == null) { return new Insets(0, 0, 0, 0); } else { return getScrollPane().getBorder().getBorderInsets(scrollPane); } } /** * Gets the ScrollPane attribute of the MDIDesktopManager object * * @return The ScrollPane value */ private JScrollPane getScrollPane() { if (desktop.getParent() instanceof JViewport) { JViewport viewPort = (JViewport) desktop.getParent(); if (viewPort.getParent() instanceof JScrollPane) { return (JScrollPane) viewPort.getParent(); } } return null; } } } --- NEW FILE: MDIFrameService.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.services; import javax.swing.filechooser.FileFilter; /** * Description of the Class * * @author letiembl * @created 25 octobre 2001 * @todo Javadoc to complete */ public interface MDIFrameService extends FrameService { /** * Description of the Method * * @param frame Description of Parameter */ public void register(BeanContextInternalFrame frame); /** * Description of the Method * * @param frame Description of Parameter */ public void unregister(BeanContextInternalFrame frame); /** * Description of the Method * * @param frame Description of Parameter */ public void activate(BeanContextInternalFrame frame); } --- NEW FILE: MenuBarService.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.services; import javax.swing.JMenuBar; /** * Description of the Class * * @author letiembl * @created 25 octobre 2001 * @todo Javadoc to complete */ public interface MenuBarService extends ToolBarService { /** Description of the Field */ public final static int NO_LAYOUT = 0; /** Description of the Field */ public final static int SEPARATOR_BEFORE = 1; /** Description of the Field */ public final static int SEPARATOR_AFTER = 2; /** * Adds a feature to the MenuBarListener attribute of the MenuBarService * object * * @param mbsl The feature to be added to the MenuBarListener attribute */ public void addMenuBarListener(MenuBarService.Listener mbsl); /** * Description of the Method * * @param mbsl Description of Parameter */ public void removeMenuBarListener(MenuBarService.Listener mbsl); /** * Description of the Class * * @author letiembl * @created 5 novembre 2001 */ public interface Listener { /** * Description of the Method * * @param menuBar Description of Parameter */ public void update(JMenuBar menuBar); } } --- NEW FILE: MenuBarServiceProvider.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.services; import java.awt.Container; import java.awt.Point; import java.awt.event.MouseEvent; import java.beans.beancontext.BeanContextServiceProvider; import java.beans.beancontext.BeanContextServices; import java.beans.beancontext.BeanContextServicesSupport; import java.util.Iterator; import java.util.ResourceBundle; import java.util.Vector; import javax.swing.Action; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; import org.apache.log4j.Category; /** * Description of the Class * * @author letiembl * @created 2 novembre 2001 * @todo Javadoc to complete */ public class MenuBarServiceProvider extends BeanContextServicesSupport implements BeanContextServiceProvider, MenuBarService { private static Category cat = Category.getInstance(MenuBarServiceProvider.class.getName()); /** Description of the Field */ protected Vector requestors = new Vector(); /** Description of the Field */ protected MenuBarService service = null; /** Description of the Field */ protected Vector listeners = new Vector(); /** Description of the Field */ protected JMenuBar menuBar = new JMenuBar(); /** Constructor for the MenuBarServiceProvider object */ public MenuBarServiceProvider() { this.service = this; } /** * Gets the container attribute of the MenuBarServiceProvider object * * @return The container value */ public Container getContainer() { return this.menuBar; } /** * Gets the service attribute of the ApplicationServiceProvider object * * @param bcs Description of Parameter * @param requestor Description of Parameter * @param serviceClass Description of Parameter * @param serviceSelector Description of Parameter * @return The service value */ public Object getService(BeanContextServices bcs, Object requestor, Class serviceClass, Object serviceSelector) { // Check if the requestor has already a service if (!requestors.contains(requestor)) { requestors.add(requestor); } return service; } /** * Gets the currentServiceSelectors attribute of the * ApplicationServiceProvider object * * @param bcs Description of Parameter * @param serviceClass Description of Parameter * @return The currentServiceSelectors value */ public Iterator getCurrentServiceSelectors(BeanContextServices bcs, Class serviceClass) { return new Vector().iterator(); } /** * Adds a feature to the MenuBarListener attribute of the * MenuBarServiceProvider object * * @param mbsl The feature to be added to the MenuBarListener attribute */ public void addMenuBarListener(MenuBarService.Listener mbsl) { this.listeners.add(mbsl); } /** * Description of the Method * * @param mbsl Description of Parameter */ public void removeMenuBarListener(MenuBarService.Listener mbsl) { this.listeners.remove(mbsl); } /** * Description of the Method * * @param action Description of Parameter */ public void register(CommandAction action) { String menuName = action.getMenu(); ResourceBundle res = action.getResourceBundle(); JMenu parent = findMenu(menuName); if (parent == null) { parent = addMenu(res, menuName); } addMenuItem(action, parent); } /** * Description of the Method * * @param action Description of Parameter */ public void unregister(CommandAction action) { String menuName = action.getMenu(); JMenu parent = findMenu(menuName); if (parent == null) { return; } removeMenuItem(action, parent); } /** * Description of the Method * * @param bcs Description of Parameter * @param requestor Description of Parameter * @param service Description of Parameter */ public void releaseService(BeanContextServices bcs, Object requestor, Object service) { } /** Description of the Method */ protected void update() { for (int i = 0; i < this.listeners.size(); i++) { MenuBarService.Listener o = (MenuBarService.Listener) this.listeners.elementAt(i); o.update(this.menuBar); } } /** * Adds a feature to the Menu attribute of the MenuBarServiceProvider object * * @param menuName The feature to be added to the Menu attribute * @param res The feature to be added to the Menu attribute * @return Description of the Returned Value */ protected JMenu addMenu(ResourceBundle res, String menuName) { JMenu menu = new JMenu(res.getString(menuName)); menu.setName(menuName); try { menu.setMnemonic(Integer.parseInt(res.getString(menuName + ".mnemonic"))); } catch (Exception e) { } this.menuBar.add(menu); this.update(); return menu; } /** * Adds a feature to the MenuItem attribute of the MenuBarServiceProvider * object * * @param action The feature to be added to the MenuItem attribute * @param menu The feature to be added to the MenuItem attribute */ protected void addMenuItem(CommandAction action, JMenu menu) { JMenuItem item = action.getMenuItem(); if (action.getMenuLayout() == MenuBarService.SEPARATOR_BEFORE) { if (menu.getItemCount() > 0) { menu.addSeparator(); } } (menu.add(item)).setIcon(null); if (action.getMenuLayout() == MenuBarService.SEPARATOR_AFTER) { menu.addSeparator(); } } /** * Description of the Method * * @param action Description of Parameter * @param menu Description of Parameter */ protected void removeMenuItem(CommandAction action, JMenu menu) { JMenuItem item = action.getMenuItem(); menu.remove(item); } /** * Description of the Method * * @param menuName Description of Parameter * @return Description of the Returned Value */ protected JMenu findMenu(String menuName) { for (int i = 0; i < menuBar.getMenuCount(); i++) { JMenu menu = menuBar.getMenu(i); if (menu.getName().equals(menuName)) { return menu; } } return null; } /** Description of the Method */ protected void initializeBeanContextResources() { ((BeanContextServices) getBeanContext()).addService(MenuBarService.class, this); cat.debug("MenuBarService added"); } /** Description of the Method */ protected void releaseBeanContextResources() { ((BeanContextServices) getBeanContext()).revokeService(MenuBarService.class, this, true); cat.debug("MenuBarService removed"); } /** * Description of the Class * * @author letiembl * @created 6 novembre 2001 */ private final class JMenuItemWithFixedTooltip extends JMenuItem { /** * Constructor for the MenuItemWithFixedTooltip object * * @param action Description of Parameter */ public JMenuItemWithFixedTooltip(Action action) { super(action); } /** * Gets the toolTipLocation attribute of the MenuItemWithFixedTooltip * object * * @param e Description of Parameter * @return The toolTipLocation value */ public Point getToolTipLocation(MouseEvent e) { /* * Graphics g = getGraphics(); * FontMetrics metrics = g.getFontMetrics(g.getFont()); * String prefix = itemnameHistory.size() <= 9 ? "8: " : "88: "; * int prefixWidth = metrics.stringWidth(prefix); * int x = JButton.TRAILING + JButton.LEADING - 1 + prefixWidth; */ return new Point(0, 0); } } } --- NEW FILE: PreferencesService.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.services; /** * Description of the Class * * @author letiembl * @created 25 octobre 2001 * @todo Javadoc to complete */ public interface PreferencesService { /** Description of the Method */ public void show(); /** Description of the Method */ public void load(); /** Description of the Method */ public void save(); } --- NEW FILE: SDIFrameService.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.services; import java.awt.Container; /** * Description of the Class * * @author letiembl * @created 25 octobre 2001 * @todo Javadoc to complete */ public interface SDIFrameService extends FrameService { /** * Sets the content attribute of the SDIFrameService object * * @param c The new content value */ public void setContent(Container c); } --- NEW FILE: StatusBarService.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.services; import java.beans.beancontext.BeanContextContainerProxy; import javax.swing.Icon; import javax.swing.SwingConstants; /** * Description of the Class * * @author letiembl * @created 25 octobre 2001 * @todo Javadoc to complete */ public interface StatusBarService extends BeanContextContainerProxy { /** Description of the Field */ public final int LEFT = SwingConstants.LEFT; /** Description of the Field */ public final int CENTER = SwingConstants.CENTER; /** Description of the Field */ public final int RIGHT = SwingConstants.RIGHT; /** * Adds a feature to the Zone attribute of the StatusBarService object * * @param name The feature to be added to the Zone attribute */ public void addZone(String name); /** * Adds a feature to the Zone attribute of the StatusBarService object * * @param name The feature to be added to the Zone attribute * @param alignement The feature to be added to the Zone attribute */ public void addZone(String name, int alignement); /** * Description of the Method * * @param name Description of Parameter */ public void removeZone(String name); /** * Sets the content attribute of the StatusBarService object * * @param name The new content value * @param text The new content value */ public void setContent(String name, String text); /** * Sets the content attribute of the StatusBarService object * * @param name The new content value * @param icon The new content value */ public void setContent(String name, Icon icon); /** * Sets the content attribute of the StatusBarService object * * @param name The new content value * @param text The new content value * @param icon The new content value */ public void setContent(String name, String text, Icon icon); } --- NEW FILE: StatusBarServiceProvider.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.services; import java.awt.Container; import java.beans.beancontext.BeanContextServiceProvider; import java.beans.beancontext.BeanContextServices; import java.beans.beancontext.BeanContextServicesSupport; import java.util.Iterator; import java.util.Vector; import javax.swing.Icon; import javax.swing.JPanel; import org.apache.log4j.Category; /** * Description of the Class * * @author letiembl * @created 2 novembre 2001 * @todo Javadoc to complete */ public class StatusBarServiceProvider extends BeanContextServicesSupport implements BeanContextServiceProvider, StatusBarService { private static Category cat = Category.getInstance(StatusBarServiceProvider.class.getName()); private StatusBarService service = null; private JPanel panel = new JPanel(); /** Constructor for the StatusBarServiceProvider object */ public StatusBarServiceProvider() { service = this; } /** * Sets the content attribute of the StatusBarServiceProvider object * * @param name The new content value * @param text The new content value */ public void setContent(String name, String text) { } /** * Sets the content attribute of the StatusBarServiceProvider object * * @param name The new content value * @param icon The new content value */ public void setContent(String name, Icon icon) { } /** * Sets the content attribute of the StatusBarServiceProvider object * * @param name The new content value * @param text The new content value * @param icon The new content value */ public void setContent(String name, String text, Icon icon) { } /** * Gets the container attribute of the StatusBarServiceProvider object * * @return The container value */ public Container getContainer() { return this.panel; } /** * Gets the service attribute of the ApplicationServiceProvider object * * @param bcs Description of Parameter * @param requestor Description of Parameter * @param serviceClass Description of Parameter * @param serviceSelector Description of Parameter * @return The service value */ public Object getService(BeanContextServices bcs, Object requestor, Class serviceClass, Object serviceSelector) { return service; } /** * Gets the currentServiceSelectors attribute of the * ApplicationServiceProvider object * * @param bcs Description of Parameter * @param serviceClass Description of Parameter * @return The currentServiceSelectors value */ public Iterator getCurrentServiceSelectors... [truncated message content] |
Update of /cvsroot/ejtools/libraries/adwt/src/main/net/sourceforge/ejtools/awt/editors In directory usw-pr-cvs1:/tmp/cvs-serv9720 Added Files: DateTimeEditor.java NumberEditor.java ObjectNameEditor.java PropertiesEditor.java URLEditor.java Log Message: Initial Import --- NEW FILE: DateTimeEditor.java --- /* * EJT, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.editors; import java.beans.PropertyEditorSupport; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; /** * Description of the Class * * @author letiembl * @created 2 janvier 2002 */ public class DateTimeEditor extends PropertyEditorSupport { /** Description of the Field */ protected DateFormat fmts[]; /** Description of the Field */ private Date date; /** 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"); } /** * Sets the asText attribute of the DateEditor object * * @param s The new asText value */ public void setAsText(String s) { if (s.equals("")) { date = null; return; } String s1 = null; for (int i = 0; i < fmts.length; i++) { try { date = fmts[i].parse(s); firePropertyChange(); return; } catch (ParseException parseexception) { s1 = parseexception.getMessage(); } } throw new IllegalArgumentException(s1); } /** * Sets the value attribute of the DateEditor object * * @param obj The new value value */ public void setValue(Object obj) { date = (Date) obj; } /** * Gets the asText attribute of the DateEditor object * * @return The asText value */ public String getAsText() { if (date != null) { return fmts[0].format(date); } else { return ""; } } /** * Gets the javaInitializationString attribute of the DateEditor object * * @return The javaInitializationString value */ public String getJavaInitializationString() { return "null"; } /** * Gets the value attribute of the DateEditor object * * @return The value value */ public Object getValue() { return date; } } --- NEW FILE: NumberEditor.java --- /* * EJT, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.editors; import java.beans.PropertyEditorSupport; import java.math.BigDecimal; import java.math.BigInteger; /** * Description of the Class * * @author laurent * @created 6 avril 2002 */ public class NumberEditor extends PropertyEditorSupport { /** Description of the Field */ protected Class clazz = Integer.class; /** Description of the Field */ protected Object value; /** Constructor */ public NumberEditor() { value = new Integer(0); } /** * Setter for the asText attribute * * @param s The new value */ public void setAsText(String s) { if (clazz.equals(Integer.class)) { value = new Integer(s); } else { if (clazz.equals(Float.class)) { value = new Float(s); } else { if (clazz.equals(Double.class)) { value = new Double(s); } else { if (clazz.equals(Byte.class)) { value = new Byte(s); } else { if (clazz.equals(Short.class)) { value = new Short(s); } else { if (clazz.equals(Long.class)) { value = new Long(s); } else { } } } } } } firePropertyChange(); } /** * Setter for the value attribute * * @param obj The new value */ public void setValue(Object obj) { value = obj; clazz = obj.getClass(); firePropertyChange(); } /** * Getter for the asText attribute * * @return The value */ public String getAsText() { return value.toString(); } /** * Getter for the value attribute * * @return The value */ public Object getValue() { return value; } } --- NEW FILE: ObjectNameEditor.java --- /* * EJT, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.editors; import java.awt.Component; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyEditorSupport; import javax.management.ObjectName; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SwingUtilities; import net.sourceforge.ejtools.jmx.ObjectNameFinder; /** * Description of the Class * * @author laurent * @created 6 avril 2002 */ public class ObjectNameEditor extends PropertyEditorSupport { /** Description of the Field */ protected JButton button; /** Description of the Field */ protected JPanel panel; /** Description of the Field */ protected JTextField text; /** Description of the Field */ protected Object value; /** Description of the Field */ protected static ImageIcon icon = new ImageIcon(ObjectNameEditor.class.getResource("/toolbarButtonGraphics/general/Bookmarks16.gif")); /** Constructor */ public ObjectNameEditor() { panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); text = new JTextField(20); if (icon != null) { button = new JButton(icon); } else { button = new JButton("View"); } panel.add(button); panel.add(text); panel.add(Box.createHorizontalGlue()); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { ObjectNameFinder finder = (ObjectNameFinder) SwingUtilities.getAncestorOfClass(ObjectNameFinder.class, panel); if ((finder != null) && (value != null)) { finder.searchObjectName(value.toString()); } } } ); } /** * Getter for the asText attribute * * @return The value */ public String getAsText() { return value.toString(); } /** * Gets the customEditor attribute of the ObjectNameEditor object * * @return The customEditor value */ public Component getCustomEditor() { return panel; } /** * Getter for the value attribute * * @return The value */ public Object getValue() { return value; } /** * Setter for the asText attribute * * @param s The new value */ public void setAsText(String s) { try { value = new ObjectName(s); } catch (Exception e) { } text.setText(value.toString()); firePropertyChange(); } /** * Setter for the value attribute * * @param obj The new value */ public void setValue(Object obj) { value = obj; text.setText(value.toString()); firePropertyChange(); } /** * Description of the Method * * @return Description of the Return Value */ public boolean supportsCustomEditor() { return true; } } --- NEW FILE: PropertiesEditor.java --- /* * EJT, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.editors; import java.beans.PropertyEditorSupport; import java.awt.Component; import java.util.Properties; import javax.swing.JTable; import javax.swing.table.AbstractTableModel; /** *Description of the Class * * @author letiembl * @created 19 octobre 2001 */ public class PropertiesEditor extends PropertyEditorSupport { protected Object value; public PropertiesEditor() { value = new Properties(); } public void setAsText(String s) { firePropertyChange(); } public void setValue(Object obj) { firePropertyChange(); } public String getAsText() { return value.toString(); } public Component getCustomEditor() { return new PropertiesView(); } /** *Gets the value attribute of the FileEditor object * * @return The value value */ public Object getValue() { return value; } /** *Description of the Method * * @return Description of the Returned Value */ public boolean supportsCustomEditor() { return true; } /** *Description of the Class * * @author letiembl * @created 19 octobre 2001 */ class PropertiesView extends JTable { } } --- NEW FILE: URLEditor.java --- /* * EJT, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.editors; import java.beans.PropertyEditorSupport; import java.net.URL; /** * Description of the Class * * @author laurent * @created 6 avril 2002 */ public class URLEditor extends PropertyEditorSupport { /** Description of the Field */ protected Object value; /** Constructor */ public URLEditor() { } /** * Getter for the asText attribute * * @return The value */ public String getAsText() { return value.toString(); } /** * Getter for the value attribute * * @return The value */ public Object getValue() { return value; } /** * Setter for the asText attribute * * @param s The new value */ public void setAsText(String s) { try { value = new URL(s); } catch (Exception e) { } firePropertyChange(); } /** * Setter for the value attribute * * @param obj The new value */ public void setValue(Object obj) { value = obj; firePropertyChange(); } } |
From: Laurent E. <let...@us...> - 2002-04-18 21:09:53
|
Update of /cvsroot/ejtools/libraries/adwt/src/main/net/sourceforge/ejtools/awt/action/file In directory usw-pr-cvs1:/tmp/cvs-serv9585/file Added Files: ExitAction.java FileHistoryAction.java FileHistoryActionTop.java NewAction.java OpenAction.java PrintAction.java SaveAction.java SaveAsAction.java Log Message: Initial Import --- NEW FILE: ExitAction.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action.file; import java.util.ResourceBundle; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; import net.sourceforge.ejtools.awt.services.MenuBarService; /** * Description of the Class * * @author laurent * @created 29 décembre 2001 * @todo Javadoc to complete */ public class ExitAction extends CommandAction { private final static ResourceBundle res = ResourceBundle.getBundle("action"); /** * @param command The exit command that the action should act upon. */ public ExitAction(Command command) { super(command, res, "action.file.exit"); this.setMenu("action.file"); this.setMenuMnemonic("action.file.exit.mnemonic"); this.setMenuAccelerator("action.file.exit.accelerator"); this.setMenuLayout(MenuBarService.SEPARATOR_BEFORE); } } --- NEW FILE: FileHistoryAction.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action.file; import java.util.ResourceBundle; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; /** * Description of the Class * * @author laurent * @created 29 décembre 2001 * @todo Javadoc to complete */ public class FileHistoryAction extends CommandAction { private final static ResourceBundle res = ResourceBundle.getBundle("action"); /** * Constructor for the CloseAction object * * @param command Description of Parameter */ public FileHistoryAction(Command command) { super(command, res, "action.file.history"); this.setMenu("action.file"); } } --- NEW FILE: FileHistoryActionTop.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action.file; import java.util.ResourceBundle; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; import net.sourceforge.ejtools.awt.services.MenuBarService; /** * Description of the Class * * @author laurent * @created 29 décembre 2001 * @todo Javadoc to complete */ public class FileHistoryActionTop extends CommandAction { private final static ResourceBundle res = ResourceBundle.getBundle("action"); /** * Constructor for the CloseAction object * * @param command Description of Parameter */ public FileHistoryActionTop(Command command) { super(command, res, "action.file.history"); this.setMenu("action.file"); this.setMenuLayout(MenuBarService.SEPARATOR_BEFORE); } } --- NEW FILE: NewAction.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action.file; import java.util.ResourceBundle; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; /** * Description of the Class * * @author laurent * @created 29 décembre 2001 * @todo Javadoc to complete */ public class NewAction extends CommandAction { private final static ResourceBundle res = ResourceBundle.getBundle("action"); /** * Constructor for the NewAction object * * @param command Description of Parameter */ public NewAction(Command command) { super(command, res, "action.file.new"); this.setMenu("action.file"); this.setMenuMnemonic("action.file.new.mnemonic"); this.setMenuAccelerator("action.file.new.accelerator"); this.setToolBar(true); this.setIcon("/toolbarButtonGraphics/general/New24.gif"); } } --- NEW FILE: OpenAction.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action.file; import java.util.ResourceBundle; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; /** * Description of the Class * * @author laurent * @created 29 décembre 2001 * @todo Javadoc to complete */ public class OpenAction extends CommandAction { private final static ResourceBundle res = ResourceBundle.getBundle("action"); /** * Constructor for the OpenAction object * * @param command Description of Parameter */ public OpenAction(Command command) { super(command, res, "action.file.open"); this.setMenu("action.file"); this.setToolBar(true); this.setIcon("/toolbarButtonGraphics/general/Open24.gif"); } } --- NEW FILE: PrintAction.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action.file; import java.util.ResourceBundle; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; /** * Description of the Class * * @author laurent * @created 18 mars 2002 * @todo Javadoc to complete */ public class PrintAction extends CommandAction { private final static ResourceBundle res = ResourceBundle.getBundle("action"); /** * Constructor for the PrintAction object * * @param command Description of Parameter */ public PrintAction(Command command) { super(command, res, "action.file.print"); this.setMenu("action.file"); this.setToolBar(true); this.setIcon("/toolbarButtonGraphics/general/Print24.gif"); } } --- NEW FILE: SaveAction.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action.file; import java.util.ResourceBundle; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; /** * Description of the Class * * @author laurent * @created 29 décembre 2001 * @todo Javadoc to complete */ public class SaveAction extends CommandAction { private final static ResourceBundle res = ResourceBundle.getBundle("action"); /** * Constructor for the SaveAction object * * @param command Description of Parameter */ public SaveAction(Command command) { super(command, res, "action.file.save"); this.setMenu("action.file"); this.setToolBar(true); this.setIcon("/toolbarButtonGraphics/general/Save24.gif"); } } --- NEW FILE: SaveAsAction.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action.file; import java.util.ResourceBundle; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; /** * Description of the Class * * @author laurent * @created 29 décembre 2001 * @todo Javadoc to complete */ public class SaveAsAction extends CommandAction { private final static ResourceBundle res = ResourceBundle.getBundle("action"); /** * Constructor for the SaveAsAction object * * @param command Description of Parameter */ public SaveAsAction(Command command) { super(command, res, "action.file.save.as"); this.setMenu("action.file"); } } |
From: Laurent E. <let...@us...> - 2002-04-18 21:09:53
|
Update of /cvsroot/ejtools/libraries/adwt/src/main/net/sourceforge/ejtools/awt/action/edit In directory usw-pr-cvs1:/tmp/cvs-serv9585/edit Added Files: CopyAction.java CutAction.java DeleteSelectedAction.java DeselectAllAction.java PasteAction.java SelectAllAction.java Log Message: Initial Import --- NEW FILE: CopyAction.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action.edit; import java.util.ResourceBundle; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; /** * Description of the Class * * @author laurent * @created 29 décembre 2001 * @todo Javadoc to complete */ public class CopyAction extends CommandAction { private final static ResourceBundle res = ResourceBundle.getBundle("action"); /** * Constructor for the CopyAction object * * @param command Description of Parameter */ public CopyAction(Command command) { super(command, res, "action.edit.copy"); this.setMenu("action.edit"); this.setToolBar(true); this.setIcon("/toolbarButtonGraphics/general/Copy24.gif"); } } --- NEW FILE: CutAction.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action.edit; import java.util.ResourceBundle; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; /** * Description of the Class * * @author laurent * @created 29 décembre 2001 * @todo Javadoc to complete */ public class CutAction extends CommandAction { private final static ResourceBundle res = ResourceBundle.getBundle("action"); /** * Constructor for the CutAction object * * @param command Description of Parameter */ public CutAction(Command command) { super(command, res, "action.edit.cut"); this.setMenu("action.edit"); this.setToolBar(true); this.setIcon("/toolbarButtonGraphics/general/Cut24.gif"); } } --- NEW FILE: DeleteSelectedAction.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action.edit; import java.util.ResourceBundle; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; /** * Description of the Class * * @author laurent * @created 29 décembre 2001 * @todo Javadoc to complete */ public class DeleteSelectedAction extends CommandAction { private final static ResourceBundle res = ResourceBundle.getBundle("action"); /** * Constructor for the DeleteSelectedAction object * * @param command Description of Parameter */ public DeleteSelectedAction(Command command) { super(command, res, "action.edit.delete.selected"); this.setMenu("action.edit"); } } --- NEW FILE: DeselectAllAction.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action.edit; import java.util.ResourceBundle; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; /** * Description of the Class * * @author laurent * @created 29 décembre 2001 * @todo Javadoc to complete */ public class DeselectAllAction extends CommandAction { private final static ResourceBundle res = ResourceBundle.getBundle("action"); /** * Constructor for the DeselectAllAction object * * @param command Description of Parameter */ public DeselectAllAction(Command command) { super(command, res, "action.edit.deselect.all"); this.setMenu("action.edit"); } } --- NEW FILE: PasteAction.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action.edit; import java.util.ResourceBundle; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; /** * Description of the Class * * @author laurent * @created 29 décembre 2001 * @todo Javadoc to complete */ public class PasteAction extends CommandAction { private final static ResourceBundle res = ResourceBundle.getBundle("action"); /** * Constructor for the PasteAction object * * @param command Description of Parameter */ public PasteAction(Command command) { super(command, res, "action.edit.paste"); this.setMenu("action.edit"); this.setToolBar(true); this.setIcon("/toolbarButtonGraphics/general/Paste24.gif"); } } --- NEW FILE: SelectAllAction.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action.edit; import java.util.ResourceBundle; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; /** * Description of the Class * * @author laurent * @created 29 décembre 2001 * @todo Javadoc to complete */ public class SelectAllAction extends CommandAction { private final static ResourceBundle res = ResourceBundle.getBundle("action"); /** * Constructor for the SelectAllAction object * * @param command Description of Parameter */ public SelectAllAction(Command command) { super(command, res, "action.edit.select.all"); this.setMenu("action.edit"); } } |
Update of /cvsroot/ejtools/libraries/adwt/src/main/net/sourceforge/ejtools/awt/action/window In directory usw-pr-cvs1:/tmp/cvs-serv9585/window Added Files: CascadeAction.java CloseAction.java CloseAllAction.java InternalFrameAction.java TileAction.java Log Message: Initial Import --- NEW FILE: CascadeAction.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action.window; import java.util.ResourceBundle; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; /** * Description of the Class * * @author laurent * @created 29 décembre 2001 * @todo Javadoc to complete */ public class CascadeAction extends CommandAction { private final static ResourceBundle res = ResourceBundle.getBundle("action"); /** * Constructor for the CascadeAction object * * @param command Description of Parameter */ public CascadeAction(Command command) { super(command, res, "action.window.cascade"); this.setMenu("action.window"); } } --- NEW FILE: CloseAction.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action.window; import java.util.ResourceBundle; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; import net.sourceforge.ejtools.awt.services.MenuBarService; /** * Description of the Class * * @author laurent * @created 29 décembre 2001 * @todo Javadoc to complete */ public class CloseAction extends CommandAction { private final static ResourceBundle res = ResourceBundle.getBundle("action"); /** * Constructor for the CloseAction object * * @param command Description of Parameter */ public CloseAction(Command command) { super(command, res, "action.window.close"); this.setMenu("action.window"); } } --- NEW FILE: CloseAllAction.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action.window; import java.util.ResourceBundle; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; import net.sourceforge.ejtools.awt.services.MenuBarService; /** * Description of the Class * * @author laurent * @created 11 janvier 2002 * @todo Javadoc to complete */ public class CloseAllAction extends CommandAction { private final static ResourceBundle res = ResourceBundle.getBundle("action"); /** * Constructor for the CascadeAction object * * @param command Description of Parameter */ public CloseAllAction(Command command) { super(command, res, "action.window.close.all"); this.setMenu("action.window"); this.setMenuLayout(MenuBarService.SEPARATOR_AFTER); } } --- NEW FILE: InternalFrameAction.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action.window; import java.util.ResourceBundle; import javax.swing.JMenuItem; import javax.swing.JRadioButtonMenuItem; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; /** * Description of the Class * * @author laurent * @created 29 décembre 2001 * @todo Javadoc to complete */ public class InternalFrameAction extends CommandAction { private final static ResourceBundle res = ResourceBundle.getBundle("action"); /** * Constructor for the InternalFrameAction object * * @param command Description of Parameter */ public InternalFrameAction(Command command) { super(command, res, "action.window.frame"); this.setMenu("action.window"); } /** * Gets the menuItem attribute of the InternalFrameAction object * * @return The menuItem value */ public JMenuItem getMenuItem() { if (menuitem == null) { menuitem = new JRadioButtonMenuItem(this); } return this.menuitem; } } --- NEW FILE: TileAction.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action.window; import java.util.ResourceBundle; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; /** * Description of the Class * * @author laurent * @created 29 décembre 2001 * @todo Javadoc to complete */ public class TileAction extends CommandAction { private final static ResourceBundle res = ResourceBundle.getBundle("action"); /** * Constructor for the TileAction object * * @param command Description of Parameter */ public TileAction(Command command) { super(command, res, "action.window.tile"); this.setMenu("action.window"); } } |
From: Laurent E. <let...@us...> - 2002-04-18 21:09:52
|
Update of /cvsroot/ejtools/libraries/adwt/src/main/net/sourceforge/ejtools/awt/action In directory usw-pr-cvs1:/tmp/cvs-serv9585 Added Files: Command.java CommandAction.java Log Message: Initial Import --- NEW FILE: Command.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action; /** * Interface needed to implement to Command Pattern. * * @author laurent * @created 29 décembre 2001 */ public interface Command { /** Method to implement with the action. */ public void execute(); } --- NEW FILE: CommandAction.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action; import java.awt.event.ActionEvent; import java.beans.PropertyChangeListener; import java.beans.beancontext.BeanContextChildSupport; import java.beans.beancontext.BeanContextServiceAvailableEvent; import java.beans.beancontext.BeanContextServiceRevokedEvent; import java.beans.beancontext.BeanContextServices; import java.util.ResourceBundle; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JMenuItem; import javax.swing.KeyStroke; import net.sourceforge.ejtools.awt.services.MenuBarService; import net.sourceforge.ejtools.awt.services.ToolBarService; import org.apache.log4j.Category; /** * Description of the Class * * @author letiembl * @created 2 novembre 2001 * @todo Javadoc to complete */ public class CommandAction extends BeanContextChildSupport implements Action { private static Category cat = Category.getInstance(CommandAction.class.getName()); /** Description of the Field */ protected boolean inToolBar = false; /** Description of the Field */ protected String menu = null; /** Description of the Field */ protected int menuMnemonic = 0; /** Description of the Field */ protected String menuAccelerator = null; /** Description of the Field */ protected int menuLayout = MenuBarService.NO_LAYOUT; /** Description of the Field */ protected String icon = null; /** Description of the Field */ protected AbstractAction action = null; /** Description of the Field */ protected Command command; /** Description of the Field */ protected JMenuItem menuitem; /** Description of the Field */ protected ResourceBundle res; /** * Constructor for the CommandAction object * * @param command Description of Parameter * @param name Description of Parameter * @param res Description of Parameter */ public CommandAction(Command command, ResourceBundle res, String name) { this.setCommand(command); this.setResourceBundle(res); this.action = new AbstractAction(res.getString(name)) { public void actionPerformed(ActionEvent e) { getCommand().execute(); } }; } /** * Sets the enabled attribute of the CommandAction object * * @param b The new enabled value */ public void setEnabled(boolean b) { this.action.setEnabled(b); } /** * Constructor for the setIcon object * * @param icon Description of Parameter */ public final void setIcon(String icon) { if ((icon != null) && (!"".equals(icon))) { try { Icon image = new ImageIcon(getClass().getResource(icon)); this.putValue(Action.SMALL_ICON, image); } catch (Exception e) { } } } /** * Constructor for the setMenu object * * @param menu Description of Parameter */ public final void setMenu(String menu) { if ((menu != null) && (!"".equals(menu))) { this.menu = menu; } } /** * Setter for the menuMnemonic attribute * * @param menuMnemonic The new value for menuMnemonic attribute */ public final void setMenuMnemonic(String menuMnemonic) { if ((menu != menuMnemonic) && (!"".equals(menuMnemonic))) { this.menuMnemonic = Integer.parseInt(res.getString(menuMnemonic)); } } /** * Setter for the menuAccelerator attribute * * @param menuAccelerator The new value for menuAccelerator attribute */ public final void setMenuAccelerator(String menuAccelerator) { if ((menu != menuAccelerator) && (!"".equals(menuAccelerator))) { this.menuAccelerator = res.getString(menuAccelerator); } } /** * Sets the menuLayout attribute of the CommandAction object * * @param menuLayout The new menuLayout value */ public final void setMenuLayout(int menuLayout) { this.menuLayout = menuLayout; } /** * Sets the toolBar attribute of the CommandAction object * * @param inToolBar The new toolBar value */ public final void setToolBar(boolean inToolBar) { this.inToolBar = inToolBar; } /** * Gets the value attribute of the CommandAction object * * @param key Description of Parameter * @return The value value */ public Object getValue(String key) { return this.action.getValue(key); } /** * Getter for the resourceBundle attribute * * @return The value of resourceBundle attribute */ public ResourceBundle getResourceBundle() { return this.res; } /** * Gets the enabled attribute of the CommandAction object * * @return The enabled value */ public boolean isEnabled() { return this.action.isEnabled(); } /** * Gets the menu attribute of the CommandAction object * * @return The menu value */ public final String getMenu() { return this.menu; } /** * Gets the menuLayout attribute of the CommandAction object * * @return The menuLayout value */ public final int getMenuLayout() { return this.menuLayout; } /** * Gets the toolbar attribute of the CommandAction object * * @return The toolbar value */ public final boolean getToolBar() { return this.inToolBar; } /** * Getter for the menuItem attribute * * @return The value */ public JMenuItem getMenuItem() { if (this.menuitem == null) { this.menuitem = new JMenuItem(this); if (this.menuMnemonic != 0) { this.menuitem.setMnemonic(this.menuMnemonic); } if (this.menuAccelerator != null) { this.menuitem.setAccelerator(KeyStroke.getKeyStroke(menuAccelerator)); } } return this.menuitem; } /** * Description of the Method * * @param key Description of Parameter * @param value Description of Parameter */ public void putValue(String key, Object value) { this.action.putValue(key, value); } /** * Adds a feature to the PropertyChangeListener attribute of the * CommandAction object * * @param listener The feature to be added to the PropertyChangeListener * attribute */ public void addPropertyChangeListener(PropertyChangeListener listener) { this.action.addPropertyChangeListener(listener); } /** * Description of the Method * * @param listener Description of Parameter */ public void removePropertyChangeListener(PropertyChangeListener listener) { this.action.removePropertyChangeListener(listener); } /** * Description of the Method * * @param bcsre Description of Parameter */ public void serviceRevoked(BeanContextServiceRevokedEvent bcsre) { } /** * actionPerformed is what executed the command. actionPerformed is called * whenever the action is acted upon. * * @param e the action event */ public void actionPerformed(ActionEvent e) { this.action.actionPerformed(e); } /** * Description of the Method * * @param bcsae Description of Parameter */ public void serviceAvailable(BeanContextServiceAvailableEvent bcsae) { } /** * This method sets the action's command object. * * @param newValue the command for this action to act upon */ protected final void setCommand(Command newValue) { this.command = newValue; } /** * Setter for the resourceBundle attribute * * @param newValue The new value for resourceBundle attribute */ protected final void setResourceBundle(ResourceBundle newValue) { this.res = newValue; } /** * This method retrieves the encapsulated command. * * @return Command */ protected final Command getCommand() { return this.command; } /** Description of the Method */ protected void initializeBeanContextResources() { BeanContextServices context = (BeanContextServices) getBeanContext(); this.register(context); } /** Description of the Method */ protected void releaseBeanContextResources() { BeanContextServices context = (BeanContextServices) getBeanContext(); this.unregister(context); } /** * Description of the Method * * @param context Description of Parameter */ protected void register(BeanContextServices context) { // Set up MenuBar if ((context.hasService(MenuBarService.class)) && (this.menu != null) && (!"".equals(this.menu))) { cat.debug("Using service MenuBarService..."); try { MenuBarService service = (MenuBarService) context.getService(this, this, MenuBarService.class, this, this); service.register(this); } catch (Exception e) { cat.error("Error during utilisation of service MenuBarService (" + e.getMessage() + ")"); e.printStackTrace(); } } // Set up ToolBar if ((context.hasService(ToolBarService.class)) && this.inToolBar) { cat.debug("Using service ToolBarService..."); try { ToolBarService service = (ToolBarService) context.getService(this, this, ToolBarService.class, this, this); service.register(this); } catch (Exception e) { cat.error("Error during utilisation of service ToolBarService (" + e.getMessage() + ")"); e.printStackTrace(); } } } /** * Description of the Method * * @param context Description of Parameter */ protected void unregister(BeanContextServices context) { // Set up MenuBar if ((context.hasService(MenuBarService.class)) && (this.menu != null) && (!"".equals(this.menu))) { cat.debug("Using service MenuBarService..."); try { MenuBarService service = (MenuBarService) context.getService(this, this, MenuBarService.class, this, this); service.unregister(this); } catch (Exception e) { cat.error("Error during utilisation of service MenuBarService (" + e.getMessage() + ")"); e.printStackTrace(); } } // Set up ToolBar if ((context.hasService(ToolBarService.class)) && inToolBar) { cat.debug("Using service ToolBarService..."); try { ToolBarService service = (ToolBarService) context.getService(this, this, ToolBarService.class, this, this); service.unregister(this); } catch (Exception e) { cat.error("Error during utilisation of service ToolBarService (" + e.getMessage() + ")"); e.printStackTrace(); } } } } |
From: Laurent E. <let...@us...> - 2002-04-18 21:09:52
|
Update of /cvsroot/ejtools/libraries/adwt/src/main/net/sourceforge/ejtools/awt/action/help In directory usw-pr-cvs1:/tmp/cvs-serv9585/help Added Files: AboutAction.java HelpOnLineAction.java TOTDAction.java Log Message: Initial Import --- NEW FILE: AboutAction.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action.help; import java.util.ResourceBundle; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; /** * Description of the Class * * @author laurent * @created 29 décembre 2001 * @todo Javadoc to complete */ public class AboutAction extends CommandAction { private final static ResourceBundle res = ResourceBundle.getBundle("action"); /** * @param command The exit command that the action should act upon. */ public AboutAction(Command command) { super(command, res, "action.help.about"); this.setMenu("action.help"); this.setToolBar(true); this.setIcon("/toolbarButtonGraphics/general/About24.gif"); } } --- NEW FILE: HelpOnLineAction.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action.help; import java.util.ResourceBundle; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; /** * Description of the Class * * @author laurent * @created 29 décembre 2001 * @todo Javadoc to complete */ public class HelpOnLineAction extends CommandAction { private final static ResourceBundle res = ResourceBundle.getBundle("action"); /** * Constructor for the HelpOnLineAction object * * @param command Description of Parameter */ public HelpOnLineAction(Command command) { super(command, res, "action.help.online"); this.setMenu("action.help"); this.setToolBar(true); this.setIcon("/toolbarButtonGraphics/general/Help24.gif"); } } --- NEW FILE: TOTDAction.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package net.sourceforge.ejtools.awt.action.help; import java.util.ResourceBundle; import net.sourceforge.ejtools.awt.action.Command; import net.sourceforge.ejtools.awt.action.CommandAction; /** * Description of the Class * * @author laurent * @created 29 décembre 2001 * @todo Javadoc to complete */ public class TOTDAction extends CommandAction { private final static ResourceBundle res = ResourceBundle.getBundle("action"); /** * Constructor for the TOTDAction object * * @param command Description of Parameter */ public TOTDAction(Command command) { super(command, res, "action.help.totd"); this.setMenu("action.help"); this.setToolBar(true); this.setIcon("/toolbarButtonGraphics/general/TipOfTheDay24.gif"); } } |
From: Laurent E. <let...@us...> - 2002-04-18 21:08:38
|
Update of /cvsroot/ejtools/libraries/adwt/src/main/net/sourceforge/ejtools/awt/action/window In directory usw-pr-cvs1:/tmp/cvs-serv9230/window Log Message: Directory /cvsroot/ejtools/libraries/adwt/src/main/net/sourceforge/ejtools/awt/action/window added to the repository |
From: Laurent E. <let...@us...> - 2002-04-18 21:08:24
|
Update of /cvsroot/ejtools/libraries/adwt/src/main/net/sourceforge/ejtools/awt/action/help In directory usw-pr-cvs1:/tmp/cvs-serv9167/help Log Message: Directory /cvsroot/ejtools/libraries/adwt/src/main/net/sourceforge/ejtools/awt/action/help added to the repository |
From: Laurent E. <let...@us...> - 2002-04-18 21:08:10
|
Update of /cvsroot/ejtools/libraries/adwt/src/main/net/sourceforge/ejtools/awt/action/file In directory usw-pr-cvs1:/tmp/cvs-serv9088/file Log Message: Directory /cvsroot/ejtools/libraries/adwt/src/main/net/sourceforge/ejtools/awt/action/file added to the repository |
From: Laurent E. <let...@us...> - 2002-04-18 21:08:04
|
Update of /cvsroot/ejtools/libraries/adwt/src/main/net/sourceforge In directory usw-pr-cvs1:/tmp/cvs-serv8607/sourceforge Log Message: Directory /cvsroot/ejtools/libraries/adwt/src/main/net/sourceforge added to the repository |
From: Laurent E. <let...@us...> - 2002-04-18 21:08:04
|
Update of /cvsroot/ejtools/libraries/adwt/src/main/net In directory usw-pr-cvs1:/tmp/cvs-serv8484/net Log Message: Directory /cvsroot/ejtools/libraries/adwt/src/main/net added to the repository |
From: Laurent E. <let...@us...> - 2002-04-18 21:08:04
|
Update of /cvsroot/ejtools/libraries/adwt/src/resources In directory usw-pr-cvs1:/tmp/cvs-serv8355/resources Log Message: Directory /cvsroot/ejtools/libraries/adwt/src/resources added to the repository |