Fix grid rendering issue for button and image field.

Cleanup eclipse warning.
LoginPanel - remove no empty constraint from username and password field. The constraint is too aggressive and annoying at time.
This commit is contained in:
Heng Sin Low 2008-12-06 22:49:36 +00:00
parent 8bf00c253c
commit e72867266c
8 changed files with 26 additions and 25 deletions

View File

@ -54,6 +54,7 @@ import org.zkoss.zul.ListitemRendererExt;
*/ */
public class GridTabListItemRenderer implements ListitemRenderer, ListitemRendererExt { public class GridTabListItemRenderer implements ListitemRenderer, ListitemRendererExt {
private static final int MAX_TEXT_LENGTH = 60;
private GridTab gridTab; private GridTab gridTab;
private int windowNo; private int windowNo;
private GridTabDataBinder dataBinder; private GridTabDataBinder dataBinder;
@ -98,10 +99,18 @@ public class GridTabListItemRenderer implements ListitemRenderer, ListitemRender
cell.setStyle("text-align:center"); cell.setStyle("text-align:center");
createReadonlyCheckbox(values[i], cell); createReadonlyCheckbox(values[i], cell);
} else { } else {
cell = new Listcell(getDisplayText(values[i], i), null); String text = getDisplayText(values[i], i);
String display = text;
if (text != null && text.length() > MAX_TEXT_LENGTH)
display = text.substring(0, MAX_TEXT_LENGTH - 3) + "...";
cell = new Listcell(display, null);
cell.setParent(listitem); cell.setParent(listitem);
if (text != null && text.length() > MAX_TEXT_LENGTH)
cell.setTooltiptext(text);
if (DisplayType.isNumeric(gridField[i].getDisplayType())) { if (DisplayType.isNumeric(gridField[i].getDisplayType())) {
cell.setStyle("text-align:right"); cell.setStyle("text-align:right");
} else if (gridField[i].getDisplayType() == DisplayType.Image) {
cell.setStyle("text-align:center");
} }
} }
} }
@ -257,6 +266,17 @@ public class GridTabListItemRenderer implements ListitemRenderer, ListitemRender
{ {
return DisplayType.getNumberFormat(gridField[columnIndex].getDisplayType()).format(value); return DisplayType.getNumberFormat(gridField[columnIndex].getDisplayType()).format(value);
} }
else if (DisplayType.Button == gridField[columnIndex].getDisplayType())
{
return "";
}
else if (DisplayType.Image == gridField[columnIndex].getDisplayType())
{
if (value == null || (Integer)value <= 0)
return "";
else
return "...";
}
else else
return value.toString(); return value.toString();
} }

View File

@ -105,13 +105,11 @@ public class WButtonEditor extends WEditor
if (columnName.equals("PaymentRule")) if (columnName.equals("PaymentRule"))
{ {
readReference(195); readReference(195);
// this.setForeground(Color.blue);
getComponent().setImage("/images/Payment16.png"); // 29*14 getComponent().setImage("/images/Payment16.png"); // 29*14
} }
else if (columnName.equals("DocAction")) else if (columnName.equals("DocAction"))
{ {
readReference(135); readReference(135);
// this.setForeground(Color.blue);
getComponent().setImage("/images/Process16.png"); // 16*16 getComponent().setImage("/images/Process16.png"); // 16*16
} }
else if (columnName.equals("CreateFrom")) else if (columnName.equals("CreateFrom"))
@ -126,7 +124,6 @@ public class WButtonEditor extends WEditor
else if (columnName.equals("Posted")) else if (columnName.equals("Posted"))
{ {
readReference(234); readReference(234);
// this.setForeground(Color.magenta);
getComponent().setImage("/images/InfoAccount16.png"); // 16*16 getComponent().setImage("/images/InfoAccount16.png"); // 16*16
} }
@ -207,7 +204,7 @@ public class WButtonEditor extends WEditor
getComponent().setEnabled(readWrite); getComponent().setEnabled(readWrite);
} }
public HashMap getValues() public HashMap<String, String> getValues()
{ {
return m_values; return m_values;
} // getValues } // getValues

View File

@ -19,7 +19,6 @@ package org.adempiere.webui.editor;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.Date; import java.util.Date;
import java.util.logging.Level;
import org.adempiere.webui.component.Datebox; import org.adempiere.webui.component.Datebox;
import org.adempiere.webui.event.ValueChangeEvent; import org.adempiere.webui.event.ValueChangeEvent;

View File

@ -38,7 +38,6 @@ public class WImageEditor extends WEditor
{ {
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK}; private static final String[] LISTENER_EVENTS = {Events.ON_CLICK};
@SuppressWarnings("unused")
private static final CLogger logger; private static final CLogger logger;
static static
@ -48,13 +47,9 @@ public class WImageEditor extends WEditor
/** The Image Model */ /** The Image Model */
private MImage m_mImage = null; private MImage m_mImage = null;
/** Column Name */
private String m_columnName = "AD_Image_ID";
private boolean m_mandatory; private boolean m_mandatory;
private Object readWrite;
private boolean readwrite; private boolean readwrite;
/** Logger */ /** Logger */
@ -145,6 +140,7 @@ public class WImageEditor extends WEditor
logger.log(Level.WARNING, e.getLocalizedMessage(), e); logger.log(Level.WARNING, e.getLocalizedMessage(), e);
} }
} }
getComponent().setContent(img);
} }
@Override @Override

View File

@ -523,11 +523,6 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
if (queryValue.length() == 0 && getComponent().getText().length() > 0) if (queryValue.length() == 0 && getComponent().getText().length() > 0)
queryValue = getComponent().getText(); queryValue = getComponent().getText();
boolean isSOTrx = true; // default
if (Env.getContext(Env.getCtx(), lookup.getWindowNo(), "IsSOTrx").equals("N"))
isSOTrx = false;
InfoPanel ig = InfoPanel.create(lookup.getWindowNo(), m_tableName,m_keyColumnName,queryValue, false, whereClause); InfoPanel ig = InfoPanel.create(lookup.getWindowNo(), m_tableName,m_keyColumnName,queryValue, false, whereClause);
ig.setVisible(true); ig.setVisible(true);
ig.setStyle("border: 2px"); ig.setStyle("border: 2px");

View File

@ -17,8 +17,6 @@
package org.adempiere.webui.editor; package org.adempiere.webui.editor;
import java.net.URL;
import org.adempiere.webui.component.Urlbox; import org.adempiere.webui.component.Urlbox;
import org.adempiere.webui.event.ValueChangeEvent; import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.window.FDialog; import org.adempiere.webui.window.FDialog;
@ -96,7 +94,6 @@ public class WUrlEditor extends WEditor
{ {
try try
{ {
URL url = new URL(urlString);
Env.startBrowser(urlString); Env.startBrowser(urlString);
return; return;
} }

View File

@ -36,6 +36,7 @@ import org.compiere.util.DisplayType;
public class WebEditorFactory public class WebEditorFactory
{ {
@SuppressWarnings("unused")
private final static CLogger logger; private final static CLogger logger;
static static
@ -126,9 +127,7 @@ public class WebEditorFactory
displayType == DisplayType.Table || displayType == DisplayType.List displayType == DisplayType.Table || displayType == DisplayType.List
|| displayType == DisplayType.ID ) || displayType == DisplayType.ID )
{ {
boolean integralValue = (displayType == DisplayType.TableDir || displayType == DisplayType.ID);
editor = new WTableDirEditor(gridField); editor = new WTableDirEditor(gridField);
} }
else if (displayType == DisplayType.URL) else if (displayType == DisplayType.URL)

View File

@ -138,14 +138,12 @@ public class LoginPanel extends Window implements EventListener
txtUserId = new Textbox(); txtUserId = new Textbox();
txtUserId.setId("txtUserId"); txtUserId.setId("txtUserId");
txtUserId.setConstraint("no empty");
txtUserId.setCols(25); txtUserId.setCols(25);
txtUserId.setMaxlength(40); txtUserId.setMaxlength(40);
txtUserId.setWidth("220px"); txtUserId.setWidth("220px");
txtPassword = new Textbox(); txtPassword = new Textbox();
txtPassword.setId("txtPassword"); txtPassword.setId("txtPassword");
txtPassword.setConstraint("no empty");
txtPassword.setType("password"); txtPassword.setType("password");
txtPassword.setCols(25); txtPassword.setCols(25);
txtPassword.setMaxlength(40); txtPassword.setMaxlength(40);