IDEMPIERE-993 Upgrade upload button on Image fields to zk6

This commit is contained in:
Carlos Ruiz 2013-06-01 11:50:56 -05:00
parent 6b57f30f62
commit 2bbff2bf5c
3 changed files with 10 additions and 28 deletions

View File

@ -69,11 +69,7 @@ public class ButtonFactory {
Button button = new Button();
button.setName("btn"+name);
String text = Msg.translate(Env.getCtx(), name);
if (!name.equals(text))
text = text.replaceAll("[&]", "");
else
text = null;
String text = Util.cleanAmp(Msg.translate(Env.getCtx(), name));
if (withText && text != null)
{

View File

@ -26,6 +26,7 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.FolderBrowser;
@ -128,7 +129,7 @@ public class WTranslationDialog extends TranslationController implements IFormCo
bImport.setLabel(Msg.getMsg(Env.getCtx(), "Import"));
bImport.addActionListener(this);
bImportZIP.setLabel(Msg.getMsg(Env.getCtx(), "ImportZIP"));
bImportZIP.setUpload("true");
bImportZIP.setUpload(AdempiereWebUI.getUploadSetting());
bImportZIP.addEventListener(Events.ON_UPLOAD, this);
Rows rows = centerLayout.newRows();

View File

@ -38,11 +38,10 @@ import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.event.UploadEvent;
import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center;
import org.zkoss.zul.North;
import org.zkoss.zul.South;
import org.zkoss.zul.Fileupload;
import org.zkoss.zul.Image;
import org.zkoss.zul.North;
import org.zkoss.zul.Separator;
import org.zkoss.zul.South;
/**
* Base on the original Swing Image Dialog.
@ -57,7 +56,7 @@ public class WImageDialog extends Window implements EventListener<Event>
/**
*
*/
private static final long serialVersionUID = 4253571652070223072L;
private static final long serialVersionUID = -5048907034691374834L;
/**
* Constructor
@ -149,7 +148,8 @@ public class WImageDialog extends Window implements EventListener<Event>
south.appendChild(confirmPanel);
//
fileButton.addEventListener(Events.ON_CLICK, this);
fileButton.setUpload(AdempiereWebUI.getUploadSetting());
fileButton.addEventListener(Events.ON_UPLOAD, this);
confirmPanel.addActionListener(Events.ON_CLICK, this);
addEventListener(Events.ON_UPLOAD, this);
@ -161,10 +161,6 @@ public class WImageDialog extends Window implements EventListener<Event>
UploadEvent ue = (UploadEvent) e;
processUploadMedia(ue.getMedia());
}
else if (e.getTarget() == fileButton)
{
cmd_file();
}
else if (e.getTarget().getId().equals(ConfirmPanel.A_OK))
{
if (image.getContent() != null)
@ -197,17 +193,6 @@ public class WImageDialog extends Window implements EventListener<Event>
return cancel;
}
/**
* Load file & display
*/
private void cmd_file()
{
// Show File Open Dialog
Media media = Fileupload.get();
if (AdempiereWebUI.isEventThreadEnabled())
processUploadMedia(media);
} // cmd_file
private void processUploadMedia(Media imageFile) {
if (imageFile == null)
return;