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 {
private static final int MAX_TEXT_LENGTH = 60;
private GridTab gridTab;
private int windowNo;
private GridTabDataBinder dataBinder;
@ -98,10 +99,18 @@ public class GridTabListItemRenderer implements ListitemRenderer, ListitemRender
cell.setStyle("text-align:center");
createReadonlyCheckbox(values[i], cell);
} 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);
if (text != null && text.length() > MAX_TEXT_LENGTH)
cell.setTooltiptext(text);
if (DisplayType.isNumeric(gridField[i].getDisplayType())) {
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);
}
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
return value.toString();
}

View File

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

View File

@ -19,7 +19,6 @@ package org.adempiere.webui.editor;
import java.sql.Timestamp;
import java.util.Date;
import java.util.logging.Level;
import org.adempiere.webui.component.Datebox;
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};
@SuppressWarnings("unused")
private static final CLogger logger;
static
@ -48,12 +47,8 @@ public class WImageEditor extends WEditor
/** The Image Model */
private MImage m_mImage = null;
/** Column Name */
private String m_columnName = "AD_Image_ID";
private boolean m_mandatory;
private Object readWrite;
private boolean m_mandatory;
private boolean readwrite;
@ -145,6 +140,7 @@ public class WImageEditor extends WEditor
logger.log(Level.WARNING, e.getLocalizedMessage(), e);
}
}
getComponent().setContent(img);
}
@Override

View File

@ -523,11 +523,6 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
if (queryValue.length() == 0 && getComponent().getText().length() > 0)
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);
ig.setVisible(true);
ig.setStyle("border: 2px");

View File

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

View File

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

View File

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