IDEMPIERE-993 Upgrade upload button on Image fields to zk6
This commit is contained in:
parent
6b57f30f62
commit
2bbff2bf5c
|
@ -68,12 +68,8 @@ public class ButtonFactory {
|
||||||
{
|
{
|
||||||
Button button = new Button();
|
Button button = new Button();
|
||||||
button.setName("btn"+name);
|
button.setName("btn"+name);
|
||||||
|
|
||||||
String text = Msg.translate(Env.getCtx(), name);
|
String text = Util.cleanAmp(Msg.translate(Env.getCtx(), name));
|
||||||
if (!name.equals(text))
|
|
||||||
text = text.replaceAll("[&]", "");
|
|
||||||
else
|
|
||||||
text = null;
|
|
||||||
|
|
||||||
if (withText && text != null)
|
if (withText && text != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipFile;
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
import org.adempiere.exceptions.AdempiereException;
|
import org.adempiere.exceptions.AdempiereException;
|
||||||
|
import org.adempiere.webui.AdempiereWebUI;
|
||||||
import org.adempiere.webui.LayoutUtils;
|
import org.adempiere.webui.LayoutUtils;
|
||||||
import org.adempiere.webui.component.Button;
|
import org.adempiere.webui.component.Button;
|
||||||
import org.adempiere.webui.component.FolderBrowser;
|
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.setLabel(Msg.getMsg(Env.getCtx(), "Import"));
|
||||||
bImport.addActionListener(this);
|
bImport.addActionListener(this);
|
||||||
bImportZIP.setLabel(Msg.getMsg(Env.getCtx(), "ImportZIP"));
|
bImportZIP.setLabel(Msg.getMsg(Env.getCtx(), "ImportZIP"));
|
||||||
bImportZIP.setUpload("true");
|
bImportZIP.setUpload(AdempiereWebUI.getUploadSetting());
|
||||||
bImportZIP.addEventListener(Events.ON_UPLOAD, this);
|
bImportZIP.addEventListener(Events.ON_UPLOAD, this);
|
||||||
|
|
||||||
Rows rows = centerLayout.newRows();
|
Rows rows = centerLayout.newRows();
|
||||||
|
|
|
@ -38,11 +38,10 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
import org.zkoss.zk.ui.event.UploadEvent;
|
import org.zkoss.zk.ui.event.UploadEvent;
|
||||||
import org.zkoss.zul.Borderlayout;
|
import org.zkoss.zul.Borderlayout;
|
||||||
import org.zkoss.zul.Center;
|
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.Image;
|
||||||
|
import org.zkoss.zul.North;
|
||||||
import org.zkoss.zul.Separator;
|
import org.zkoss.zul.Separator;
|
||||||
|
import org.zkoss.zul.South;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base on the original Swing Image Dialog.
|
* 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
|
* Constructor
|
||||||
|
@ -147,9 +146,10 @@ public class WImageDialog extends Window implements EventListener<Event>
|
||||||
south.setStyle("background-color: transparent; border: none;");
|
south.setStyle("background-color: transparent; border: none;");
|
||||||
south.setParent(mainLayout);
|
south.setParent(mainLayout);
|
||||||
south.appendChild(confirmPanel);
|
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);
|
confirmPanel.addActionListener(Events.ON_CLICK, this);
|
||||||
|
|
||||||
addEventListener(Events.ON_UPLOAD, this);
|
addEventListener(Events.ON_UPLOAD, this);
|
||||||
|
@ -161,10 +161,6 @@ public class WImageDialog extends Window implements EventListener<Event>
|
||||||
UploadEvent ue = (UploadEvent) e;
|
UploadEvent ue = (UploadEvent) e;
|
||||||
processUploadMedia(ue.getMedia());
|
processUploadMedia(ue.getMedia());
|
||||||
}
|
}
|
||||||
else if (e.getTarget() == fileButton)
|
|
||||||
{
|
|
||||||
cmd_file();
|
|
||||||
}
|
|
||||||
else if (e.getTarget().getId().equals(ConfirmPanel.A_OK))
|
else if (e.getTarget().getId().equals(ConfirmPanel.A_OK))
|
||||||
{
|
{
|
||||||
if (image.getContent() != null)
|
if (image.getContent() != null)
|
||||||
|
@ -196,17 +192,6 @@ public class WImageDialog extends Window implements EventListener<Event>
|
||||||
public boolean isCancel() {
|
public boolean isCancel() {
|
||||||
return cancel;
|
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) {
|
private void processUploadMedia(Media imageFile) {
|
||||||
if (imageFile == null)
|
if (imageFile == null)
|
||||||
|
|
Loading…
Reference in New Issue