Heng Sin Low 2009-05-15 19:50:38 +00:00
parent aa09b414b1
commit d5e6e6a596
8 changed files with 186 additions and 218 deletions

View File

@ -133,7 +133,7 @@ public class EditorBox extends Div {
* @return boolean * @return boolean
*/ */
public boolean isEnabled() { public boolean isEnabled() {
return txt.isReadonly(); return !txt.isReadonly();
} }
/** /**

View File

@ -90,7 +90,7 @@ public class Label extends org.zkoss.zul.Label
private void createMandatoryDecorator() { private void createMandatoryDecorator() {
decorator = new Label("*"); decorator = new Label("*");
((Label)decorator).setStyle("text-decoration: none; font-size: xx-small; vertical-align: top;"); ((Label)decorator).setSclass("mandatory-decorator-text");
} }
/** /**

View File

@ -140,17 +140,6 @@ public class WDateEditor extends WEditor
// //
} }
@Override
public boolean isMandatory()
{
return false;
}
@Override
public void setMandatory(boolean mandatory)
{
}
@Override @Override
public void setValue(Object value) public void setValue(Object value)
{ {

View File

@ -132,17 +132,6 @@ public class WDatetimeEditor extends WEditor
// //
} }
@Override
public boolean isMandatory()
{
return false;
}
@Override
public void setMandatory(boolean mandatory)
{
}
@Override @Override
public void setValue(Object value) public void setValue(Object value)
{ {

View File

@ -425,7 +425,7 @@ public abstract class WEditor implements EventListener, PropertyChangeListener
{ {
this.mandatory = mandatory; this.mandatory = mandatory;
if (label != null) if (label != null)
label.setMandatory(mandatory); label.setMandatory(mandatory && isReadWrite());
} }
/** /**

View File

@ -123,17 +123,6 @@ public class WTimeEditor extends WEditor
// //
} }
@Override
public boolean isMandatory()
{
return false;
}
@Override
public void setMandatory(boolean mandatory)
{
}
@Override @Override
public void setValue(Object value) public void setValue(Object value)
{ {

View File

@ -551,10 +551,7 @@ DataStatusListener, IADTabpanel, VetoableChangeListener
comp.dynamicDisplay(); comp.dynamicDisplay();
boolean rw = mField.isEditable(true); // r/w - check Context boolean rw = mField.isEditable(true); // r/w - check Context
comp.setReadWrite(rw); comp.setReadWrite(rw);
if (comp.getLabel() != null) comp.setMandatory(mField.isMandatory(true)); // check context
{
comp.setMandatory(mField.isMandatory(true)); // check context
}
} }
} }
else if (comp.isVisible()) else if (comp.isVisible())

View File

@ -375,3 +375,7 @@ input:focus, textarea:focus, .z-combobox-inp:focus, z-datebox-inp:focus {
border: 1px solid #7F9DB9; border: 1px solid #7F9DB9;
margin-right: -17px; margin-right: -17px;
} }
.mandatory-decorator-text {
text-decoration: none; font-size: xx-small; vertical-align: top; color:red;
}