- text and combobox button overlap
This commit is contained in:
Heng Sin Low 2009-06-29 06:59:11 +00:00
parent 337aead288
commit 6a5daf7900
3 changed files with 96 additions and 12 deletions

View File

@ -33,6 +33,7 @@ import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Div;
import org.zkoss.zul.SimpleTreeNode;
import org.zkoss.zul.Tree;
import org.zkoss.zul.Treeitem;
@ -86,17 +87,20 @@ public class TreeSearchPanel extends Panel implements EventListener, TreeDataLis
private void init()
{
Div div = new Div();
lblSearch = new Label();
lblSearch.setValue(Msg.getMsg(Env.getCtx(),"TreeSearch").replaceAll("&", "") + ":");
lblSearch.setTooltiptext(Msg.getMsg(Env.getCtx(),"TreeSearchText"));
div.appendChild(lblSearch);
div.setStyle("display: inline-block; height: 20px; margin-bottom: 10px; vertical-align: middle");
cmbSearch = new AutoComplete();
cmbSearch.setAutodrop(true);
cmbSearch.addEventListener(Events.ON_CHANGE, this);
this.appendChild(lblSearch);
this.appendChild(div);
this.appendChild(cmbSearch);
this.setStyle("height: 20px;");
}
private void addTreeItem(Treeitem treeItem)

View File

@ -0,0 +1,90 @@
/* Combobox2Default.java
{{IS_NOTE
Purpose:
Description:
History:
Jun 6, 2008 8:57:53 AM , Created by jumperchen
}}IS_NOTE
Copyright (C) 2008 Potix Corporation. All Rights Reserved.
{{IS_RIGHT
This program is distributed under GPL Version 2.0 in the hope that
it will be useful, but WITHOUT ANY WARRANTY.
}}IS_RIGHT
*/
package org.zkoss.zkmax.zul.render;
import java.io.IOException;
import java.io.Writer;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Execution;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.render.ComponentRenderer;
import org.zkoss.zk.ui.render.SmartWriter;
import org.zkoss.zul.Combobox;
/**
* {@link Combobox}'s default mold.
*
* @author jumperchen
*
* @since 3.5.0
*
* @author hengsin
* modify default zk layout for combobox
*/
public class Combobox2Default implements ComponentRenderer {
public void render(Component comp, Writer out) throws IOException {
final SmartWriter wh = new SmartWriter(out);
final Combobox self = (Combobox) comp;
final String uuid = self.getUuid();
final String zcls = self.getZclass();
final Execution exec = Executions.getCurrent();
String tableStyle = "display:inline-block";
String inputAttrs = self.getInnerAttrs();
if (inputAttrs.indexOf("style") >= 0) {
inputAttrs = inputAttrs.substring(0, inputAttrs.indexOf("style"));
}
inputAttrs = inputAttrs.trim() + " style='width: 100%'";
wh.write("<span id=\"").write(uuid).write("\"")
.write(self.getOuterAttrs())
.write(" z.type=\"zul.cb.Cmbox\" z.combo=\"true\">")
.write("<table border='0' cellspacing='0' cellpadding='0'")
.write(" width='").write(self.getWidth()).write("'")
.write(" style='"). write(tableStyle).write("'>")
.write("<tr style='white-space:nowrap; border:none").write(self.getWidth()).write("'>");
if (self.getWidth() != null && self.getWidth().trim().length() > 0 && !"auto".equals(self.getWidth()))
{
wh.write("<td style='width: 100%; border:none'>");
}
else
{
wh.write("<td style='width: auto; border:none'>");
}
wh.write("<input id=\"")
.write(uuid).write("!real\" autocomplete=\"off\"")
.write(" class=\"").write(zcls).write("-inp\" ")
.write(inputAttrs).write("/></td><td style='width: 17px'><span id=\"")
.write(uuid).write("!btn\" class=\"").write(zcls).write("-btn\"");
if (!self.isButtonVisible())
wh.write(" style=\"display:none\"");
else
wh.write(" style=\"margin-left:2px\"");
wh.write("><img class=\"").write(zcls).write("-img\" onmousedown=\"return false;\"");
wh.write(" src=\"").write(exec.encodeURL("~./img/spacer.gif")).write("\"")
.write("\"/></span></td></tr></table><div id=\"").write(uuid).write("!pp\" class=\"")
.write(zcls).write("-pp\" style=\"display:none\" tabindex=\"-1\">")
.write("<table id=\"").write(uuid)
.write("!cave\" cellpadding=\"0\" cellspacing=\"0\">")
.writeChildren(self)
.write("</table></div></span>");
}
}

View File

@ -370,16 +370,6 @@ input:focus, textarea:focus, .z-combobox-inp:focus, z-datebox-inp:focus {
border: 1px solid #0000ff;
}
<%-- fixed combobox btn position when width is set 100% --%>
.z-combobox-inp {
font-family: ${fontFamilyC};
font-size: ${fontSizeM};
font-weight: normal;
background: #FFF url(${c:encodeURL('~./zul/img/grid/text-bg.gif')}) repeat-x 0 0;
border: 1px solid #7F9DB9;
margin-right: -17px;
}
.mandatory-decorator-text {
text-decoration: none; font-size: xx-small; vertical-align: top; color:red;
}