AL-4280 preview layout

master
Lucas 2024-07-18 22:36:57 -03:00
parent 3bdada3519
commit d3482af9fc
7 changed files with 40 additions and 9 deletions

View File

@ -4,11 +4,11 @@
<modelVersion>4.0.0</modelVersion>
<groupId>br.com.rjconsultores</groupId>
<artifactId>ventaboletosadm</artifactId>
<version>1.111.0</version>
<version>1.112.0</version>
<packaging>war</packaging>
<properties>
<modelWeb.version>1.85.0</modelWeb.version>
<modelWeb.version>1.86.0</modelWeb.version>
<flyway.version>1.73.0</flyway.version>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

View File

@ -1,14 +1,18 @@
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.util.HtmlUtils;
import org.zkforge.ckez.CKeditor;
import org.zkoss.util.resource.Labels;
import org.zkoss.zhtml.Messagebox;
@ -18,10 +22,13 @@ import org.zkoss.zk.ui.event.Event;
import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Button;
import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Image;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.Vlayout;
import com.rjconsultores.ventaboletos.entidad.ImpresionLayoutConfig;
import com.rjconsultores.ventaboletos.enums.EnumLinguagemImpresion;
import com.rjconsultores.ventaboletos.rest.LabelaryService;
import com.rjconsultores.ventaboletos.service.ImpresionLayoutConfigService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
@ -45,6 +52,8 @@ public class EditarImpresionLayoutConfigController extends MyGenericForwardCompo
private List<EnumLinguagemImpresion> lsEnumLinguagemImpresion;
private Vlayout layoutCkEditor;
private Borderlayout layoutTextZpl;
private Textbox txtTexto;
private Image img;
private static Logger log = LogManager.getLogger(EditarImpresionLayoutConfigController.class);
@Override
@ -67,6 +76,11 @@ public class EditarImpresionLayoutConfigController extends MyGenericForwardCompo
}
ckTexto.setValue(impresionLayoutConfig.getTexto());
if (StringUtils.isNotBlank(impresionLayoutConfig.getTexto())
&& EnumLinguagemImpresion.ZPL.equals(impresionLayoutConfig.getLinguagem())) {
img.setContent(new org.zkoss.image.AImage("preview.png", retornaImagem(impresionLayoutConfig.getTexto())));
}
}
public void onClick$btnSalvar(Event ev) throws InterruptedException {
@ -167,6 +181,22 @@ public class EditarImpresionLayoutConfigController extends MyGenericForwardCompo
}
public void onClick$btnRedesenhar(Event ev) throws InterruptedException {
try {
img.setContent(new org.zkoss.image.AImage("preview.png", retornaImagem(txtTexto.getText())));
} catch (IOException e) {
log.error("editarImpresionLayoutConfigController: " + e);
Messagebox.show(e.getLocalizedMessage(),
Labels.getLabel("editarImpresionLayoutConfigController.window.title"), Messagebox.OK,
Messagebox.ERROR);
}
}
private InputStream retornaImagem(String texto) {
return LabelaryService.getInstance().retornarImagem(HtmlUtils.htmlEscape(texto));
}
public ImpresionLayoutConfigService getImpresionLayoutConfigService() {
return impresionLayoutConfigService;
}

View File

@ -5261,6 +5261,7 @@ editarImagemController.fileupload.label = Select Image
editarImagemController.lbNome.value = Image
# Pantalla Editar Imagem
editarImagemController.window.title = Image
editarImpresionLayoutConfigController.btnRedesenhar.value = Redraw
editarImpresionLayoutConfigController.MSG.borrarOK = Layout Deleted Successfully.
editarImpresionLayoutConfigController.MSG.borrarPergunta = Delete Layout?
editarImpresionLayoutConfigController.MSG.suscribirOK = Layout Registered Successfully.

View File

@ -5194,6 +5194,7 @@ editarImagemController.fileupload.label = Selecionar Imagem
editarImagemController.lbNome.value = Imagem
# Pantalla Editar Imagem
editarImagemController.window.title = Imagem
editarImpresionLayoutConfigController.btnRedesenhar.value = Rediseñar
editarImpresionLayoutConfigController.MSG.borrarOK = Artículo eliminado con éxito.
editarImpresionLayoutConfigController.MSG.borrarPergunta = ¿Eliminar artículo?
editarImpresionLayoutConfigController.MSG.suscribirOK = Artículo registrado exitosamente.

View File

@ -5190,6 +5190,7 @@ editarImagemController.fileupload.label = Sélectionner une image
editarImagemController.lbNome.value = Images
# Pantalla Editar Imagem
editarImagemController.window.title = Images
editarImpresionLayoutConfigController.btnRedesenhar.value = Refonte
editarImpresionLayoutConfigController.MSG.borrarOK = Article supprimé avec succès.
editarImpresionLayoutConfigController.MSG.borrarPergunta = Supprimer l'article ?
editarImpresionLayoutConfigController.MSG.suscribirOK = Article enregistré avec succès.

View File

@ -5193,6 +5193,7 @@ editarImagemController.fileupload.label = Selecionar Imagem
editarImagemController.lbNome.value = Imagem
# Pantalla Editar Imagem
editarImagemController.window.title = Imagem
editarImpresionLayoutConfigController.btnRedesenhar.value = Redesenhar
editarImpresionLayoutConfigController.MSG.borrarOK = Layout Excluido com Sucesso.
editarImpresionLayoutConfigController.MSG.borrarPergunta = Eliminar Layout?
editarImpresionLayoutConfigController.MSG.suscribirOK = Layout Registrado com Sucesso.

View File

@ -57,24 +57,21 @@
</vlayout>
<borderlayout id="layoutTextZpl" height="450px" visible="false">
<borderlayout id="layoutTextZpl" height="1000px" visible="false">
<center border="0">
<borderlayout>
<west size="60%" border="0" splittable="true">
<div vflex="1">
<textbox id="txtTexto" tabbable="true" multiline="true" width="100%" height="600px"
<textbox id="txtTexto" tabbable="true" multiline="true" width="100%" height="100%"
value="@{winEditarImpresionLayoutConfig$composer.impresionLayoutConfig.texto}" />
</div>
</west>
<center>
<vlayout>
<button label="Redesenhar"/>
<image
src="/gui/img/Question_mark_1.png"
tooltiptext="${c:l('busquedaConfTotemController.permitirTecladoAlfaNumerico.ajuda')}"
style="cursor: help" />
<button id="btnRedesenhar" label="${c:l('editarImpresionLayoutConfigController.btnRedesenhar.value')}"/>
<image id="img" droppable="true" width="100%" height="100%" />
</vlayout>