IDEMPIERE-4059 Print format editor (#794)

This commit is contained in:
hengsin 2021-07-26 20:42:29 +08:00 committed by GitHub
parent 8f758ed904
commit f5dc3ba2c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 2746 additions and 18 deletions

View File

@ -0,0 +1,14 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Jul 25, 2021, 12:17:29 PM MYT
INSERT INTO AD_Message (MsgType,MsgText,MsgTip,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Print Format Editor','Visual editor for print format',0,0,'Y',TO_DATE('2021-07-25 12:17:28','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2021-07-25 12:17:28','YYYY-MM-DD HH24:MI:SS'),100,200713,'org.idempiere.printformat.editor.action.EditorAction.label','D','8c59d7b9-d69a-49a2-9031-e62696efc8ff')
;
-- Jul 25, 2021, 12:22:16 PM MYT
INSERT INTO AD_ToolBarButton (AD_Client_ID,AD_Org_ID,Created,CreatedBy,ComponentName,IsActive,AD_ToolBarButton_ID,Name,Updated,UpdatedBy,IsCustomization,ActionClassName,KeyStroke_KeyCode,KeyStroke_Modifiers,AD_ToolBarButton_UU,Action,DisplayLogic,SeqNo,IsAdvancedButton,IsAddSeparator,EntityType,IsShowMore) VALUES (0,0,TO_DATE('2021-07-25 12:22:15','YYYY-MM-DD HH24:MI:SS'),100,'PrintFormatEditor','Y',200115,'Print Format Editor',TO_DATE('2021-07-25 12:22:15','YYYY-MM-DD HH24:MI:SS'),100,'Y','org.idempiere.printformat.editor.action.EditorAction',0,0,'cc75241b-291f-4a05-8719-5a245b4ff943','W','@_WinInfo_AD_Window_ID@=240 & @AD_Client_ID@=@#AD_Client_ID@ & @AD_PrintFormat_ID@>0',0,'N','N','D','N')
;
SELECT register_migration_script('202107260400_IDEMPIERE-4059.sql') FROM dual
;

View File

@ -0,0 +1,11 @@
-- Jul 25, 2021, 12:17:29 PM MYT
INSERT INTO AD_Message (MsgType,MsgText,MsgTip,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Print Format Editor','Visual editor for print format',0,0,'Y',TO_TIMESTAMP('2021-07-25 12:17:28','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2021-07-25 12:17:28','YYYY-MM-DD HH24:MI:SS'),100,200713,'org.idempiere.printformat.editor.action.EditorAction.label','D','8c59d7b9-d69a-49a2-9031-e62696efc8ff')
;
-- Jul 25, 2021, 12:22:16 PM MYT
INSERT INTO AD_ToolBarButton (AD_Client_ID,AD_Org_ID,Created,CreatedBy,ComponentName,IsActive,AD_ToolBarButton_ID,Name,Updated,UpdatedBy,IsCustomization,ActionClassName,KeyStroke_KeyCode,KeyStroke_Modifiers,AD_ToolBarButton_UU,"action",DisplayLogic,SeqNo,IsAdvancedButton,IsAddSeparator,EntityType,IsShowMore) VALUES (0,0,TO_TIMESTAMP('2021-07-25 12:22:15','YYYY-MM-DD HH24:MI:SS'),100,'PrintFormatEditor','Y',200115,'Print Format Editor',TO_TIMESTAMP('2021-07-25 12:22:15','YYYY-MM-DD HH24:MI:SS'),100,'Y','org.idempiere.printformat.editor.action.EditorAction',0,0,'cc75241b-291f-4a05-8719-5a245b4ff943','W','@_WinInfo_AD_Window_ID@=240 & @AD_Client_ID@=@#AD_Client_ID@ & @AD_PrintFormat_ID@>0',0,'N','N','D','N')
;
SELECT register_migration_script('202107260400_IDEMPIERE-4059.sql') FROM dual
;

View File

@ -412,6 +412,7 @@
<setEntry value="org.idempiere.felix.webconsole@default:true"/>
<setEntry value="org.idempiere.hazelcast.service@default:default"/>
<setEntry value="org.idempiere.keikai@default:false"/>
<setEntry value="org.idempiere.printformat.editor@default:default"/>
<setEntry value="org.idempiere.webservices@default:default"/>
<setEntry value="org.idempiere.zk.extra@default:default"/>
</setAttribute>

View File

@ -42,4 +42,19 @@
fragment="true"
unpack="false"/>
<plugin
id="org.idempiere.keikai"
download-size="0"
install-size="0"
version="0.0.0"
fragment="true"
unpack="false"/>
<plugin
id="org.idempiere.printformat.editor"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

View File

@ -15,9 +15,12 @@ package org.adempiere.webui.action;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import org.adempiere.base.IServiceHolder;
import org.adempiere.base.Service;
import org.adempiere.webui.theme.ITheme;
import org.adempiere.webui.theme.ThemeManager;
import org.compiere.util.CCache;
import org.zkoss.image.AImage;
@ -32,6 +35,11 @@ public class Actions {
private static CCache<String, IServiceHolder<IAction>> trackerCache = new CCache<String, IServiceHolder<IAction>>(null, "ActionsServiceTracker", 5, false);
private static CCache<String, AImage> imageCache = new CCache<String, AImage>(null, "ActionsImages",5, false);
/**
*
* @param actionId
* @return {@link IServiceHolder}
*/
public static IServiceHolder<IAction> getAction(String actionId) {
IServiceHolder<IAction> action = null;
synchronized (trackerCache) {
@ -49,6 +57,11 @@ public class Actions {
return action;
}
/**
*
* @param actionId
* @return {@link AImage}
*/
public static AImage getActionImage(String actionId) {
AImage aImage = null;
synchronized (imageCache) {
@ -57,21 +70,66 @@ public class Actions {
if (aImage != null)
return aImage;
String imageName = actionId+ "24.png";
IServiceHolder<IAction> action = getAction(actionId);
if (action.getService() != null) {
String path = ACTION_IMAGES_PATH + actionId + "24.png";
InputStream inputStream = action.getService().getClass().getClassLoader().getResourceAsStream(path);
InputStream inputStream = null;
//try current theme
String themePath = ThemeManager.getThemeResource(imageName);
URL themeURL = ThemeManager.class.getResource(ThemeManager.toClassPathResourcePath(themePath));
if (themeURL != null) {
try {
inputStream = themeURL.openStream();
} catch (IOException e) {
}
}
//try plugin theme resource
if (inputStream == null) {
String path = ACTION_IMAGES_PATH + ThemeManager.getTheme() + "/" + imageName;
inputStream = action.getService().getClass().getClassLoader().getResourceAsStream(path);
}
//try plugin default theme resource
if (inputStream == null) {
if (!(ITheme.ZK_THEME_DEFAULT.equals(ThemeManager.getTheme()))) {
String path = ACTION_IMAGES_PATH + ITheme.ZK_THEME_DEFAULT + "/" + imageName;
inputStream = action.getService().getClass().getClassLoader().getResourceAsStream(path);
}
}
//fall back to plugin resource
if (inputStream == null) {
String path = ACTION_IMAGES_PATH + imageName;
inputStream = action.getService().getClass().getClassLoader().getResourceAsStream(path);
}
if (inputStream != null) {
try {
aImage = new AImage(actionId, inputStream);
} catch (IOException e) {
} finally {
try {
inputStream.close();
} catch (IOException e) {}
}
}
if (aImage != null)
if (aImage != null) {
synchronized (imageCache) {
imageCache.put(actionId, aImage);
}
}
}
return aImage;
}
/**
*
* @param actionId
* @return font icon sclass
*/
public static String getActionIconSclass(String actionId) {
IServiceHolder<IAction> action = getAction(actionId);
IAction service = action.getService();
if (service != null) {
return service.getIconSclass();
}
return "";
}
}

View File

@ -32,6 +32,12 @@ public interface IAction {
* @param toolbarButton
*/
public default void decorate(Toolbarbutton toolbarButton) {
}
/**
* @return font icon class
*/
public default String getIconSclass() {
return "";
}
}

View File

@ -300,12 +300,16 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
if (serviceHolder != null && action != null) {
String labelKey = actionId + ".label";
String tooltipKey = actionId + ".tooltip";
String label = Msg.getMsg(Env.getCtx(), labelKey);
String tooltiptext = Msg.getMsg(Env.getCtx(), tooltipKey);
String label = Msg.getMsg(Env.getCtx(), labelKey, true);
String tooltiptext = Msg.getMsg(Env.getCtx(), labelKey, false);
if (Util.isEmpty(tooltiptext, true))
tooltiptext = Msg.getMsg(Env.getCtx(), tooltipKey, true);
else
tooltipKey = labelKey;
if (labelKey.equals(label)) {
label = button.getName();
}
if (tooltipKey.equals(tooltiptext)) {
if (tooltipKey.equals(tooltiptext) || labelKey.equals(tooltiptext)) {
tooltipKey = null;
}
ToolBarButton btn = createButton(button.getComponentName(), null, tooltipKey);
@ -313,12 +317,23 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
btn.setId(button.getName());
btn.setDisabled(false);
btn.setIconSclass(null);
if (ThemeManager.isUseFontIconForImage()) {
String iconSclass = Actions.getActionIconSclass(actionId);
if (!Util.isEmpty(iconSclass, true)) {
btn.setIconSclass(iconSclass);
LayoutUtils.addSclass("font-icon-toolbar-button", btn);
}
}
//not using font icon, fallback to image or label
if (Util.isEmpty(btn.getIconSclass(), true)) {
AImage aImage = Actions.getActionImage(actionId);
if (aImage != null) {
btn.setImageContent(aImage);
} else {
btn.setLabel(label);
}
}
ToolbarCustomButton toolbarCustomBtn = new ToolbarCustomButton(button, btn, actionId, windowNo);
toolbarCustomButtons.add(toolbarCustomBtn);
@ -381,7 +396,10 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
btn.setImage(ThemeManager.getThemeResource("images/"+image + suffix));
}
}
btn.setTooltiptext(Msg.getMsg(Env.getCtx(),tooltip));
String tooltipText = Msg.getMsg(Env.getCtx(),tooltip,false);
if (Util.isEmpty(tooltipText, true))
tooltipText = Msg.getMsg(Env.getCtx(),tooltip,true);
btn.setTooltiptext(tooltipText);
LayoutUtils.addSclass("toolbar-button", btn);
buttons.put(name, btn);

View File

@ -456,13 +456,15 @@ public class DetailPane extends Panel implements EventListener<Event>, IdSpace {
String labelKey = actionId + ".label";
String tooltipKey = actionId + ".tooltip";
String label = Msg.getMsg(Env.getCtx(), labelKey);
String tooltiptext = Msg.getMsg(Env.getCtx(), tooltipKey);
String label = Msg.getMsg(Env.getCtx(), labelKey, true);
String tooltiptext = Msg.getMsg(Env.getCtx(), labelKey, false);
if (Util.isEmpty(tooltiptext, true))
tooltiptext = Msg.getMsg(Env.getCtx(), tooltipKey, true);
if ( labelKey.equals(label) ) {
label = toolbarButton.getName();
}
if ( tooltipKey.equals(tooltiptext) ) {
tooltipKey = null;
if ( tooltipKey.equals(tooltiptext) || labelKey.equals(tooltiptext)) {
tooltiptext = label;
}
ToolBarButton btn = new ToolBarButton();
btn.setName("Btn"+toolbarButton.getComponentName());

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.idempiere.printformat.editor</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.babel.editor.rbeBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>com.jaspersoft.studio.babel.editor.rbeNature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,3 @@
eclipse.preferences.version=1
pluginProject.extensions=false
resolve.requirebundle=false

View File

@ -0,0 +1,27 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Report Editor
Bundle-SymbolicName: org.idempiere.printformat.editor
Bundle-Version: 8.2.0.qualifier
Bundle-Activator: org.idempiere.printformat.editor.Activator
Bundle-Vendor: TREKGLOBAL
Import-Package: org.osgi.framework,
org.osgi.service.component;version="1.4.0",
org.osgi.service.component.annotations;version="1.3.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version>=11))"
Require-Bundle: org.adempiere.base;bundle-version="8.2.0",
org.adempiere.ui.zk;bundle-version="8.2.0",
org.adempiere.plugin.utils;bundle-version="8.2.0",
zcommon,
zel,
zhtml,
zk,
zkbind,
zkplus,
zul,
zweb
Service-Component: OSGI-INF/org.idempiere.printformat.editor.action.EditorAction.xml
Export-Package: action.images
Automatic-Module-Name: org.idempiere.printformat.editor

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.idempiere.printformat.editor.action.EditorAction">
<service>
<provide interface="org.adempiere.webui.action.IAction"/>
</service>
<implementation class="org.idempiere.printformat.editor.action.EditorAction"/>
</scr:component>

View File

@ -0,0 +1,5 @@
output.. = target/classes
bin.includes = META-INF/,\
.,\
OSGI-INF/
source.. = src/

View File

@ -0,0 +1,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.idempiere</groupId>
<artifactId>org.idempiere.parent</artifactId>
<version>8.2.0-SNAPSHOT</version>
<relativePath>../org.idempiere.parent/pom.xml</relativePath>
</parent>
<artifactId>org.idempiere.printformat.editor</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -0,0 +1,35 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Trek Global *
**********************************************************************/
package org.idempiere.printformat.editor;
import org.adempiere.plugin.utils.Incremental2PackActivator;
/**
*
* @author hengsin
*
*/
public class Activator extends Incremental2PackActivator {
}

View File

@ -0,0 +1,86 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Trek Global *
**********************************************************************/
package org.idempiere.printformat.editor;
import org.compiere.print.MPrintFormatItem;
/**
*
* @author hengsin
*
*/
public class FieldPosition {
private MPrintFormatItem pfItem;
private float x;
private float y;
/**
*
* @return {@link MPrintFormatItem}
*/
public MPrintFormatItem getPrintFormatItem() {
return pfItem;
}
/**
*
* @param pfItem
*/
public void setPrintFormatItem(MPrintFormatItem pfItem) {
this.pfItem = pfItem;
}
/**
*
* @return x
*/
public float getX() {
return x;
}
/**
*
* @param x
*/
public void setX(float x) {
this.x = x;
}
/**
*
* @return y
*/
public float getY() {
return y;
}
/**
*
* @param y
*/
public void setY(float y) {
this.y = y;
}
}

View File

@ -0,0 +1,115 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Trek Global *
**********************************************************************/
package org.idempiere.printformat.editor;
/**
* @author hengsin
*
*/
public class PrintAreaBean {
private float pointX;
private float pointY;
private float currentX;
private float currentY;
/**
*
* @param areaType
* @param x
* @param y
*/
public PrintAreaBean(int areaType, float x, float y) {
super();
this.currentX = x;
this.currentY = y;
pointX = x;
pointY = y;
}
/**
*
* @return x
*/
public float getPointX() {
return pointX;
}
/**
*
* @param pointX
*/
public void setPointX(float pointX) {
this.pointX = pointX;
}
/**
*
* @return y
*/
public float getPointY() {
return pointY;
}
/**
*
* @param pointY
*/
public void setPointY(float pointY) {
this.pointY = pointY;
}
/**
*
* @return current x
*/
public float getCurrentX() {
return currentX;
}
/**
*
* @param currentX
*/
public void setCurrentX(float currentX) {
this.currentX = currentX;
}
/**
*
* @return current y
*/
public float getCurrentY() {
return currentY;
}
/**
*
* @param currentY
*/
public void setCurrentY(float currentY) {
this.currentY = currentY;
}
}

View File

@ -0,0 +1,65 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Trek Global *
**********************************************************************/
package org.idempiere.printformat.editor.action;
import org.adempiere.webui.action.IAction;
import org.adempiere.webui.adwindow.ADWindow;
import org.compiere.util.Env;
import org.idempiere.printformat.editor.ui.WPrintFormatEditor;
import org.osgi.service.component.annotations.Component;
/**
* @author hengsin
*
*/
@Component(name="org.idempiere.printformat.editor.action.EditorAction", immediate = true, service = IAction.class)
public class EditorAction implements IAction {
/**
* default constructor
*/
public EditorAction() {
}
/* (non-Javadoc)
* @see org.adempiere.webui.action.IAction#execute(java.lang.Object)
*/
@Override
public void execute(Object target) {
ADWindow adwindow = (ADWindow) target;
int windowNo = adwindow.getADWindowContent().getWindowNo();
int AD_PrintFormat_ID = Env.getContextAsInt(Env.getCtx(), windowNo, "AD_PrintFormat_ID", true);
if (AD_PrintFormat_ID > 0) {
WPrintFormatEditor editor = new WPrintFormatEditor(AD_PrintFormat_ID, adwindow.getADWindowContent());
editor.showEditorWindow();
}
}
@Override
public String getIconSclass() {
return "z-icon-th-list";
}
}

View File

@ -0,0 +1,147 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Trek Global *
**********************************************************************/
package org.idempiere.printformat.editor.ui;
import org.compiere.print.MPrintFormatItem;
import org.compiere.util.DisplayType;
import org.compiere.util.Util;
import org.zkoss.zk.ui.HtmlBasedComponent;
/**
* @author milap
* @author hengsin
*
*/
public class PrintFormatEditorUtil {
public static void addCSSStyle(HtmlBasedComponent comp, String style,
boolean isAppend) {
if (!Util.isEmpty(comp.getStyle(), true) && isAppend) {
comp.setStyle(comp.getStyle() + style);
} else {
comp.setStyle(style);
}
}
public static int pointToPixel(float point) {
return Float.valueOf(point * 4 / 3).intValue();
}
public static float pixelToPointValue(int pixel) {
return pixel * 3f / 4f;
}
public static float inchToPointValue(float inch) {
return inch * 72;
}
public static float mmToPointValue(float mm) {
return inchToPointValue(mm / 25.4f);
}
public static String getCSSFontFamily(String fontFamily) {
if ("Dialog".equals(fontFamily) || "DialogInput".equals(fontFamily)
|| "SansSerif".equals(fontFamily)) {
return "sans-serif";
} else if ("SansSerif".equals(fontFamily)) {
return "sans-serif";
} else if ("Serif".equals(fontFamily)) {
return "serif";
} else if ("Monospaced".equals(fontFamily)) {
return "monospace";
}
return null;
}
public static String getAlignmentStyleCSS(MPrintFormatItem pfItem) {
String retValue = "left";
String align = pfItem.getFieldAlignmentType();
if (align != null) {
if (align.equalsIgnoreCase("L"))
retValue = "left";
else if (align.equalsIgnoreCase("T"))
retValue = "right";
else if (align.equals("C"))
retValue = "center";
}
if (align == null || align.equalsIgnoreCase("D")) {
if (DisplayType.isNumeric(pfItem.getAD_Column()
.getAD_Reference_ID())) {
retValue = "right";
} else {
retValue = "left";
}
}
return retValue;
}
public static void setX(MPrintFormatItem pfItem, float xVal)
{
if(!pfItem.isRelativePosition())
{
pfItem.setXPosition(Float.valueOf(xVal).intValue());
}
else
pfItem.setXSpace(Float.valueOf(xVal).intValue());
}
public static void setY(MPrintFormatItem pfItem, float yVal)
{
if(!pfItem.isRelativePosition())
{
pfItem.setYPosition(Float.valueOf(yVal).intValue());
}
else
pfItem.setYSpace(Float.valueOf(yVal).intValue());
}
public static int getX(MPrintFormatItem pfItem)
{
int retVal = 0;
if(!pfItem.isRelativePosition())
{
retVal = pfItem.getXPosition();
}
else
retVal = pfItem.getXSpace();
return retVal;
}
public static int getY(MPrintFormatItem pfItem)
{
int retVal = 0;
if(!pfItem.isRelativePosition())
{
retVal = pfItem.getYPosition();
}
else
retVal = pfItem.getYSpace();
return retVal;
}
}

View File

@ -0,0 +1,670 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Trek Global *
**********************************************************************/
package org.idempiere.printformat.editor.ui;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Column;
import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory;
import org.adempiere.webui.component.Group;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListHead;
import org.adempiere.webui.component.ListHeader;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.component.ZkCssHelper;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WNumberEditor;
import org.adempiere.webui.editor.WStringEditor;
import org.adempiere.webui.editor.WTableDirEditor;
import org.adempiere.webui.editor.WYesNoEditor;
import org.adempiere.webui.util.ZKUpdateUtil;
import org.compiere.model.MColumn;
import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory;
import org.compiere.print.MPrintFormatItem;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.zkoss.zk.ui.HtmlBasedComponent;
import org.zkoss.zk.ui.event.DropEvent;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.event.KeyEvent;
import org.zkoss.zul.Absolutelayout;
import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Cell;
import org.zkoss.zul.Center;
import org.zkoss.zul.Columns;
import org.zkoss.zul.Div;
import org.zkoss.zul.East;
import org.zkoss.zul.Separator;
import org.zkoss.zul.South;
import org.zkoss.zul.Vlayout;
import org.zkoss.zul.West;
/**
*
* @author hengsin
*
*/
public class WPrintFormatEditorForm extends Window
{
/**
* generated serial id
*/
private static final long serialVersionUID = -2533099650671242190L;
private WPrintFormatEditor pfe;
protected Borderlayout mainLayout = new Borderlayout();
private ConfirmPanel confirmPanel = new ConfirmPanel(true, false, true, false, false, false);
protected Listbox printedItemListbox = new Listbox();
protected Listbox nonPrintedItemListbox = new Listbox();
private Div centerDiv;
private Vlayout westPaneLayout;
protected Absolutelayout printLayout = null;
protected WEditor editorName = null;
protected WEditor editorPrintName = null;
protected WEditor editorSeqNo = null;
protected WEditor fieldAlignment = null;
protected WEditor maxWidth = null;
protected WEditor maxHeight = null;
protected WEditor fixedWidth = null;
protected WEditor printFont = null;
protected WEditor imageField = null;
protected WEditor imageAttached = null;
protected WEditor imageUrl = null;
protected WEditor lineAlignment = null;
protected WEditor lineWidth = null;
protected WEditor includedPrintFormat = null;
protected WEditor shapeType = null;
protected WEditor oneLineOnly = null;
protected WEditor nextLine = null;
protected WEditor nextPage = null;
protected WEditor xSpace = null;
protected WEditor ySpace = null;
protected WEditor xPosition = null;
protected WEditor yPosition = null;
protected WYesNoEditor relativePosition = null;
protected WEditor setNLPosition = null;
protected WEditor supressNull = null;
protected WEditor printColor = null;
protected WEditor fillShape = null;
protected WEditor arcDiameter = null;
protected WEditor printAreaType = null;
protected WEditor editorTestValue = null;
protected WEditor belowColumn = null;
/**
*
* @param printFormatEditor
*/
public WPrintFormatEditorForm(WPrintFormatEditor printFormatEditor) {
pfe = printFormatEditor;
}
/**
* Static init
*
* @throws Exception
*/
public void init() throws Exception {
setSizable(false);
setClosable(true);
setMaximizable(true);
setMaximized(true);
appendChild(mainLayout);
LayoutUtils.addSclass("tab-editor-form-content", mainLayout);
setBorder("normal");
confirmPanel.addActionListener(Events.ON_CLICK, e -> pfe.onConfirmPanelClick(e));
addEventListener(Events.ON_CANCEL, e -> pfe.onCancel());
Borderlayout eastPaneLayout = new Borderlayout();
Center eastPaneCenter = new Center();
Grid propGrid = initPropertiesGrid();
ZKUpdateUtil.setVflex(propGrid, "1");
eastPaneCenter.appendChild(propGrid);
eastPaneLayout.appendChild(eastPaneCenter);
South south = new South();
eastPaneLayout.appendChild(south);
ZKUpdateUtil.setVflex(confirmPanel, "min");
ZKUpdateUtil.setHflex(confirmPanel, "1");
south.appendChild(confirmPanel);
ZKUpdateUtil.setWidth(eastPaneLayout, "100%");
ZKUpdateUtil.setHeight(eastPaneLayout, "100%");
East east = new East();
LayoutUtils.addSclass("tab-editor-form-east-panel", east);
mainLayout.appendChild(east);
east.appendChild(eastPaneLayout);
ZKUpdateUtil.setWidth(east, "25%");
Label formatItemLabel = new Label();
ListHead printedHead = new ListHead();
printedHead.setParent(printedItemListbox);
ListHeader visibleHeader = new ListHeader();
formatItemLabel.setText("Displayed");
visibleHeader.appendChild(formatItemLabel);
visibleHeader.setParent(printedHead);
ListHead nonPrintedHead = new ListHead();
nonPrintedHead.setParent(nonPrintedItemListbox);
ListHeader nonPrintedHeader = new ListHeader();
nonPrintedHeader.appendChild(new Label("Not Displayed"));
nonPrintedHeader.setParent(nonPrintedHead);
westPaneLayout = new Vlayout();
ZKUpdateUtil.setHeight(westPaneLayout, "100%");
westPaneLayout.appendChild(printedItemListbox);
ZKUpdateUtil.setVflex(printedItemListbox, "1");
westPaneLayout.appendChild(nonPrintedItemListbox);
ZKUpdateUtil.setVflex(nonPrintedItemListbox, "1");
printedItemListbox.addEventListener(Events.ON_DROP, (DropEvent e) -> pfe.onDrop(e));
nonPrintedItemListbox.addEventListener(Events.ON_DROP, (DropEvent e) -> pfe.onDrop(e));
West west = new West();
LayoutUtils.addSclass("tab-editor-form-west-panel", west);
mainLayout.appendChild(west);
west.appendChild(westPaneLayout);
west.setCollapsible(true);
west.setSplittable(true);
ZKUpdateUtil.setWidth(west, "200px");
Center center = new Center();
centerDiv = new Div();
PrintFormatEditorUtil
.addCSSStyle(
centerDiv,
"border: dashed 1px black; overflow: auto; background-color: grey;",
false);
ZKUpdateUtil.setHeight(centerDiv, "100%");
Div previewDiv = new Div();
ZKUpdateUtil.setHeight(previewDiv, pfe.paperHeight + "pt");
ZKUpdateUtil.setWidth(previewDiv, pfe.paperWidth + "pt");
printLayout = new Absolutelayout();
PrintFormatEditorUtil.addCSSStyle(printLayout,
" border: 1px black solid; background-color:#E1E1E1;", false);
ZKUpdateUtil.setWidth(printLayout, (pfe.paperWidth + "pt"));
ZKUpdateUtil.setHeight(printLayout, (pfe.paperHeight + "pt"));
printLayout.setDroppable("true");
printLayout.addEventListener(Events.ON_DROP, (DropEvent e) -> pfe.onDrop(e));
previewDiv.appendChild(printLayout);
centerDiv.appendChild(previewDiv);
center.appendChild(centerDiv);
mainLayout.appendChild(center);
setCtrlKeys("#left#right#up#down#del");
addEventListener(Events.ON_CTRL_KEY, (KeyEvent e) -> pfe.onCtrlKey(e));
ZkCssHelper.appendStyle(printLayout, "overflow: auto;");
}
/**
* Initialize Grid of Field's Properties return @Grid
*/
private Grid initPropertiesGrid() {
Grid gridView = GridFactory.newGridLayout();
//
Columns columns = new Columns();
gridView.appendChild(columns);
//
Column column = new Column();
columns.appendChild(column);
ZKUpdateUtil.setHflex(column, "min");
column.setAlign("right");
column = new Column();
columns.appendChild(column);
ZKUpdateUtil.setHflex(column, "1");
Rows rows = new Rows();
gridView.appendChild(rows);
Row row = null;
row = new Row();
Group group = new Group(Msg.getMsg(Env.getCtx(), "Property"));
Cell cell = (Cell) group.getFirstChild();
cell.setSclass("z-group-inner");
cell.setColspan(2);
cell.setAlign("left");
group.setOpen(true);
rows.appendChild(group);
row = new Row();
Label labelName = new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_Name));
editorName = new WStringEditor(MPrintFormatItem.COLUMNNAME_Name, false,
false, false, 0, 0, null, null);
editorName.fillHorizontal();
row.appendChild(labelName.rightAlign());
row.appendChild(editorName.getComponent());
row.setGroup(group);
rows.appendChild(row);
row = new Row();
Label labelPrintName = new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_PrintName));
editorPrintName = new WStringEditor(MPrintFormatItem.COLUMNNAME_PrintName, false,
false, false, 0, 0, null, null);
editorPrintName.fillHorizontal();
row.appendChild(labelPrintName.rightAlign());
row.appendChild(editorPrintName.getComponent());
row.setGroup(group);
rows.appendChild(row);
row = new Row();
Label labelTestValue = new Label(Msg.getElement(Env.getCtx(), "TestValue"));
editorTestValue = new WStringEditor("_TestValue_", false,
false, true, 0, 0, null, null);
editorTestValue.fillHorizontal();
editorTestValue.addValueChangeListener(pfe);
row.appendChild(labelTestValue.rightAlign());
row.appendChild(editorTestValue.getComponent());
row.setGroup(group);
rows.appendChild(row);
row = new Row();
Label labelSeqNo = new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_SeqNo));
editorSeqNo = new WNumberEditor(MPrintFormatItem.COLUMNNAME_SeqNo,
false, false, false, DisplayType.Integer, labelSeqNo.getValue());
editorSeqNo.fillHorizontal();
row.appendChild(labelSeqNo.rightAlign());
row.appendChild(editorSeqNo.getComponent());
row.setGroup(group);
rows.appendChild(row);
row = new Row();
Label imgURL = new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_ImageURL));
imageUrl = new WStringEditor(MPrintFormatItem.COLUMNNAME_ImageURL, false,
false, false, 0, 0, null, null);
ZKUpdateUtil.setHflex((HtmlBasedComponent) imageUrl.getComponent(), "1");
row.appendChild(imgURL.rightAlign());
row.appendChild(imageUrl.getComponent());
row.setGroup(group);
rows.appendChild(row);
row = new Row();
Label labelXPos = new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_XPosition));
xPosition = new WNumberEditor(MPrintFormatItem.COLUMNNAME_XPosition,
true, false, true, DisplayType.Integer, labelXPos.getValue());
xPosition.fillHorizontal();
row.appendChild(labelXPos.rightAlign());
row.appendChild(xPosition.getComponent());
xPosition.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
Label labelYPos = new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_YPosition));
yPosition = new WNumberEditor(MPrintFormatItem.COLUMNNAME_YPosition,
true, false, true, DisplayType.Integer, labelYPos.getValue());
yPosition.fillHorizontal();
row.appendChild(labelYPos.rightAlign());
row.appendChild(yPosition.getComponent());
yPosition.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
Label labelXSpace = new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_XSpace));
xSpace = new WNumberEditor(MPrintFormatItem.COLUMNNAME_XSpace, true,
false, true, DisplayType.Integer, labelXSpace.getValue());
xSpace.fillHorizontal();
row.appendChild(labelXSpace.rightAlign());
row.appendChild(xSpace.getComponent());
xSpace.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
Label labelYSpace = new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_YSpace));
ySpace = new WNumberEditor(MPrintFormatItem.COLUMNNAME_YSpace, true,
false, true, DisplayType.Integer, labelYSpace.getValue());
ySpace.fillHorizontal();
row.appendChild(labelYSpace.rightAlign());
row.appendChild(ySpace.getComponent());
ySpace.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
Label lblMaxHeight = new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_MaxHeight));
maxHeight = new WNumberEditor(MPrintFormatItem.COLUMNNAME_MaxHeight,
true, false, true, DisplayType.Integer, lblMaxHeight.getValue());
maxHeight.fillHorizontal();
row.appendChild(lblMaxHeight.rightAlign());
row.appendChild(maxHeight.getComponent());
maxHeight.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
Label lblMaxWidth = new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_MaxWidth));
maxWidth = new WNumberEditor(MPrintFormatItem.COLUMNNAME_MaxWidth,
true, false, true, DisplayType.Integer, lblMaxWidth.getValue());
maxWidth.fillHorizontal();
row.appendChild(lblMaxWidth.rightAlign());
row.appendChild(maxWidth.getComponent());
maxWidth.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
Label label = new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_ArcDiameter));
arcDiameter = new WNumberEditor(
MPrintFormatItem.COLUMNNAME_ArcDiameter, true, false, true,
DisplayType.Integer, label.getValue());
arcDiameter.fillHorizontal();
row.appendChild(label.rightAlign());
row.appendChild(arcDiameter.getComponent());
arcDiameter.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
label = new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_LineWidth));
lineWidth = new WNumberEditor(MPrintFormatItem.COLUMNNAME_LineWidth,
true, false, true, DisplayType.Integer, label.getValue());
lineWidth.fillHorizontal();
row.appendChild(label.rightAlign());
row.appendChild(lineWidth.getComponent());
lineWidth.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
row.appendChild(new Label(Msg.getElement(
Env.getCtx(),
MPrintFormatItem.COLUMNNAME_IsRelativePosition)));
relativePosition = new WYesNoEditor(
MPrintFormatItem.COLUMNNAME_IsRelativePosition, "", null,
false, false, true);
row.appendChild(relativePosition.getComponent());
relativePosition.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
row.appendChild(new Label(Msg.getElement(
Env.getCtx(),
MPrintFormatItem.COLUMNNAME_IsSuppressNull)));
supressNull = new WYesNoEditor(
MPrintFormatItem.COLUMNNAME_IsSuppressNull, "", null,
false, false, true);
row.appendChild(supressNull.getComponent());
supressNull.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
row.appendChild(new Label(Msg.getElement(
Env.getCtx(),
MPrintFormatItem.COLUMNNAME_IsSetNLPosition)));
setNLPosition = new WYesNoEditor(
MPrintFormatItem.COLUMNNAME_IsSetNLPosition, "", null,
false, false, true);
row.appendChild(setNLPosition.getComponent());
setNLPosition.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
row.appendChild(new Label( Msg.getElement(
Env.getCtx(),
MPrintFormatItem.COLUMNNAME_IsFilledRectangle)));
fillShape = new WYesNoEditor(
MPrintFormatItem.COLUMNNAME_IsFilledRectangle,"", null,
false, false, true);
row.appendChild(fillShape.getComponent());
fillShape.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
row.appendChild(new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_IsNextPage)));
nextPage = new WYesNoEditor(MPrintFormatItem.COLUMNNAME_IsNextPage,
"", null, false,
false, true);
row.appendChild(nextPage.getComponent());
nextPage.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
row.appendChild(new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_IsNextLine)));
nextLine = new WYesNoEditor(MPrintFormatItem.COLUMNNAME_IsNextLine,
"", null, false,
false, true);
row.appendChild(nextLine.getComponent());
nextLine.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
row.appendChild(new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_BelowColumn)));
belowColumn = new WNumberEditor(MPrintFormatItem.COLUMNNAME_BelowColumn,
false, false, true, DisplayType.Integer, "");
row.appendChild(belowColumn.getComponent());
belowColumn.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
row.appendChild(new Label(Msg.getElement(
Env.getCtx(),
MPrintFormatItem.COLUMNNAME_IsHeightOneLine)));
oneLineOnly = new WYesNoEditor(
MPrintFormatItem.COLUMNNAME_IsHeightOneLine, "", null,
false, false, true);
row.appendChild(oneLineOnly.getComponent());
oneLineOnly.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
row.appendChild(new Label(Msg.getElement(
Env.getCtx(),
MPrintFormatItem.COLUMNNAME_ImageIsAttached)));
imageAttached = new WYesNoEditor(
MPrintFormatItem.COLUMNNAME_ImageIsAttached, "", null,
false, false, true);
row.appendChild(imageAttached.getComponent());
imageAttached.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
row.appendChild(new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_IsImageField)));
imageField = new WYesNoEditor(MPrintFormatItem.COLUMNNAME_IsImageField,
"", null, false,
false, true);
row.appendChild(imageField.getComponent());
imageField.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
row.appendChild(new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_IsFixedWidth)));
fixedWidth = new WYesNoEditor(MPrintFormatItem.COLUMNNAME_IsFixedWidth,
"", null, false,
false, true);
row.appendChild(fixedWidth.getComponent());
fixedWidth.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
label = new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_PrintAreaType));
int columnID = MColumn.getColumn_ID(MPrintFormatItem.Table_Name,
MPrintFormatItem.COLUMNNAME_PrintAreaType);
MLookup lookup = MLookupFactory.get(Env.getCtx(), 0, 0, columnID,
DisplayType.List);
printAreaType = new WTableDirEditor(
MPrintFormatItem.COLUMNNAME_PrintAreaType, false, false, true,
lookup);
printAreaType.fillHorizontal();
row.appendChild(label.rightAlign());
row.appendChild(printAreaType.getComponent());
printAreaType.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
label = new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_AD_PrintFont_ID));
columnID = MColumn.getColumn_ID(MPrintFormatItem.Table_Name,
MPrintFormatItem.COLUMNNAME_AD_PrintFont_ID);
lookup = MLookupFactory.get(Env.getCtx(), 0, 0, columnID,
DisplayType.TableDir);
printFont = new WTableDirEditor(
MPrintFormatItem.COLUMNNAME_AD_PrintFont_ID, false, false,
true, lookup);
printFont.fillHorizontal();
row.appendChild(label.rightAlign());
row.appendChild(printFont.getComponent());
printFont.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
label = new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_AD_PrintColor_ID));
columnID = MColumn.getColumn_ID(MPrintFormatItem.Table_Name,
MPrintFormatItem.COLUMNNAME_AD_PrintColor_ID);
lookup = MLookupFactory.get(Env.getCtx(), 0, 0, columnID,
DisplayType.TableDir);
printColor = new WTableDirEditor(
MPrintFormatItem.COLUMNNAME_AD_PrintColor_ID, false, false,
true, lookup);
printColor.fillHorizontal();
row.appendChild(label.rightAlign());
row.appendChild(printColor.getComponent());
printColor.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
label = new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_AD_PrintFormatChild_ID));
columnID = MColumn.getColumn_ID(MPrintFormatItem.Table_Name,
MPrintFormatItem.COLUMNNAME_AD_PrintFormatChild_ID);
lookup = MLookupFactory.get(Env.getCtx(), 0, 0, columnID,
DisplayType.Table);
includedPrintFormat = new WTableDirEditor(
MPrintFormatItem.COLUMNNAME_AD_PrintFormatChild_ID, false,
false, true, lookup);
row.appendChild(label.rightAlign());
row.appendChild(includedPrintFormat.getComponent());
includedPrintFormat.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
label = new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_LineAlignmentType));
columnID = MColumn.getColumn_ID(MPrintFormatItem.Table_Name,
MPrintFormatItem.COLUMNNAME_LineAlignmentType);
lookup = MLookupFactory.get(Env.getCtx(), 0, 0, columnID,
DisplayType.List);
lineAlignment = new WTableDirEditor(
MPrintFormatItem.COLUMNNAME_LineAlignmentType, false, false,
true, lookup);
lineAlignment.fillHorizontal();
row.appendChild(label.rightAlign());
row.appendChild(lineAlignment.getComponent());
lineAlignment.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
label = new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_FieldAlignmentType));
columnID = MColumn.getColumn_ID(MPrintFormatItem.Table_Name,
MPrintFormatItem.COLUMNNAME_FieldAlignmentType);
lookup = MLookupFactory.get(Env.getCtx(), 0, 0, columnID,
DisplayType.List);
fieldAlignment = new WTableDirEditor(
MPrintFormatItem.COLUMNNAME_FieldAlignmentType, false, false,
true, lookup);
fieldAlignment.fillHorizontal();
row.appendChild(label.rightAlign());
row.appendChild(fieldAlignment.getComponent());
fieldAlignment.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
label = new Label(Msg.getElement(Env.getCtx(),
MPrintFormatItem.COLUMNNAME_ShapeType));
columnID = MColumn.getColumn_ID(MPrintFormatItem.Table_Name,
MPrintFormatItem.COLUMNNAME_ShapeType);
lookup = MLookupFactory.get(Env.getCtx(), 0, 0, columnID,
DisplayType.List);
shapeType = new WTableDirEditor(MPrintFormatItem.COLUMNNAME_ShapeType,
false, false, true, lookup);
row.appendChild(label.rightAlign());
row.appendChild(shapeType.getComponent());
shapeType.addValueChangeListener(pfe);
row.setGroup(group);
rows.appendChild(row);
row = new Row();
Separator esep = new Separator("horizontal");
esep.setSpacing("10px");
row.appendChild(esep);
row.setGroup(group);
rows.appendChild(row);
return gridView;
}
}

View File

@ -37,6 +37,7 @@
<module>org.idempiere.webservices-feature</module>
<module>org.idempiere.zk.extra</module>
<module>org.idempiere.keikai</module>
<module>org.idempiere.printformat.editor</module>
<module>org.adempiere.report.jasper-feature</module>
<module>org.adempiere.base-feature</module>
<module>org.adempiere.replication-feature</module>