Fixed potential concurrent modification exception.
Image dialog not saving uploaded file to ad_image.
This commit is contained in:
parent
dbbca01f82
commit
7e0a2141bb
|
@ -269,7 +269,9 @@ public class WButtonEditor extends WEditor
|
||||||
if (Events.ON_CLICK.equals(event.getName()))
|
if (Events.ON_CLICK.equals(event.getName()))
|
||||||
{
|
{
|
||||||
ActionEvent actionEvent = new ActionEvent(this, getColumnName(), Events.ON_CLICK);
|
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);
|
evtListener.actionPerformed(actionEvent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
public class WDateEditor extends WEditor
|
public class WDateEditor extends WEditor
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private static final CLogger logger;
|
private static final CLogger logger;
|
||||||
|
|
||||||
static
|
static
|
||||||
|
|
|
@ -30,6 +30,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
public class WDatetimeEditor extends WEditor
|
public class WDatetimeEditor extends WEditor
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private static final CLogger logger;
|
private static final CLogger logger;
|
||||||
|
|
||||||
static
|
static
|
||||||
|
|
|
@ -133,7 +133,9 @@ public class WEditorPopupMenu extends Menupopup implements EventListener
|
||||||
{
|
{
|
||||||
ContextMenuEvent menuEvent = new ContextMenuEvent(evt);
|
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);
|
listener.onMenu(menuEvent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,17 @@ public class WImageDialog extends Window implements EventListener
|
||||||
// load data
|
// load data
|
||||||
if (m_mImage == null)
|
if (m_mImage == null)
|
||||||
m_mImage = MImage.get (Env.getCtx(), 0);
|
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());
|
fileButton.setLabel(m_mImage.getName());
|
||||||
// imageLabel.setIcon(m_mImage.getIcon());
|
// imageLabel.setIcon(m_mImage.getIcon());
|
||||||
AEnv.showCenterScreen(this);
|
AEnv.showCenterScreen(this);
|
||||||
|
@ -172,7 +183,6 @@ public class WImageDialog extends Window implements EventListener
|
||||||
}
|
}
|
||||||
|
|
||||||
String fileName = imageFile.getName();
|
String fileName = imageFile.getName();
|
||||||
byte[] data = null;
|
|
||||||
|
|
||||||
// See if we can load & display it
|
// See if we can load & display it
|
||||||
try
|
try
|
||||||
|
@ -197,7 +207,7 @@ public class WImageDialog extends Window implements EventListener
|
||||||
// Save info
|
// Save info
|
||||||
m_mImage.setName(fileName);
|
m_mImage.setName(fileName);
|
||||||
m_mImage.setImageURL(fileName);
|
m_mImage.setImageURL(fileName);
|
||||||
m_mImage.setBinaryData(data);
|
m_mImage.setBinaryData(image.getContent().getByteData());
|
||||||
} // cmd_file
|
} // cmd_file
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue