IDEMPIERE-2469:ZK7 Grid Column sometimes too wide - wrongly calculated

This commit is contained in:
hieplq 2015-02-18 22:17:50 +07:00
parent caab6efad4
commit f7a2ae5065
4 changed files with 15 additions and 9 deletions

View File

@ -42,6 +42,13 @@ public class ListboxFactory {
return dataTable;
}
public static WListbox newDataTableAutoSize() {
WListbox listBox = newDataTable();
listBox.setSizedByContent(true);
listBox.setSpan(true);
return listBox;
}
public static Listbox newDropdownListbox(String[] items) {
Listbox listbox = newDropdownListbox();

View File

@ -284,7 +284,7 @@ public class WListItemRenderer implements ListitemRenderer<Object>, EventListene
else
{
listcell.setLabel(format.format(((Number)field).doubleValue()));
ZkCssHelper.appendStyle(listcell, "width: 96%; text-align: right");
ZkCssHelper.appendStyle(listcell, "text-align: right");
}
}
}
@ -303,7 +303,7 @@ public class WListItemRenderer implements ListitemRenderer<Object>, EventListene
else
{
listcell.setLabel(dateFormat.format((Timestamp)field));
ZkCssHelper.appendStyle(listcell, "width: 96%; margin: auto");
ZkCssHelper.appendStyle(listcell, "margin: auto");
}
}
else if (field instanceof String)
@ -340,7 +340,6 @@ public class WListItemRenderer implements ListitemRenderer<Object>, EventListene
else
{
listcell.setLabel(field.toString());
ZkCssHelper.appendStyle(listcell, "width: 96%;");
}
}
}
@ -358,7 +357,6 @@ public class WListItemRenderer implements ListitemRenderer<Object>, EventListene
{
listcell.setLabel(field.toString());
listcell.setValue(field.toString());
ZkCssHelper.appendStyle(listcell, "width: 96%;");
}
}
else

View File

@ -163,7 +163,7 @@ public class InfoProductWindow extends InfoWindow {
String s_sqlFrom = " M_PRODUCT_STOCK_V ";
/** Where Clause */
String s_sqlWhere = "M_Product_ID = ?";
warehouseTbl = ListboxFactory.newDataTable();
warehouseTbl = ListboxFactory.newDataTableAutoSize();
m_sqlWarehouse = warehouseTbl.prepareTable(s_layoutWarehouse, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_STOCK_V");
m_sqlWarehouse += " GROUP BY Warehouse";
warehouseTbl.setMultiSelection(false);
@ -184,7 +184,7 @@ public class InfoProductWindow extends InfoWindow {
new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "PriceStd", Double.class)};
s_sqlFrom = "M_PRODUCT_SUBSTITUTERELATED_V";
s_sqlWhere = "M_Product_ID = ? AND M_PriceList_Version_ID = ? and RowType = 'S'";
substituteTbl = ListboxFactory.newDataTable();
substituteTbl = ListboxFactory.newDataTableAutoSize();
m_sqlSubstitute = substituteTbl.prepareTable(s_layoutSubstitute, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_SUBSTITUTERELATED_V");
substituteTbl.setMultiSelection(false);
substituteTbl.autoSize();
@ -203,14 +203,14 @@ public class InfoProductWindow extends InfoWindow {
new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "PriceStd", Double.class)};
s_sqlFrom = "M_PRODUCT_SUBSTITUTERELATED_V";
s_sqlWhere = "M_Product_ID = ? AND M_PriceList_Version_ID = ? and RowType = 'R'";
relatedTbl = ListboxFactory.newDataTable();
relatedTbl = ListboxFactory.newDataTableAutoSize();
m_sqlRelated = relatedTbl.prepareTable(s_layoutRelated, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_SUBSTITUTERELATED_V");
relatedTbl.setMultiSelection(false);
relatedTbl.autoSize();
// relatedTbl.getModel().addTableModelListener(this);
//Available to Promise Tab
m_tableAtp = ListboxFactory.newDataTable();
m_tableAtp = ListboxFactory.newDataTableAutoSize();
m_tableAtp.setMultiSelection(false);
//IDEMPIERE-337
@ -229,7 +229,7 @@ public class InfoProductWindow extends InfoWindow {
list.toArray(s_layoutProductPrice);
s_sqlFrom = "M_ProductPrice pp INNER JOIN M_PriceList_Version plv ON (pp.M_PriceList_Version_ID = plv.M_PriceList_Version_ID)";
s_sqlWhere = "pp.M_Product_ID = ? AND plv.IsActive = 'Y' AND pp.IsActive = 'Y'";
productpriceTbl = ListboxFactory.newDataTable();
productpriceTbl = ListboxFactory.newDataTableAutoSize();
m_sqlProductprice = productpriceTbl.prepareTable(s_layoutProductPrice, s_sqlFrom, s_sqlWhere, false, "pp") + " ORDER BY plv.ValidFrom DESC";
productpriceTbl.setMultiSelection(false);
productpriceTbl.autoSize();

View File

@ -1035,6 +1035,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
contentPanel.setStyle("width: 99%; margin: 0px auto;");
contentPanel.setVflex(true);
contentPanel.setSizedByContent(true);
contentPanel.setSpan(true);
North north = new North();
layout.appendChild(north);