Fixed potential concurrent modification exception.

Image dialog not saving uploaded file to ad_image.
This commit is contained in:
Heng Sin Low 2008-12-05 16:07:12 +00:00
parent dbbca01f82
commit 7e0a2141bb
5 changed files with 22 additions and 6 deletions

View File

@ -269,7 +269,9 @@ public class WButtonEditor extends WEditor
if (Events.ON_CLICK.equals(event.getName()))
{
ActionEvent actionEvent = new ActionEvent(this, getColumnName(), Events.ON_CLICK);
for (ActionListener evtListener : actionListeners)
ActionListener[] listeners = new ActionListener[0];
listeners = actionListeners.toArray(listeners);
for (ActionListener evtListener : listeners)
{
evtListener.actionPerformed(actionEvent);
}

View File

@ -38,7 +38,8 @@ import org.zkoss.zk.ui.event.Events;
public class WDateEditor extends WEditor
{
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
private static final CLogger logger;
@SuppressWarnings("unused")
private static final CLogger logger;
static
{

View File

@ -30,7 +30,8 @@ import org.zkoss.zk.ui.event.Events;
public class WDatetimeEditor extends WEditor
{
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
private static final CLogger logger;
@SuppressWarnings("unused")
private static final CLogger logger;
static
{

View File

@ -133,7 +133,9 @@ public class WEditorPopupMenu extends Menupopup implements EventListener
{
ContextMenuEvent menuEvent = new ContextMenuEvent(evt);
for (ContextMenuListener listener : menuListeners)
ContextMenuListener[] listeners = new ContextMenuListener[0];
listeners = menuListeners.toArray(listeners);
for (ContextMenuListener listener : listeners)
{
listener.onMenu(menuEvent);
}

View File

@ -71,6 +71,17 @@ public class WImageDialog extends Window implements EventListener
// load data
if (m_mImage == null)
m_mImage = MImage.get (Env.getCtx(), 0);
else
{
try {
AImage aImage = new AImage(m_mImage.getName(), m_mImage.getData());
image.setContent(aImage);
} catch (Exception e) {
log.log(Level.WARNING, "load image", e);
}
}
fileButton.setLabel(m_mImage.getName());
// imageLabel.setIcon(m_mImage.getIcon());
AEnv.showCenterScreen(this);
@ -172,7 +183,6 @@ public class WImageDialog extends Window implements EventListener
}
String fileName = imageFile.getName();
byte[] data = null;
// See if we can load & display it
try
@ -197,7 +207,7 @@ public class WImageDialog extends Window implements EventListener
// Save info
m_mImage.setName(fileName);
m_mImage.setImageURL(fileName);
m_mImage.setBinaryData(data);
m_mImage.setBinaryData(image.getContent().getByteData());
} // cmd_file
/**