BF [ 1888085 ] One line location field not working

BF [ 1888094 ] PF: label & label suffix not working for location field
This commit is contained in:
teo_sarca 2008-02-06 18:32:52 +00:00
parent 4e1a51836b
commit 9cef24d42a
2 changed files with 34 additions and 9 deletions

View File

@ -1274,7 +1274,8 @@ public class LayoutEngine implements Pageable, Printable, Doc
PrintElement e = null; PrintElement e = null;
if (data.getDisplayType() == DisplayType.Location) if (data.getDisplayType() == DisplayType.Location)
{ {
e = new LocationElement(m_printCtx, ((KeyNamePair)ID).getKey(), font, color); e = new LocationElement(m_printCtx, ((KeyNamePair)ID).getKey(), font, color,
item.isHeightOneLine(), label, labelSuffix);
e.layout (maxWidth, item.getMaxHeight(), item.isHeightOneLine(), FieldAlignmentType); e.layout (maxWidth, item.getMaxHeight(), item.isHeightOneLine(), FieldAlignmentType);
} }
else else

View File

@ -28,6 +28,10 @@ import org.compiere.model.*;
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: LocationElement.java,v 1.2 2006/07/30 00:53:02 jjanke Exp $ * @version $Id: LocationElement.java,v 1.2 2006/07/30 00:53:02 jjanke Exp $
*
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
* <li>BF [ 1888085 ] One line location field not working
* <li>BF [ 1888094 ] PF: label & label suffix not working for location field
*/ */
public class LocationElement extends GridElement public class LocationElement extends GridElement
{ {
@ -37,17 +41,29 @@ public class LocationElement extends GridElement
* @param C_Location_ID location * @param C_Location_ID location
* @param font font * @param font font
* @param color color * @param color color
* @param isHeightOneLine
* @param label
* @param labelSuffix
*/ */
public LocationElement(Properties ctx, int C_Location_ID, Font font, Paint color) public LocationElement(Properties ctx, int C_Location_ID, Font font, Paint color,
boolean isHeightOneLine,
String label, String labelSuffix)
{ {
super(10,1); // max super(isHeightOneLine ? 1 : 10, 1); // max
setGap(0,0); setGap(0,0);
MLocation ml = MLocation.get (ctx, C_Location_ID, null); MLocation ml = MLocation.get (ctx, C_Location_ID, null);
// log.fine("C_Location_ID=" + C_Location_ID); // log.fine("C_Location_ID=" + C_Location_ID);
if (ml != null) if (ml != null)
{ {
int index = 0; int index = 0;
if (ml.isAddressLinesReverse()) if (isHeightOneLine)
{
String line = (label != null ? label : "")
+ ml.toString()
+ (labelSuffix != null ? labelSuffix : "");
setData(index++, 0, line, font, color);
}
else if (ml.isAddressLinesReverse())
{ {
setData(index++, 0, ml.getCountry(true), font, color); setData(index++, 0, ml.getCountry(true), font, color);
String[] lines = Pattern.compile("$", Pattern.MULTILINE).split(ml.getCityRegionPostal()); String[] lines = Pattern.compile("$", Pattern.MULTILINE).split(ml.getCityRegionPostal());
@ -80,4 +96,12 @@ public class LocationElement extends GridElement
} }
} // LocationElement } // LocationElement
/**
* @deprecated since 3.3.1b
* @see #LocationElement(Properties, int, Font, Paint, boolean, String, String)
*/
public LocationElement(Properties ctx, int C_Location_ID, Font font, Paint color) {
this(ctx, C_Location_ID, font, color, false, null, null);
}
} // LocationElement } // LocationElement