You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(25) |
Oct
(12) |
Nov
(26) |
Dec
(24) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(2) |
Feb
(89) |
Mar
(82) |
Apr
(13) |
May
|
Jun
|
Jul
(2) |
Aug
(16) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
(1) |
Feb
(2) |
Mar
(6) |
Apr
(2) |
May
(4) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: JP <j-...@us...> - 2008-02-25 21:20:42
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/framework In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv26742/src/main/java/org/swixat/framework Modified Files: Tag: B0_6_0 SingleOutputView.java Log Message: Fixes a bug with single-instance windows and threaded commands (ie, "thread:command" constructs). Index: SingleOutputView.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/Attic/SingleOutputView.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** SingleOutputView.java 25 Feb 2008 09:42:01 -0000 1.1.2.1 --- SingleOutputView.java 25 Feb 2008 21:20:37 -0000 1.1.2.2 *************** *** 15,20 **** private String windowKey; ! public SingleOutputView(String view, Context context, String windowKey) { ! super(view, context); this.windowKey = windowKey; } --- 15,20 ---- private String windowKey; ! public SingleOutputView(String view, String windowKey) { ! super(view); this.windowKey = windowKey; } |
|
From: JP <j-...@us...> - 2008-02-25 21:20:42
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/commands In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv26742/src/main/java/org/swixat/commands Modified Files: Tag: B0_6_0 SingleWindowCommand.java Log Message: Fixes a bug with single-instance windows and threaded commands (ie, "thread:command" constructs). Index: SingleWindowCommand.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/commands/Attic/SingleWindowCommand.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** SingleWindowCommand.java 25 Feb 2008 09:42:01 -0000 1.1.2.1 --- SingleWindowCommand.java 25 Feb 2008 21:20:37 -0000 1.1.2.2 *************** *** 27,31 **** CommandBinder cb = (CommandBinder) SwiXAT.getFactory().getBean(command); String view = cb.getOutput(); ! return new SingleOutputView(view, context, command); } } --- 27,31 ---- CommandBinder cb = (CommandBinder) SwiXAT.getFactory().getBean(command); String view = cb.getOutput(); ! return new SingleOutputView(view, command); } } |
|
From: JP <j-...@us...> - 2008-02-25 09:42:06
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/commands In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv7549/src/main/java/org/swixat/commands Added Files: Tag: B0_6_0 SingleWindowCommand.java Log Message: Added support for single-instance windows -- window frames that are instantiated only once, even after multiple invocations. Good for help system windows and the like. Usage: <bean id="help" class="org.swixat.commands.CommandBinder"> <property name="type"> <value>org.swixat.commands.SingleWindowCommand</value> </property> <property name="output"> <value>help.xml</value> </property> </bean> When the "help" command is invoked in this example, the window frame described by help.xml will only instantiate itself once, even after multiple invocations. --- NEW FILE: SingleWindowCommand.java --- /** * $Id: SingleWindowCommand.java,v 1.1.2.1 2008/02/25 09:42:01 j--p Exp $ * */ package org.swixat.commands; import org.swixat.SwiXAT; import org.swixat.framework.SingleOutputView; import org.swixat.framework.action.ThreadAction; import org.swixat.model.Context; import org.swixat.util.SwiXUtil; import java.awt.event.ActionEvent; /** * SingleWindowCommand. */ public class SingleWindowCommand implements GuiCommand { public Object execute(Object params) { Context context = (Context) params; ActionEvent ae = (ActionEvent) context.getData("_arg"); String command = ae.getActionCommand(); if (SwiXUtil.startsWithIgnoreCase(command, ThreadAction.THREAD)) { command = command.substring(ThreadAction.THREAD.length()); } CommandBinder cb = (CommandBinder) SwiXAT.getFactory().getBean(command); String view = cb.getOutput(); return new SingleOutputView(view, context, command); } } |
|
From: JP <j-...@us...> - 2008-02-25 09:42:05
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/framework In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv7549/src/main/java/org/swixat/framework Modified Files: Tag: B0_6_0 IndependentFrame.java Added Files: Tag: B0_6_0 SingleOutputView.java Log Message: Added support for single-instance windows -- window frames that are instantiated only once, even after multiple invocations. Good for help system windows and the like. Usage: <bean id="help" class="org.swixat.commands.CommandBinder"> <property name="type"> <value>org.swixat.commands.SingleWindowCommand</value> </property> <property name="output"> <value>help.xml</value> </property> </bean> When the "help" command is invoked in this example, the window frame described by help.xml will only instantiate itself once, even after multiple invocations. Index: IndependentFrame.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/IndependentFrame.java,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -C2 -d -r1.5 -r1.5.2.1 *** IndependentFrame.java 2 Oct 2006 21:48:35 -0000 1.5 --- IndependentFrame.java 25 Feb 2008 09:42:01 -0000 1.5.2.1 *************** *** 5,133 **** package org.swixat.framework; - import java.awt.event.*; - import javax.swing.*; - import java.awt.*; - import java.util.Map; import org.swixat.SwiXAT; import org.swixat.model.Context; /** * @author Paolo Marrone - * */ public class IndependentFrame extends AbstractFrame implements WindowListener { ! ! private JFrame gui; ! ! public JFrame getFrame() { ! return gui; ! } ! ! /** ! * Shows the frame defined into the XML passed as parameter. ! * @param view - the new view to show ! */ ! public void init(OutputView view) { ! this.init(view, null); ! } ! ! /** ! * Shows the frame defined into the XML passed as parameter. ! * @param view - the new view to show ! * @param parentIdMap - the calling frame's idMap ! */ ! public void init(OutputView view, Context parentContext) { ! gui = (JFrame)super.initFrame(view, parentContext); ! int retValue = frameOpened(null); ! if (retValue == 0) { ! gui.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); ! gui.addWindowListener(this); ! Container root = getXmlEngine().getRootComponent(); ! getXmlEngine().setActionListener(gui, this); ! // gui.pack(); ! gui.setVisible(true); ! } ! } ! ! public void initAndNotShow(OutputView view) { ! initAndNotShow(view, null); ! } ! ! public void initAndNotShow(OutputView view, Context parentContext) { ! gui = (JFrame)super.initFrame(view, parentContext); ! gui.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); ! gui.addWindowListener(this); ! getXmlEngine().setActionListener(gui, this); ! } ! ! public JMenu createLookAndFeel() { ! ! UIManager.LookAndFeelInfo[] lafs = UIManager.getInstalledLookAndFeels(); ! JMenu menu = new JMenu("Look and Feel"); ! menu.setMnemonic(KeyEvent.VK_L); ! JMenuItem mi = null; ! ! for (int i = 0; i < lafs.length; i++) { ! mi = new JMenuItem(lafs[i].getName()); ! final String lnfClassName = lafs[i].getClassName(); ! mi.addActionListener( ! new ActionListener() { ! public void actionPerformed(ActionEvent event) { ! newLookAndFeel(lnfClassName); ! } ! }); ! menu.add(mi); ! } ! return menu; ! } ! ! private void newLookAndFeel(String landf) { ! try { ! UIManager.setLookAndFeel(landf); ! SwingUtilities.updateComponentTreeUI(gui); ! } catch (Exception e) { ! e.printStackTrace(); ! } ! } ! ! public void viewOutput(OutputView view) { ! JComponent desktop = null; ! Application app = (Application)SwiXAT.getFactory().getBean("application"); ! desktop = (JComponent)getXmlEngine().getIdMap().get(app.getDesktopPane()); ! if (desktop != null) ! new InternalFrame().init(getFrame(), desktop, view, getActualContext()); ! else ! new IndependentFrame().init(view, getActualContext()); ! } ! ! public void windowClosing(WindowEvent e) { ! int retValue = frameClosing(e); ! if (retValue == 0) ! getFrame().dispose(); ! } ! ! public void windowOpened(WindowEvent e) { ! // frameOpened(e); ! } ! ! public void windowActivated(WindowEvent e) { ! frameActivated(e); ! } ! ! public void windowClosed(WindowEvent e) { ! frameClosed(e); ! } ! ! public void windowIconified(WindowEvent e) { ! frameIconified(e); ! } ! ! public void windowDeiconified(WindowEvent e) { ! frameDeiconified(e); ! } ! ! public void windowDeactivated(WindowEvent e) { ! frameDeactivated(e); ! } ! } --- 5,161 ---- package org.swixat.framework; import org.swixat.SwiXAT; import org.swixat.model.Context; + import javax.swing.*; + import java.awt.event.*; + import java.util.Hashtable; + import java.util.Map; + /** * @author Paolo Marrone */ public class IndependentFrame extends AbstractFrame implements WindowListener { ! ! // use Hashtable for thread safety, & don't use generics so we can allow backward-compatability w/pre-1.5 jdks ! // map of strings (windowkeys) to jframes (windows) ! private static final Map SINGLE_INSTANCE_WINDOWS = new Hashtable(); ! private boolean singleFrame = false; ! private JFrame gui; ! ! public JFrame getFrame() { ! return gui; ! } ! ! /** ! * Shows the frame defined into the XML passed as parameter. ! * ! * @param view - the new view to show ! */ ! public void init(OutputView view) { ! this.init(view, null); ! } ! ! /** ! * Shows the frame defined into the XML passed as parameter. ! * ! * @param view - the new view to show ! * @param parentIdMap - the calling frame's idMap ! */ ! public void init(OutputView view, Context parentContext) { ! if (view instanceof SingleOutputView) { ! SingleOutputView sView = (SingleOutputView) view; ! singleFrame = true; ! // need locking / synchronization code here? ! String windowKey = sView.getWindowKey(); ! gui = (JFrame) SINGLE_INSTANCE_WINDOWS.get(windowKey); ! if (gui == null) { ! gui = (JFrame) super.initFrame(view, parentContext); ! SINGLE_INSTANCE_WINDOWS.put(windowKey, gui); ! if (frameOpened(null) == 0) { ! gui.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); ! gui.addWindowListener(this); ! getXmlEngine().setActionListener(gui, this); ! } ! } ! gui.setVisible(true); ! } else { ! gui = (JFrame) super.initFrame(view, parentContext); ! // not sure whether to include this code after the first time a single window is invoked... ! int retValue = frameOpened(null); ! if (retValue == 0) { ! gui.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); ! gui.addWindowListener(this); ! getXmlEngine().setActionListener(gui, this); ! // gui.pack(); ! gui.setVisible(true); ! } ! } ! } ! ! public void initAndNotShow(OutputView view) { ! initAndNotShow(view, null); ! } ! ! public void initAndNotShow(OutputView view, Context parentContext) { ! gui = (JFrame) super.initFrame(view, parentContext); ! gui.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); ! gui.addWindowListener(this); ! getXmlEngine().setActionListener(gui, this); ! } ! ! public JMenu createLookAndFeel() { ! ! UIManager.LookAndFeelInfo[] lafs = UIManager.getInstalledLookAndFeels(); ! JMenu menu = new JMenu("Look and Feel"); ! menu.setMnemonic(KeyEvent.VK_L); ! JMenuItem mi = null; ! ! for (int i = 0; i < lafs.length; i++) { ! mi = new JMenuItem(lafs[i].getName()); ! final String lnfClassName = lafs[i].getClassName(); ! mi.addActionListener( ! new ActionListener() { ! public void actionPerformed(ActionEvent event) { ! newLookAndFeel(lnfClassName); ! } ! }); ! menu.add(mi); ! } ! return menu; ! } ! ! private void newLookAndFeel(String landf) { ! try { ! UIManager.setLookAndFeel(landf); ! SwingUtilities.updateComponentTreeUI(gui); ! } catch (Exception e) { ! e.printStackTrace(); ! } ! } ! ! public void viewOutput(OutputView view) { ! JComponent desktop = null; ! Application app = (Application) SwiXAT.getFactory().getBean("application"); ! desktop = (JComponent) getXmlEngine().getIdMap().get(app.getDesktopPane()); ! if (desktop != null) ! new InternalFrame().init(getFrame(), desktop, view, getActualContext()); ! else ! new IndependentFrame().init(view, getActualContext()); ! } ! ! public void windowClosing(WindowEvent e) { ! int retValue = frameClosing(e); ! if (retValue == 0) { ! if (!singleFrame) ! getFrame().dispose(); ! else ! getFrame().setVisible(false); ! } ! } ! ! public void windowOpened(WindowEvent e) { ! // frameOpened(e); ! } ! ! public void windowActivated(WindowEvent e) { ! frameActivated(e); ! } ! ! public void windowClosed(WindowEvent e) { ! frameClosed(e); ! } ! ! public void windowIconified(WindowEvent e) { ! frameIconified(e); ! } ! ! public void windowDeiconified(WindowEvent e) { ! frameDeiconified(e); ! } ! ! public void windowDeactivated(WindowEvent e) { ! frameDeactivated(e); ! } ! } --- NEW FILE: SingleOutputView.java --- /** * $Id: SingleOutputView.java,v 1.1.2.1 2008/02/25 09:42:01 j--p Exp $ * */ package org.swixat.framework; import org.swixat.model.Context; /** * SingleOutputView. */ public class SingleOutputView extends OutputView { private String windowKey; public SingleOutputView(String view, Context context, String windowKey) { super(view, context); this.windowKey = windowKey; } public String getWindowKey() { return windowKey; } } |
|
From: JP <j-...@us...> - 2008-02-25 09:42:05
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/action In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv7549/src/main/java/org/swixat/framework/action Modified Files: Tag: B0_6_0 ThreadAction.java Log Message: Added support for single-instance windows -- window frames that are instantiated only once, even after multiple invocations. Good for help system windows and the like. Usage: <bean id="help" class="org.swixat.commands.CommandBinder"> <property name="type"> <value>org.swixat.commands.SingleWindowCommand</value> </property> <property name="output"> <value>help.xml</value> </property> </bean> When the "help" command is invoked in this example, the window frame described by help.xml will only instantiate itself once, even after multiple invocations. Index: ThreadAction.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/action/ThreadAction.java,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** ThreadAction.java 11 Jul 2007 22:36:22 -0000 1.2.2.1 --- ThreadAction.java 25 Feb 2008 09:42:00 -0000 1.2.2.2 *************** *** 40,50 **** * This action is just a prefix to other action. this permit action execution * in new thread. ThreadAction can wait for end of real action or no ! * <li> thread:... execute action ... in new thread and return 0 without * wait the result * <li> stopCommand to ask the end of thread action ! * * during thread action all commands asked by another thread is intercepted by ! * this action and not done. (example: button click by user) ! * * @author poussin * --- 40,50 ---- * This action is just a prefix to other action. this permit action execution * in new thread. ThreadAction can wait for end of real action or no ! * <li> thread:... execute action ... in new thread and return 0 without * wait the result * <li> stopCommand to ask the end of thread action ! * * during thread action all commands asked by another thread is intercepted by ! * this action and not done. (example: button click by user) ! * * @author poussin * *************** *** 57,72 **** private static final Log log = LogFactory.getLog(ThreadAction.class); ! private final static String THREAD = "thread:"; private final static String STOP_COMMAND = "stopcommand"; ! /** true if doCommand method looking for real command*/ private final static String THREAD_ACTION_LOOKING_FOR_ACTION = "THREAD_ACTION_LOOKING_FOR_ACTION"; /** true during command execution */ ! ! /** * use frame context to store THREAD_ACTION_DOCOMMAND to permit other ! * frame to work correctly ! * ! * @param frame * @return */ --- 57,72 ---- private static final Log log = LogFactory.getLog(ThreadAction.class); ! public final static String THREAD = "thread:"; private final static String STOP_COMMAND = "stopcommand"; ! /** true if doCommand method looking for real command*/ private final static String THREAD_ACTION_LOOKING_FOR_ACTION = "THREAD_ACTION_LOOKING_FOR_ACTION"; /** true during command execution */ ! ! /** * use frame context to store THREAD_ACTION_DOCOMMAND to permit other ! * frame to work correctly ! * ! * @param frame * @return */ *************** *** 75,82 **** return result; } ! /** * use frame context to store THREAD_ACTION_DOCOMMAND to permit other ! * frame to work correctly * @param frame * @param value --- 75,82 ---- return result; } ! /** * use frame context to store THREAD_ACTION_DOCOMMAND to permit other ! * frame to work correctly * @param frame * @param value *************** *** 85,97 **** frame.getActualContext().setThreadCommand(value); } ! private boolean isLookingForAction(AbstractFrame frame) { Boolean result = (Boolean)frame.getActualContext().getData(THREAD_ACTION_LOOKING_FOR_ACTION); return result != null && result.booleanValue(); } ! /** * use frame context to store THREAD_ACTION_DOCOMMAND to permit other ! * frame to work correctly * @param frame * @param value --- 85,97 ---- frame.getActualContext().setThreadCommand(value); } ! private boolean isLookingForAction(AbstractFrame frame) { Boolean result = (Boolean)frame.getActualContext().getData(THREAD_ACTION_LOOKING_FOR_ACTION); return result != null && result.booleanValue(); } ! /** * use frame context to store THREAD_ACTION_DOCOMMAND to permit other ! * frame to work correctly * @param frame * @param value *************** *** 100,108 **** frame.getActualContext().setData(THREAD_ACTION_LOOKING_FOR_ACTION, Boolean.valueOf(value)); } ! /** * if thread action already in doCommand then accept all command and * do nothing while the threaded command is not finished ! * * @see org.swixat.framework.action.Action#accept(java.lang.Object, org.swixat.framework.AbstractFrame, java.lang.String, java.lang.Object) */ --- 100,108 ---- frame.getActualContext().setData(THREAD_ACTION_LOOKING_FOR_ACTION, Boolean.valueOf(value)); } ! /** * if thread action already in doCommand then accept all command and * do nothing while the threaded command is not finished ! * * @see org.swixat.framework.action.Action#accept(java.lang.Object, org.swixat.framework.AbstractFrame, java.lang.String, java.lang.Object) */ *************** *** 110,114 **** Object arg) { boolean result = false; ! if (STOP_COMMAND.equalsIgnoreCase(command)) { // accept all time stopCommand --- 110,114 ---- Object arg) { boolean result = false; ! if (STOP_COMMAND.equalsIgnoreCase(command)) { // accept all time stopCommand *************** *** 123,127 **** result = Thread.currentThread() != getThreadCommand(frame); } ! return result; } --- 123,127 ---- result = Thread.currentThread() != getThreadCommand(frame); } ! return result; } *************** *** 136,140 **** return Integer.valueOf(0); } ! // after thread command control. During thread execution other // command is not acceptable --- 136,140 ---- return Integer.valueOf(0); } ! // after thread command control. During thread execution other // command is not acceptable *************** *** 143,147 **** return Integer.valueOf(1); } ! // remove thread: substring command = command.substring(THREAD.length()); --- 143,147 ---- return Integer.valueOf(1); } ! // remove thread: substring command = command.substring(THREAD.length()); *************** *** 153,167 **** setLookingForAction(frame, false); } ! Object result = null; if (action != null) { frame.beginCommand(command); ! ActionWorker aw = new ActionWorker(action, caller, frame, command, arg); aw.setPriority(Thread.MIN_PRIORITY); setThreadCommand(frame, aw); aw.start(); result = Integer.valueOf(0); ! } return result; } --- 153,167 ---- setLookingForAction(frame, false); } ! Object result = null; if (action != null) { frame.beginCommand(command); ! ActionWorker aw = new ActionWorker(action, caller, frame, command, arg); aw.setPriority(Thread.MIN_PRIORITY); setThreadCommand(frame, aw); aw.start(); result = Integer.valueOf(0); ! } return result; } *************** *** 183,187 **** } ! public class ActionWorker extends Thread { --- 183,187 ---- } ! public class ActionWorker extends Thread { *************** *** 191,197 **** protected String command; protected Object arg; ! protected Object result; ! public ActionWorker(Action action, Object caller, AbstractFrame frame, String command, Object arg) { this.action = action; --- 191,197 ---- protected String command; protected Object arg; ! protected Object result; ! public ActionWorker(Action action, Object caller, AbstractFrame frame, String command, Object arg) { this.action = action; *************** *** 201,205 **** this.arg = arg; } ! /* (non-Javadoc) * @see java.lang.Thread#run() --- 201,205 ---- this.arg = arg; } ! /* (non-Javadoc) * @see java.lang.Thread#run() *************** *** 216,220 **** } } ! /** * @return Returns the result. --- 216,220 ---- } } ! /** * @return Returns the result. *************** *** 225,229 **** } ! } --- 225,229 ---- } ! } |
|
From: JP <j-...@us...> - 2007-07-11 22:36:26
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/action In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv32136 Modified Files: Tag: B0_6_0 ThreadAction.java Log Message: Fix that allows threaded actions that return OutputViews (ie, actions that are launching new frames) to work correctly. Index: ThreadAction.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/action/ThreadAction.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** ThreadAction.java 2 Oct 2006 21:48:35 -0000 1.2 --- ThreadAction.java 11 Jul 2007 22:36:22 -0000 1.2.2.1 *************** *** 33,36 **** --- 33,37 ---- import org.apache.commons.logging.LogFactory; import org.swixat.framework.AbstractFrame; + import org.swixat.framework.OutputView; import org.swixat.util.SwiXUtil; *************** *** 207,210 **** --- 208,214 ---- try { result = action.doCommand(caller, frame, command, arg); + if (result instanceof OutputView) { + frame.viewOutput((OutputView)result); + } } finally { setThreadCommand(frame, null); |
|
From: JP <j-...@us...> - 2007-05-07 08:40:25
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/widget In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv5763/src/main/java/org/swixat/widget Modified Files: Tag: B0_6_0 MemoryStatus.java Log Message: Initialize progress bar string to "" so that a percent number doesn't temporarily appear. Index: MemoryStatus.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/widget/MemoryStatus.java,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -C2 -d -r1.2.2.2 -r1.2.2.3 *** MemoryStatus.java 5 May 2007 06:29:54 -0000 1.2.2.2 --- MemoryStatus.java 7 May 2007 08:40:22 -0000 1.2.2.3 *************** *** 47,50 **** --- 47,51 ---- super(); setStringPainted(true); + setString(""); } |
|
From: JP <j-...@us...> - 2007-05-05 06:29:57
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/widget In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv27826/src/main/java/org/swixat/widget Modified Files: Tag: B0_6_0 MemoryStatus.java FadeLabel.java Log Message: Added some javadoc. Index: MemoryStatus.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/widget/MemoryStatus.java,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** MemoryStatus.java 5 May 2007 06:19:18 -0000 1.2.2.1 --- MemoryStatus.java 5 May 2007 06:29:54 -0000 1.2.2.2 *************** *** 36,40 **** /** ! * Progress bar-like display of the VM's used vs. total memory. */ --- 36,40 ---- /** ! * Progress bar-like display showing the VM's used vs. total memory. */ *************** *** 42,45 **** --- 42,46 ---- private Timer timer; + private int interval = 2000; public MemoryStatus() { *************** *** 58,64 **** } public void addNotify() { super.addNotify(); ! timer = new Timer(2000, this); timer.start(); } --- 59,79 ---- } + /** + * @return timer interval in milliseconds + */ + public int getInterval() { + return interval; + } + + /** + * @param interval - timer interval in milliseconds + */ + public void setInterval(int interval) { + this.interval = interval; + } + public void addNotify() { super.addNotify(); ! timer = new Timer(interval, this); timer.start(); } Index: FadeLabel.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/widget/Attic/FadeLabel.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** FadeLabel.java 5 May 2007 06:19:20 -0000 1.1.2.1 --- FadeLabel.java 5 May 2007 06:29:54 -0000 1.1.2.2 *************** *** 64,79 **** --- 64,91 ---- } + /** + * @return foreground color of label text prior to fade effect + */ public Color getInitialForeground() { return initialForeground; } + /** + * @param initialForeground - foreground color of label text prior to fade effect + */ public void setInitialForeground(Color initialForeground) { this.initialForeground = initialForeground; } + /** + * @return delay in milliseconds + */ public int getDelay() { return delay; } + /** + * @param delay in milliseconds + */ public void setDelay(int delay) { if (delay > 0) { |
|
From: JP <j-...@us...> - 2007-05-05 06:19:24
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/widget In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv22588/src/main/java/org/swixat/widget Modified Files: Tag: B0_6_0 MemoryStatus.java Added Files: Tag: B0_6_0 FadeLabel.java Log Message: - Enhanced and simplified the MemoryStatus widget. - Added FadeLabel widget - a JLabel whose text fades away after a specified delay. Suitable for status bars and other such temporary displays. Index: MemoryStatus.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/widget/MemoryStatus.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** MemoryStatus.java 2 Oct 2006 21:48:36 -0000 1.2 --- MemoryStatus.java 5 May 2007 06:19:18 -0000 1.2.2.1 *************** *** 30,97 **** package org.swixat.widget; ! import java.awt.Color; ! import java.awt.Dimension; ! import java.awt.Font; ! import java.awt.Graphics; ! import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; - import java.awt.font.FontRenderContext; - import java.awt.font.LineMetrics; - import java.awt.geom.Rectangle2D; - - import javax.swing.JComponent; - import javax.swing.JLabel; - import javax.swing.Timer; /** ! * ! * Display memory free and used in small panel. ! * ! * Code based on JEdit widget ! * ! * Copyright: Slava Pestov <sl...@je...> ! * ! * You are free to distribute this software under the terms of ! * the GNU General Public License. ! * ! * @author poussin ! * */ ! public class MemoryStatus extends JComponent implements ActionListener { ! ! private LineMetrics lm; - private final static String memoryTestStr = "99999/99999Mb"; - private Color progressBackground; - private Color progressForeground; private Timer timer; - public MemoryStatus() { ! Font font = (new JLabel()).getFont(); ! setFont(font); ! FontRenderContext frc = new FontRenderContext(null, false, false); ! Rectangle2D bounds = font.getStringBounds("99999/99999Mb", frc); ! Dimension dim = new Dimension((int)bounds.getWidth(), (int)bounds.getHeight()); ! setMinimumSize(dim); ! setPreferredSize(dim); ! lm = font.getLineMetrics(memoryTestStr, frc); ! setForeground(Color.BLACK); ! setBackground(Color.WHITE); ! progressForeground = Color.decode("#cccccc"); ! progressBackground = Color.decode("#666699a"); } - /** - * called by timer - */ public void actionPerformed(ActionEvent evt) { ! repaint(); } - /** Adds a feature to the Notify attribute of the MemoryStatus object */ public void addNotify() { super.addNotify(); --- 30,61 ---- package org.swixat.widget; ! import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** ! * Progress bar-like display of the VM's used vs. total memory. */ ! public class MemoryStatus extends JProgressBar implements ActionListener { private Timer timer; public MemoryStatus() { ! super(); ! setStringPainted(true); } public void actionPerformed(ActionEvent evt) { ! Runtime runtime = Runtime.getRuntime(); ! int freeMemory = (int) (runtime.freeMemory() / 1024L / 1024L); ! int totalMemory = (int) (runtime.totalMemory() / 1024L / 1024L); ! int usedMemory = totalMemory - freeMemory; ! setMaximum(totalMemory); ! setValue(usedMemory); ! setString(usedMemory + "M of " + totalMemory + "M"); } public void addNotify() { super.addNotify(); *************** *** 105,141 **** } - public void paintComponent(Graphics g) { - Insets insets = new Insets(0, 0, 0, 0); - Runtime runtime = Runtime.getRuntime(); - int freeMemory = (int)(runtime.freeMemory() / 1024L); - int totalMemory = (int)(runtime.totalMemory() / 1024L); - int usedMemory = totalMemory - freeMemory; - int width = getWidth() - insets.left - insets.right; - int height = getHeight() - insets.top - insets.bottom - 1; - float fraction = (float)usedMemory / (float)totalMemory; - g.setColor(progressBackground); - g.fillRect(insets.left, insets.top, (int)((float)width * fraction), height); - String str = usedMemory / 1024 + "/" + totalMemory / 1024 + "Mb"; - FontRenderContext frc = new FontRenderContext(null, false, false); - Rectangle2D bounds = g.getFont().getStringBounds(str, frc); - Graphics g2 = g.create(); - g2.setClip(insets.left, insets.top, (int)((float)width * fraction), height); - g2.setColor(progressForeground); - g2.drawString(str, - insets.left + (int)((double)width - bounds.getWidth()) / 2, - (int)((float)insets.top + lm.getAscent() + ((double)height - bounds.getHeight()) / 2.0 )); - g2.dispose(); - g2 = g.create(); - g2.setClip(insets.left + (int)((float)width * fraction), - insets.top, getWidth() - insets.left - (int)((float)width * fraction), - height); - g2.setColor(getForeground()); - g2.drawString(str, - insets.left + (int)((double)width - bounds.getWidth()) / 2, - (int)((float)insets.top + lm.getAscent() + ((double)height - bounds.getHeight()) / 2.0)); - g2.dispose(); - } - } --- 69,74 ---- } } + --- NEW FILE: FadeLabel.java --- /* *##% * Copyright (C) 2006 * Paolo Marrone, Benjamin Poussin and the SwiXAT team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *##%*/ /* * * FadeLabel.java * * Created: 30 mars 2006 02:31:47 * * @author JP * @version $Revision: 1.1.2.1 $ * * Last update: $Date: 2007/05/05 06:19:20 $ * by : $Author: j--p $ */ package org.swixat.widget; import org.swixat.framework.MessageFadeTimer; import javax.swing.*; import java.awt.*; /** * A JLabel whose text fades away after a specified delay. * Suitable for status bars and other such temporary displays. */ public class FadeLabel extends JLabel { private int delay = 3000; private MessageFadeTimer messageFader = null; private Color initialForeground; public FadeLabel() { super(); initialForeground = getForeground(); } public void setText(String messageText) { super.setText(messageText); if (initialForeground != null) { // cancel fader if already running if (messageFader != null) { messageFader.cancel(); } setForeground(initialForeground); // fadeout message after a few seconds messageFader = new MessageFadeTimer(this, delay); messageFader.start(); } } public Color getInitialForeground() { return initialForeground; } public void setInitialForeground(Color initialForeground) { this.initialForeground = initialForeground; } public int getDelay() { return delay; } public void setDelay(int delay) { if (delay > 0) { this.delay = delay; } } } |
|
From: JP <j-...@us...> - 2007-05-05 06:19:24
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/framework In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv22588/src/main/java/org/swixat/framework Modified Files: Tag: B0_6_0 TagLibraryExt.java Log Message: - Enhanced and simplified the MemoryStatus widget. - Added FadeLabel widget - a JLabel whose text fades away after a specified delay. Suitable for status bars and other such temporary displays. Index: TagLibraryExt.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/TagLibraryExt.java,v retrieving revision 1.6.2.1 retrieving revision 1.6.2.2 diff -C2 -d -r1.6.2.1 -r1.6.2.2 *** TagLibraryExt.java 18 Feb 2007 13:42:43 -0000 1.6.2.1 --- TagLibraryExt.java 5 May 2007 06:19:20 -0000 1.6.2.2 *************** *** 36,39 **** --- 36,40 ---- newTags.put("DocumentEvents", org.swixat.commands.DocumentEvents.class.getName()); newTags.put("DOMDataSource", org.swixat.databinding.DOMDataSource.class.getName()); + newTags.put("FadeLabel", org.swixat.widget.FadeLabel.class.getName()); newTags.put("FocusEvents", org.swixat.commands.FocusEvents.class.getName()); newTags.put("HyperlinkEvents", org.swixat.commands.HyperlinkEvents.class.getName()); |
|
From: JP <j-...@us...> - 2007-04-02 00:45:30
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/action In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv32656/src/main/java/org/swixat/framework/action Modified Files: Tag: B0_6_0 HandleScriptFunctionAction.java Log Message: Catch and log xpath runtime exceptions. Index: HandleScriptFunctionAction.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/action/HandleScriptFunctionAction.java,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -C2 -d -r1.2.2.2 -r1.2.2.3 *** HandleScriptFunctionAction.java 21 Mar 2007 02:34:14 -0000 1.2.2.2 --- HandleScriptFunctionAction.java 2 Apr 2007 00:45:26 -0000 1.2.2.3 *************** *** 31,34 **** --- 31,35 ---- import org.apache.commons.jxpath.JXPathContext; + import org.apache.commons.jxpath.JXPathException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; *************** *** 115,123 **** String fnArg = args[a].trim(); if (fnArg.startsWith("$")) { // process arg as an xpath expression ! Object result = XPathUtil.applyXPath(fnArg, null, engine, false); String argname = "_fn_arg_" + a; i.setVariable(argname, result); argList.append(argname); ! } else { argList.append(fnArg); } --- 116,129 ---- String fnArg = args[a].trim(); if (fnArg.startsWith("$")) { // process arg as an xpath expression ! Object result = null; ! try { ! result = XPathUtil.applyXPath(fnArg, null, engine, false); ! } catch (JXPathException xe) { ! log.error("Failed to process xpath expression " + fnArg, xe); ! } String argname = "_fn_arg_" + a; i.setVariable(argname, result); argList.append(argname); ! } else { // process a literal argument argList.append(fnArg); } |
|
From: JP <j-...@us...> - 2007-04-02 00:36:25
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/framework In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv29447/src/main/java/org/swixat/framework Modified Files: Tag: B0_6_0 ActionMonitor.java Added Files: Tag: B0_6_0 MessageFadeTimer.java Log Message: Wanted to use MessageFadeTimer independent of ActionMonitor, so I broke it out into its own class file and made it public. Index: ActionMonitor.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/ActionMonitor.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** ActionMonitor.java 2 Oct 2006 21:48:35 -0000 1.2 --- ActionMonitor.java 2 Apr 2007 00:36:20 -0000 1.2.2.1 *************** *** 308,369 **** } - - class MessageFadeTimer extends Thread { - - /** - * Logger for this class - */ - private final Log log = LogFactory.getLog(MessageFadeTimer.class); - - long wait = 0; - boolean cancel = false; - JComponent msg; - Color currentForeground; - - public MessageFadeTimer(JComponent msg, long wait) { - this.wait = wait; - this.msg = msg; - currentForeground = getMessageForeground(); - } - public void cancel() { - cancel = true; - } - public boolean isCanceled() { - return cancel; - } - public void run() { - if (msg != null) { - try { - Thread.sleep(wait); - - int alpha = currentForeground.getAlpha(); - while (!cancel && alpha >= 0) { - alpha -= 25; - if (alpha < 0) { - alpha = 0; - } - final Color newColor = new Color(currentForeground.getRed(), - currentForeground.getGreen(), - currentForeground.getBlue(), - alpha); - final JComponent msg = this.msg; - SwingUtilities.invokeLater(new Runnable(){ - public void run() { - if (!isCanceled()) { - msg.setForeground(newColor); - } - }; - }); - Thread.sleep(200); - } - } catch (InterruptedException eee) { - if (log.isTraceEnabled()) { - log.trace("thread interrupted", eee); - } - } - } - } - } - class ProgressStartTimer extends Thread { long wait = 0; --- 308,311 ---- --- NEW FILE: MessageFadeTimer.java --- /* *##% * Copyright (C) 2006 * Paolo Marrone, Benjamin Poussin and the SwiXAT team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *##%*/ /* * * ActionMonitor.java * * Created: 28 mars 2006 15:19:01 * * @author poussin * @version $Revision: 1.1.2.1 $ * * Last update: $Date: 2007/04/02 00:36:20 $ * by : $Author: j--p $ */ package org.swixat.framework; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.swing.*; import java.awt.*; /** * Fadeout effect for component text labels. * * @author poussin */ public class MessageFadeTimer extends Thread { /** * Logger for this class */ private final Log log = LogFactory.getLog(MessageFadeTimer.class); long wait = 0; boolean cancel = false; JComponent msg; Color currentForeground; public MessageFadeTimer(JComponent msg, long wait) { this.wait = wait; this.msg = msg; currentForeground = msg.getForeground(); } public void cancel() { cancel = true; } public boolean isCanceled() { return cancel; } public void run() { if (msg != null) { try { Thread.sleep(wait); int alpha = currentForeground.getAlpha(); while (!cancel && alpha >= 0) { alpha -= 25; if (alpha < 0) { alpha = 0; } final Color newColor = new Color(currentForeground.getRed(), currentForeground.getGreen(), currentForeground.getBlue(), alpha); final JComponent msg = this.msg; SwingUtilities.invokeLater(new Runnable(){ public void run() { if (!isCanceled()) { msg.setForeground(newColor); } } }); Thread.sleep(200); } } catch (InterruptedException eee) { if (log.isTraceEnabled()) { log.trace("thread interrupted", eee); } } } } } |
|
From: JP <j-...@us...> - 2007-03-21 02:34:21
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/action In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv24862/src/main/java/org/swixat/framework/action Modified Files: Tag: B0_6_0 HandleScriptFunctionAction.java Log Message: - Ran format code and optimize imports on the file (via IntelliJ IDE). - Replaced some String concatenantion operators with StringBuffer.append() for better performance. Index: HandleScriptFunctionAction.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/action/HandleScriptFunctionAction.java,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** HandleScriptFunctionAction.java 21 Mar 2007 01:58:47 -0000 1.2.2.1 --- HandleScriptFunctionAction.java 21 Mar 2007 02:34:14 -0000 1.2.2.2 *************** *** 30,35 **** package org.swixat.framework.action; import org.swixat.SwiXAT; - import org.swixat.util.SwiXUtil; import org.swixat.framework.AbstractFrame; import org.swixat.framework.XPathUtil; --- 30,37 ---- package org.swixat.framework.action; + import org.apache.commons.jxpath.JXPathContext; + import org.apache.commons.logging.Log; + import org.apache.commons.logging.LogFactory; import org.swixat.SwiXAT; import org.swixat.framework.AbstractFrame; import org.swixat.framework.XPathUtil; *************** *** 37,52 **** import org.swixat.script.ScriptException; import org.swixat.script.Scripting; ! import org.apache.commons.logging.Log; ! import org.apache.commons.logging.LogFactory; ! import org.apache.commons.jxpath.JXPathContext; - import java.util.regex.Pattern; - import java.util.regex.Matcher; import java.util.Arrays; /** * @author poussin - * */ --- 39,51 ---- import org.swixat.script.ScriptException; import org.swixat.script.Scripting; ! import org.swixat.util.SwiXUtil; import java.util.Arrays; + import java.util.regex.Matcher; + import java.util.regex.Pattern; /** * @author poussin */ *************** *** 79,93 **** Object retValue = null; ! String functionName = null; ! String[] args = new String[0]; ! String argList = ""; JXPathContext engine = null; // parse out the function name and, if they exist, the arguments Matcher matcher = handleScriptFunctionPattern.matcher(command.trim()); ! if (matcher.matches()) { functionName = matcher.group(1); args = SwiXUtil.split(matcher.group(2), ","); ! } try { --- 78,92 ---- Object retValue = null; ! String functionName = null; ! String[] args = new String[0]; ! StringBuffer argList = new StringBuffer(""); JXPathContext engine = null; // parse out the function name and, if they exist, the arguments Matcher matcher = handleScriptFunctionPattern.matcher(command.trim()); ! if (matcher.matches()) { functionName = matcher.group(1); args = SwiXUtil.split(matcher.group(2), ","); ! } try { *************** *** 110,125 **** // process arguments ! for (int a=0; a<args.length; a++) { ! if (a>0) { ! argList += ", "; } ! String fnArg = args[a].trim(); if (fnArg.startsWith("$")) { // process arg as an xpath expression Object result = XPathUtil.applyXPath(fnArg, null, engine, false); String argname = "_fn_arg_" + a; i.setVariable(argname, result); ! argList += argname; } else { ! argList += fnArg; } } --- 109,124 ---- // process arguments ! for (int a = 0; a < args.length; a++) { ! if (a > 0) { ! argList.append(", "); } ! String fnArg = args[a].trim(); if (fnArg.startsWith("$")) { // process arg as an xpath expression Object result = XPathUtil.applyXPath(fnArg, null, engine, false); String argname = "_fn_arg_" + a; i.setVariable(argname, result); ! argList.append(argname); } else { ! argList.append(fnArg); } } |
|
From: JP <j-...@us...> - 2007-03-21 01:59:23
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/action In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv11964/src/main/java/org/swixat/framework/action Modified Files: Tag: B0_6_0 HandleScriptFunctionAction.java Log Message: Modified script function action to support xpath arguments. Xpath args can also be combined with literals. Example: <button id="myButton" actionCommand='someScriptFunction($myButton, "string literal", $myButton/text)'/> Index: HandleScriptFunctionAction.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/action/HandleScriptFunctionAction.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** HandleScriptFunctionAction.java 2 Oct 2006 21:48:35 -0000 1.2 --- HandleScriptFunctionAction.java 21 Mar 2007 01:58:47 -0000 1.2.2.1 *************** *** 31,38 **** --- 31,47 ---- import org.swixat.SwiXAT; + import org.swixat.util.SwiXUtil; import org.swixat.framework.AbstractFrame; + import org.swixat.framework.XPathUtil; import org.swixat.model.ContextBinder; import org.swixat.script.ScriptException; import org.swixat.script.Scripting; + import org.apache.commons.logging.Log; + import org.apache.commons.logging.LogFactory; + import org.apache.commons.jxpath.JXPathContext; + + import java.util.regex.Pattern; + import java.util.regex.Matcher; + import java.util.Arrays; *************** *** 44,52 **** public class HandleScriptFunctionAction implements Action { /* (non-Javadoc) * @see org.swixat.framework.action.Action#accept(org.swixat.framework.AbstractFrame, java.lang.String, java.lang.Object) */ public boolean accept(Object caller, AbstractFrame frame, String command, Object arg) { ! return (command.trim().endsWith(")")) || (command.trim().endsWith(";")); } --- 53,74 ---- public class HandleScriptFunctionAction implements Action { + + /** + * Logger for this class + */ + private static final Log log = LogFactory.getLog(HandleScriptFunctionAction.class); + + /** + * pattern used to parse script function name and arguments + * example: scriptFunctionName($resource/xpath, "String arg") + */ + protected static final Pattern handleScriptFunctionPattern = + Pattern.compile("(\\w+)\\s*\\((.*)\\)\\s*;?"); + /* (non-Javadoc) * @see org.swixat.framework.action.Action#accept(org.swixat.framework.AbstractFrame, java.lang.String, java.lang.Object) */ public boolean accept(Object caller, AbstractFrame frame, String command, Object arg) { ! return handleScriptFunctionPattern.matcher(command.trim()).matches(); } *************** *** 55,73 **** */ public Object doCommand(Object caller, AbstractFrame frame, String command, Object arg) { Object retValue = null; try { Scripting i = frame.getScriptEngine(); frame.getActualContext().setArgument(arg); ! i.setVariable("currentContext", frame.getActualContext()); i.setVariable("interpreter", i); i.setVariable("context", ContextBinder.getInstance()); i.setVariable("application", SwiXAT.getFactory().getBean("application")); ! retValue = i.eval(command); if (retValue == null) { ! retValue = Integer.valueOf(0); } } catch (ScriptException se) { ! se.printStackTrace(); retValue = Integer.valueOf(1); } --- 77,136 ---- */ public Object doCommand(Object caller, AbstractFrame frame, String command, Object arg) { + Object retValue = null; + String functionName = null; + String[] args = new String[0]; + String argList = ""; + JXPathContext engine = null; + + // parse out the function name and, if they exist, the arguments + Matcher matcher = handleScriptFunctionPattern.matcher(command.trim()); + if (matcher.matches()) { + functionName = matcher.group(1); + args = SwiXUtil.split(matcher.group(2), ","); + } + try { + Scripting i = frame.getScriptEngine(); + frame.getActualContext().setArgument(arg); ! i.setVariable("currentContext", frame.getActualContext()); i.setVariable("interpreter", i); i.setVariable("context", ContextBinder.getInstance()); i.setVariable("application", SwiXAT.getFactory().getBean("application")); ! ! // only initialize an xpath context if we have arguments ! if (args.length > 0) { ! engine = JXPathContext.newContext(frame.getXmlEngine().getSharedContext(), null); ! engine.getVariables().declareVariable("e", arg); ! engine.getVariables().declareVariable("_arg", arg); ! } ! ! // process arguments ! for (int a=0; a<args.length; a++) { ! if (a>0) { ! argList += ", "; ! } ! String fnArg = args[a].trim(); ! if (fnArg.startsWith("$")) { // process arg as an xpath expression ! Object result = XPathUtil.applyXPath(fnArg, null, engine, false); ! String argname = "_fn_arg_" + a; ! i.setVariable(argname, result); ! argList += argname; ! } else { ! argList += fnArg; ! } ! } ! ! log.debug("Calling script function [" + functionName + "] with argList [" + argList + "] and args " + Arrays.toString(args)); ! ! retValue = i.eval(functionName + "(" + argList + ")"); if (retValue == null) { ! retValue = Integer.valueOf(0); } } catch (ScriptException se) { ! log.error("Script error", se); retValue = Integer.valueOf(1); } *************** *** 75,78 **** --- 138,142 ---- } + /* (non-Javadoc) * @see org.swixat.framework.action.Action#checkAction(org.swixat.framework.AbstractFrame, java.lang.String, java.lang.Object) |
|
From: JP <j-...@us...> - 2007-03-20 01:48:23
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/framework In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv31351/src/main/java/org/swixat/framework Modified Files: Tag: B0_6_0 AbstractFrame.java Log Message: Added code to remove invisible components from the Swing GUI after SwiXML rendering and SwiXAT initialization, but prior to actual display. This prevents display problems with certain Swing layout managers that assign layout space to these invisible components. Better to remove them altogether. Index: AbstractFrame.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/AbstractFrame.java,v retrieving revision 1.14 retrieving revision 1.14.2.1 diff -C2 -d -r1.14 -r1.14.2.1 *** AbstractFrame.java 2 Oct 2006 21:48:35 -0000 1.14 --- AbstractFrame.java 20 Mar 2007 01:26:46 -0000 1.14.2.1 *************** *** 25,28 **** --- 25,30 ---- import org.swixat.script.Scripting; import org.swixat.SwiXAT; + import org.swixat.databinding.DataSource; + import org.swixat.events.AbstractModelEvents; import org.swixat.util.ArrayToArrayListConverter; import org.swixat.util.wizards.WizardPanel; *************** *** 378,388 **** Application app = (Application)SwiXAT.getFactory().getBean("application"); ! xulView = app.completePath(view.getXmlView(), app.getBaseDir()); ! setXmlEngine(new SwiXMLEngine()); ! getXmlEngine().setParentFrame(this); getActualContext().setFrame(this); ! getXmlEngine().render(xulView); ! getActualContext().setIdMap(getXmlEngine().getIdMap()); ! return getXmlEngine().getRootComponent(); } catch (Exception e) { log.warn("Error during init of: " + view.getXmlView(), e); --- 380,401 ---- Application app = (Application)SwiXAT.getFactory().getBean("application"); ! xulView = Application.completePath(view.getXmlView(), app.getBaseDir()); ! ! SwiXMLEngine engine = new SwiXMLEngine(); ! setXmlEngine(engine); ! engine.setParentFrame(this); getActualContext().setFrame(this); ! engine.render(xulView); ! ! // after SwiXML rendering but prior to display, remove invisible components from GUI to prevent layout problems ! for (Iterator i = engine.getAllComponentItertor(); i.hasNext();) { ! Component c = (Component) i.next(); ! if (c instanceof DataSource || c instanceof AbstractModelEvents) { ! c.getParent().remove(c); ! } ! } ! ! getActualContext().setIdMap(engine.getIdMap()); ! return engine.getRootComponent(); } catch (Exception e) { log.warn("Error during init of: " + view.getXmlView(), e); |
|
From: JP <j-...@us...> - 2007-03-18 11:48:57
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/framework In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv1035/src/main/java/org/swixat/framework Modified Files: Tag: B0_6_0 SwiXMLEngine.java Log Message: Modified new init script feature to work for all JComponents, rather than just those with property setters. (Wanted to use the feature with a JTabbedPane component, which doesn't have a property setter by default.) Index: SwiXMLEngine.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/SwiXMLEngine.java,v retrieving revision 1.17.2.2 retrieving revision 1.17.2.3 diff -C2 -d -r1.17.2.2 -r1.17.2.3 *** SwiXMLEngine.java 5 Mar 2007 13:52:10 -0000 1.17.2.2 --- SwiXMLEngine.java 18 Mar 2007 06:25:32 -0000 1.17.2.3 *************** *** 221,226 **** } ! // treat Action tag ! if (c instanceof JComponent) { try { Method mt = c.getClass().getMethod("getActionCommand", null); --- 221,229 ---- } ! if (c instanceof JComponent) { ! // Call init script. If absent, executeCommand does nothing. ! String init = (String)((JComponent)c).getClientProperty("init"); ! getParentFrame().executeCommand(init); ! // treat Action tag try { Method mt = c.getClass().getMethod("getActionCommand", null); *************** *** 239,246 **** if (ps != null) { ps.init((JComponent)c, this); - - // call user init script - String init = (String)((JComponent)c).getClientProperty("init"); - getParentFrame().executeCommand(init); } --- 242,245 ---- |
|
From: Paolo M. <pma...@us...> - 2007-03-14 22:43:14
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv22677 Modified Files: Tag: B0_6_0 SwiXAT.java Log Message: Deleted an useless import Index: SwiXAT.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/SwiXAT.java,v retrieving revision 1.6.2.1 retrieving revision 1.6.2.2 diff -C2 -d -r1.6.2.1 -r1.6.2.2 *** SwiXAT.java 3 Oct 2006 17:19:51 -0000 1.6.2.1 --- SwiXAT.java 14 Mar 2007 22:43:01 -0000 1.6.2.2 *************** *** 9,13 **** import org.swixat.framework.IndependentFrame; import java.io.IOException; - import java.util.Map; import org.springframework.core.io.Resource; import org.swixat.framework.OutputView; --- 9,12 ---- |
|
From: Benjamin P. <bpo...@us...> - 2007-03-05 14:42:58
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/framework In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv15319/src/main/java/org/swixat/framework Modified Files: Tag: B0_6_0 SwiXMLEngine.java Log Message: if we find "init" attribute on widget, execute this "init" command. this permit to add user initialisation for all widget Index: SwiXMLEngine.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/SwiXMLEngine.java,v retrieving revision 1.17.2.1 retrieving revision 1.17.2.2 diff -C2 -d -r1.17.2.1 -r1.17.2.2 *** SwiXMLEngine.java 18 Feb 2007 13:42:42 -0000 1.17.2.1 --- SwiXMLEngine.java 5 Mar 2007 13:52:10 -0000 1.17.2.2 *************** *** 239,242 **** --- 239,246 ---- if (ps != null) { ps.init((JComponent)c, this); + + // call user init script + String init = (String)((JComponent)c).getClientProperty("init"); + getParentFrame().executeCommand(init); } |
|
From: Joachim B. <jb...@us...> - 2007-02-18 13:43:19
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/databinding In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv16784/src/main/java/org/swixat/databinding Modified Files: Tag: B0_6_0 SetterFactory.java Log Message: jdk1.6 issue fixed Index: SetterFactory.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/databinding/SetterFactory.java,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** SetterFactory.java 2 Oct 2006 21:48:35 -0000 1.4 --- SetterFactory.java 18 Feb 2007 13:42:39 -0000 1.4.2.1 *************** *** 2,5 **** --- 2,6 ---- import java.util.HashMap; + import java.util.Map; *************** *** 10,14 **** */ public class SetterFactory { ! private HashMap propertySetters; public SetterFactory() { --- 11,15 ---- */ public class SetterFactory { ! private Map propertySetters; public SetterFactory() { *************** *** 83,87 **** * @return Value of property propertySetters. */ ! public HashMap getPropertySetters() { return propertySetters; } --- 84,88 ---- * @return Value of property propertySetters. */ ! public Map getPropertySetters() { return propertySetters; } *************** *** 92,96 **** * @param propertySetters New value of property propertySetters. */ ! public void setPropertySetters(HashMap propertySetters) { this.propertySetters.putAll(propertySetters); } --- 93,97 ---- * @param propertySetters New value of property propertySetters. */ ! public void setPropertySetters(Map propertySetters) { this.propertySetters.putAll(propertySetters); } |
|
From: Joachim B. <jb...@us...> - 2007-02-18 13:42:52
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/framework In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv16784/src/main/java/org/swixat/framework Modified Files: Tag: B0_6_0 SwiXMLEngine.java TagLibraryExt.java Log Message: jdk1.6 issue fixed Index: TagLibraryExt.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/TagLibraryExt.java,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 *** TagLibraryExt.java 2 Oct 2006 21:48:35 -0000 1.6 --- TagLibraryExt.java 18 Feb 2007 13:42:43 -0000 1.6.2.1 *************** *** 8,11 **** --- 8,12 ---- import java.util.HashMap; + import java.util.Map; /** *************** *** 14,18 **** */ public class TagLibraryExt { ! HashMap newTags; /** Creates a new instance of TagLibraryExt */ public TagLibraryExt() { --- 15,19 ---- */ public class TagLibraryExt { ! Map newTags; /** Creates a new instance of TagLibraryExt */ public TagLibraryExt() { *************** *** 106,110 **** * @return Value of property newTags. */ ! public HashMap getNewTags() { return newTags; } --- 107,111 ---- * @return Value of property newTags. */ ! public Map getNewTags() { return newTags; } *************** *** 115,119 **** * @param newTags New value of property newTags. */ ! public void setNewTags(HashMap newTags) { this.newTags.putAll(newTags); } --- 116,120 ---- * @param newTags New value of property newTags. */ ! public void setNewTags(Map newTags) { this.newTags.putAll(newTags); } Index: SwiXMLEngine.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/SwiXMLEngine.java,v retrieving revision 1.17 retrieving revision 1.17.2.1 diff -C2 -d -r1.17 -r1.17.2.1 *** SwiXMLEngine.java 2 Oct 2006 21:48:35 -0000 1.17 --- SwiXMLEngine.java 18 Feb 2007 13:42:42 -0000 1.17.2.1 *************** *** 721,725 **** beanFactory = factory; TagLibraryExt newTags = (TagLibraryExt)beanFactory.getBean("newTags"); ! HashMap tags = newTags.getNewTags(); Iterator elements = tags.entrySet().iterator(); while (elements.hasNext()) { --- 721,725 ---- beanFactory = factory; TagLibraryExt newTags = (TagLibraryExt)beanFactory.getBean("newTags"); ! Map tags = newTags.getNewTags(); Iterator elements = tags.entrySet().iterator(); while (elements.hasNext()) { |
|
From: Joachim B. <jb...@us...> - 2007-01-05 15:46:30
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/action In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv10534/src/main/java/org/swixat/framework/action Modified Files: Tag: B0_6_0 UpdateAction.java Log Message: wrong logger name Index: UpdateAction.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/action/UpdateAction.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** UpdateAction.java 2 Oct 2006 21:48:36 -0000 1.2 --- UpdateAction.java 5 Jan 2007 15:46:23 -0000 1.2.2.1 *************** *** 59,63 **** public class UpdateAction implements Action { ! private static Log log = LogFactory.getLog(RefreshViewAction.class); /* (non-Javadoc) --- 59,63 ---- public class UpdateAction implements Action { ! private static Log log = LogFactory.getLog(UpdateAction.class); /* (non-Javadoc) |
|
From: Benjamin P. <bpo...@us...> - 2006-09-26 10:22:19
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/databinding In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv25366/src/main/java/org/swixat/databinding Modified Files: Tag: B0_5_5 JTableModel.java Log Message: add try ... catch to xpath evaluation and return null if error Index: JTableModel.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/databinding/JTableModel.java,v retrieving revision 1.2.2.11 retrieving revision 1.2.2.12 diff -C2 -d -r1.2.2.11 -r1.2.2.12 *** JTableModel.java 20 Sep 2006 12:51:33 -0000 1.2.2.11 --- JTableModel.java 26 Sep 2006 10:22:15 -0000 1.2.2.12 *************** *** 411,415 **** jx.getVariables().declareVariable("col", new Integer(col)); ! result = XPathUtil.applyXPath(xpath, null, jx, false); } else if (o != null && o.getClass().isArray()) { // data is array of array, use 2nd array for columns --- 411,422 ---- jx.getVariables().declareVariable("col", new Integer(col)); ! try { ! result = XPathUtil.applyXPath(xpath, null, jx, false); ! } catch (Exception eee) { ! result = null; ! if (log.isWarnEnabled()) { ! log.warn("Can't evaluate xpath: " + xpath, eee); ! } ! } } else if (o != null && o.getClass().isArray()) { // data is array of array, use 2nd array for columns |
|
From: Benjamin P. <bpo...@us...> - 2006-09-26 10:21:50
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/util In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv25300/src/main/java/org/swixat/util Modified Files: Tag: B0_5_5 SwiXUtil.java Log Message: in getValues method add support for Map and Iterable Index: SwiXUtil.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/util/Attic/SwiXUtil.java,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** SwiXUtil.java 6 Apr 2006 19:04:36 -0000 1.1.2.4 --- SwiXUtil.java 26 Sep 2006 10:21:35 -0000 1.1.2.5 *************** *** 39,42 **** --- 39,44 ---- import java.util.Iterator; import java.util.List; + import java.util.Map; + import java.util.Set; import javax.swing.JComponent; *************** *** 257,260 **** --- 259,264 ---- * <li>Iterator -> [iterator values] * <li>Array -> [array values] + * <li>Map -> [EntrySet values] + * <li>Iterable -> [iterator values] * <li>other -> [other] array with one value * *************** *** 277,280 **** --- 281,295 ---- } else if (data.getClass().isArray() ) { result = (Object[])data; + } else if (data instanceof Map) { + Set entries = ((Map)data).entrySet(); + result = entries.toArray(); + } else if (data instanceof Iterable) { + Iterator iter = ((Iterable)data).iterator(); + ArrayList list = new ArrayList(); + while (iter.hasNext()) { + list.add(iter.next()); + } + result = list.toArray(); + } else { result = new Object[]{data}; |
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/action In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv29205/src/main/java/org/swixat/framework/action Modified Files: Tag: B0_5_5 HandleClassMethodAction.java OutputViewAction.java RefreshViewAction.java XPathAction.java Log Message: Use XPathUtil.applyXPath in all swixat project, this permit to intercept jxpath exception and log real exception. Very useful to debug application. Index: HandleClassMethodAction.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/action/Attic/HandleClassMethodAction.java,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -C2 -d -r1.1.2.5 -r1.1.2.6 *** HandleClassMethodAction.java 1 Sep 2006 13:32:57 -0000 1.1.2.5 --- HandleClassMethodAction.java 20 Sep 2006 12:51:35 -0000 1.1.2.6 *************** *** 263,267 **** // find in DataSource. If argument found is not type compatible with // argument wanted by method, we try to convert the argument ! JXPathContext xpath = JXPathContext.newContext(frame.getXmlEngine().getSharedContext(), null); xpath.getVariables().declareVariable("e", currentContext.getArgument()); xpath.getVariables().declareVariable("_arg", currentContext.getArgument()); --- 263,267 ---- // find in DataSource. If argument found is not type compatible with // argument wanted by method, we try to convert the argument ! JXPathContext xpath = XPathUtil.newContext(frame.getXmlEngine().getSharedContext(), null); xpath.getVariables().declareVariable("e", currentContext.getArgument()); xpath.getVariables().declareVariable("_arg", currentContext.getArgument()); *************** *** 274,278 **** argObject = arg.substring(1, arg.length() - 1); } else if(!"".equals(arg)){ ! argObject = xpath.getValue(arg); } --- 274,278 ---- argObject = arg.substring(1, arg.length() - 1); } else if(!"".equals(arg)){ ! argObject = XPathUtil.applyXPath(arg, null, xpath, false); } Index: OutputViewAction.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/action/Attic/OutputViewAction.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** OutputViewAction.java 17 Mar 2006 15:30:34 -0000 1.1.2.1 --- OutputViewAction.java 20 Sep 2006 12:51:35 -0000 1.1.2.2 *************** *** 33,36 **** --- 33,37 ---- import org.swixat.framework.AbstractFrame; import org.swixat.framework.OutputView; + import org.swixat.framework.XPathUtil; import org.swixat.model.Context; import org.swixat.model.GenericContext; *************** *** 82,87 **** int i = 1; while(i<ctxArgs.length) { ! String key = (String)xpath.getValue(ctxArgs[i++], String.class); ! Object value = xpath.getValue(ctxArgs[i++]); ctx.setData(key, value); } --- 83,88 ---- int i = 1; while(i<ctxArgs.length) { ! String key = (String)XPathUtil.applyXPath(ctxArgs[i++], null, xpath, false, String.class); ! Object value = XPathUtil.applyXPath(ctxArgs[i++], null, xpath, false); ctx.setData(key, value); } Index: XPathAction.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/action/Attic/XPathAction.java,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** XPathAction.java 17 Mar 2006 21:04:33 -0000 1.1.2.2 --- XPathAction.java 20 Sep 2006 12:51:35 -0000 1.1.2.3 *************** *** 32,35 **** --- 32,36 ---- import org.apache.commons.jxpath.JXPathContext; import org.swixat.framework.AbstractFrame; + import org.swixat.framework.XPathUtil; import org.swixat.model.Context; *************** *** 63,67 **** engine.getVariables().declareVariable("_arg", arg); ! Object result = engine.getValue(command); if (result == null) { --- 64,68 ---- engine.getVariables().declareVariable("_arg", arg); ! Object result = XPathUtil.applyXPath(command, null, engine, false); if (result == null) { Index: RefreshViewAction.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/framework/action/Attic/RefreshViewAction.java,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** RefreshViewAction.java 17 Mar 2006 21:04:33 -0000 1.1.2.2 --- RefreshViewAction.java 20 Sep 2006 12:51:35 -0000 1.1.2.3 *************** *** 32,38 **** --- 32,40 ---- import java.awt.Component; + import org.apache.commons.jxpath.JXPathContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.swixat.framework.AbstractFrame; + import org.swixat.framework.XPathUtil; import org.swixat.util.SwiXUtil; *************** *** 83,87 **** // remove string marker " if(!"".equals(comp)){ ! Object o = frame.getXmlEngine().getSharedContext().getValue(comp); if (o instanceof Component) { frame.getXmlEngine().refreshView((Component)o); --- 85,90 ---- // remove string marker " if(!"".equals(comp)){ ! JXPathContext context = frame.getXmlEngine().getSharedContext(); ! Object o = XPathUtil.applyXPath(comp, null, context, false); if (o instanceof Component) { frame.getXmlEngine().refreshView((Component)o); |
|
From: Benjamin P. <bpo...@us...> - 2006-09-20 12:51:42
|
Update of /cvsroot/swixat/swixat/src/main/java/org/swixat/databinding In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv29205/src/main/java/org/swixat/databinding Modified Files: Tag: B0_5_5 AbstractPropertySetter.java JComboBoxModelPropertySetter.java JRenderer.java JTableModel.java JTreeNode.java TreeNodeWrapper.java Log Message: Use XPathUtil.applyXPath in all swixat project, this permit to intercept jxpath exception and log real exception. Very useful to debug application. Index: TreeNodeWrapper.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/databinding/TreeNodeWrapper.java,v retrieving revision 1.2.2.5 retrieving revision 1.2.2.6 diff -C2 -d -r1.2.2.5 -r1.2.2.6 *** TreeNodeWrapper.java 18 Sep 2006 13:07:28 -0000 1.2.2.5 --- TreeNodeWrapper.java 20 Sep 2006 12:51:34 -0000 1.2.2.6 *************** *** 44,47 **** --- 44,48 ---- import org.apache.commons.collections.IteratorUtils; import org.apache.commons.jxpath.JXPathContext; + import org.apache.commons.jxpath.JXPathException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; *************** *** 147,154 **** if (node != null) { uo = node.getUserObject(); - JXPathContext xpath = XPathUtil.newContext(uo); String pathProperty = jnode.getChildsPropertyName(); ! uo = xpath.getValue(pathProperty); } } else { // in last take name --- 148,157 ---- if (node != null) { uo = node.getUserObject(); String pathProperty = jnode.getChildsPropertyName(); ! uo = XPathUtil.applyXPath(pathProperty, uo, null, false); } + } else if (jnode.getUserObject() != null) { + String path = jnode.getUserObject(); + uo = XPathUtil.applyXPath(path, this, null, false); } else { // in last take name Index: AbstractPropertySetter.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/databinding/Attic/AbstractPropertySetter.java,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** AbstractPropertySetter.java 6 Apr 2006 19:04:24 -0000 1.1.2.4 --- AbstractPropertySetter.java 20 Sep 2006 12:51:33 -0000 1.1.2.5 *************** *** 37,40 **** --- 37,41 ---- import org.swixat.framework.SwiXMLEngine; import org.swixat.framework.SwiXRequest; + import org.swixat.framework.XPathUtil; public abstract class AbstractPropertySetter implements PropertySetter { *************** *** 56,69 **** String defaultValue = (String)jc.getClientProperty("default"); if (defaultValue != null) { - Object data = null; // NOTE: i don't know if for default we must used iterate or no // or perhaps look for defaultIterate ? i found this bad :( ! String iterate = (String)jc.getClientProperty("iterate"); ! if ((iterate != null) && (iterate.equalsIgnoreCase("true"))) { ! data = jxpathContext.iterate(defaultValue); ! } else { ! data = jxpathContext.getValue(defaultValue); ! } log.debug("use default value: '" + data + "'"); setProperty(jc, data); result = true; --- 57,68 ---- String defaultValue = (String)jc.getClientProperty("default"); if (defaultValue != null) { // NOTE: i don't know if for default we must used iterate or no // or perhaps look for defaultIterate ? i found this bad :( ! String iterateString = (String)jc.getClientProperty("iterate"); ! boolean iterate = (iterateString != null) && (iterateString.equalsIgnoreCase("true")); ! Object data = XPathUtil.applyXPath(defaultValue, null, jxpathContext, iterate); ! log.debug("use default value: '" + data + "'"); + setProperty(jc, data); result = true; Index: JTreeNode.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/databinding/JTreeNode.java,v retrieving revision 1.2.2.5 retrieving revision 1.2.2.6 diff -C2 -d -r1.2.2.5 -r1.2.2.6 *** JTreeNode.java 18 Sep 2006 13:07:28 -0000 1.2.2.5 --- JTreeNode.java 20 Sep 2006 12:51:34 -0000 1.2.2.6 *************** *** 47,52 **** // protected TreeNodeWrapper parentTreeNodeWrapper = null; protected String childsPropertyName = null; - protected String type = null; protected String treeOrigin = null; protected Object originData = null; --- 47,53 ---- // protected TreeNodeWrapper parentTreeNodeWrapper = null; protected String childsPropertyName = null; protected String treeOrigin = null; + protected String userObject = null; + protected String type = null; protected Object originData = null; *************** *** 174,177 **** --- 175,192 ---- } + /** + * @return Returns the userObject. + */ + public String getUserObject() { + return this.userObject; + } + + /** + * @param userObject The userObject to set. + */ + public void setUserObject(String userObject) { + this.userObject = userObject; + } + } // JTreeNode Index: JComboBoxModelPropertySetter.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/databinding/JComboBoxModelPropertySetter.java,v retrieving revision 1.2.2.4 retrieving revision 1.2.2.5 diff -C2 -d -r1.2.2.4 -r1.2.2.5 *** JComboBoxModelPropertySetter.java 28 Aug 2006 11:47:03 -0000 1.2.2.4 --- JComboBoxModelPropertySetter.java 20 Sep 2006 12:51:33 -0000 1.2.2.5 *************** *** 39,42 **** --- 39,43 ---- import org.apache.commons.logging.LogFactory; import org.swixat.framework.SwiXMLEngine; + import org.swixat.framework.XPathUtil; import org.swixat.util.SwiXUtil; *************** *** 57,62 **** String [] arrayValues = SwiXUtil.split(values); Object [] obj = new Object[arrayValues.length]; for (int i=0; i<arrayValues.length; i++) { ! Object o = engine.getSharedContext().getValue(arrayValues[i]); obj[i] = o; } --- 58,65 ---- String [] arrayValues = SwiXUtil.split(values); Object [] obj = new Object[arrayValues.length]; + JXPathContext context = engine.getSharedContext(); for (int i=0; i<arrayValues.length; i++) { ! String path = arrayValues[i]; ! Object o = XPathUtil.applyXPath(path, null, context, false); obj[i] = o; } Index: JTableModel.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/databinding/JTableModel.java,v retrieving revision 1.2.2.10 retrieving revision 1.2.2.11 diff -C2 -d -r1.2.2.10 -r1.2.2.11 *** JTableModel.java 5 Sep 2006 12:28:52 -0000 1.2.2.10 --- JTableModel.java 20 Sep 2006 12:51:33 -0000 1.2.2.11 *************** *** 411,415 **** jx.getVariables().declareVariable("col", new Integer(col)); ! result = jx.getValue(xpath); } else if (o != null && o.getClass().isArray()) { // data is array of array, use 2nd array for columns --- 411,415 ---- jx.getVariables().declareVariable("col", new Integer(col)); ! result = XPathUtil.applyXPath(xpath, null, jx, false); } else if (o != null && o.getClass().isArray()) { // data is array of array, use 2nd array for columns Index: JRenderer.java =================================================================== RCS file: /cvsroot/swixat/swixat/src/main/java/org/swixat/databinding/Attic/JRenderer.java,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -C2 -d -r1.1.2.6 -r1.1.2.7 *** JRenderer.java 8 Sep 2006 22:05:10 -0000 1.1.2.6 --- JRenderer.java 20 Sep 2006 12:51:33 -0000 1.1.2.7 *************** *** 162,167 **** if (value != null && childsPropertyName != null && !"".equals(childsPropertyName)) { ! JXPathContext xpath = XPathUtil.newContext(value); ! value = xpath.getValue(childsPropertyName); } --- 162,166 ---- if (value != null && childsPropertyName != null && !"".equals(childsPropertyName)) { ! value = XPathUtil.applyXPath(childsPropertyName, value, null, false); } *************** *** 187,192 **** if (object != null && tooltips != null && !"".equals(tooltips)) { ! JXPathContext xpath = XPathUtil.newContext(object); ! Object tmp = xpath.getValue(tooltips); if (tmp != null) { result = tmp.toString(); --- 186,190 ---- if (object != null && tooltips != null && !"".equals(tooltips)) { ! Object tmp = XPathUtil.applyXPath(tooltips, object, null, false); if (tmp != null) { result = tmp.toString(); |