IDEMPIERE-2736:let WEditor decide component use for display value in gridView
This commit is contained in:
parent
3edf4311ee
commit
8ac242da5b
|
@ -53,6 +53,7 @@ import org.zkoss.zk.ui.event.Events;
|
|||
import org.zkoss.zk.ui.util.Clients;
|
||||
import org.zkoss.zul.Cell;
|
||||
import org.zkoss.zul.Grid;
|
||||
import org.zkoss.zul.Html;
|
||||
import org.zkoss.zul.Label;
|
||||
import org.zkoss.zul.Paging;
|
||||
import org.zkoss.zul.RendererCtrl;
|
||||
|
@ -236,11 +237,19 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
|
|||
component = editor.getComponent();
|
||||
} else {
|
||||
String text = getDisplayText(value, gridField, rowIndex, isForceGetValue);
|
||||
|
||||
Label label = new Label();
|
||||
setLabelText(text, label);
|
||||
|
||||
component = label;
|
||||
WEditor editor = getEditorCell(gridField);
|
||||
if (editor.getDisplayComponent() == null){
|
||||
Label label = new Label();
|
||||
setLabelText(text, label);
|
||||
component = label;
|
||||
}else{
|
||||
component = editor.getDisplayComponent();
|
||||
if (component instanceof Html){
|
||||
((Html)component).setContent(text);
|
||||
}else{
|
||||
throw new UnsupportedOperationException("neet a componet has setvalue function");
|
||||
}
|
||||
}
|
||||
}
|
||||
return component;
|
||||
}
|
||||
|
@ -316,6 +325,8 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
|
|||
checkBox.setChecked(true);
|
||||
else
|
||||
checkBox.setChecked(false);
|
||||
} else if (component instanceof Html){
|
||||
((Html)component).setContent(getDisplayText(entry.getValue().getValue(), entry.getValue().getGridField(), -1));
|
||||
}
|
||||
}
|
||||
if (row == null)
|
||||
|
|
|
@ -687,6 +687,16 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
|
|||
this.isProcessParameter = isProcessParameter;
|
||||
}
|
||||
|
||||
/**
|
||||
* return component use for display value in grid view mode in non edit status
|
||||
* if return null, a label will replace.
|
||||
* because each row must has one instance of this component, don't cache it. just create new instance
|
||||
* @return
|
||||
*/
|
||||
public Component getDisplayComponent() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static final String STYLE_ZOOMABLE_LABEL = "cursor: pointer; text-decoration: underline;";
|
||||
private static final String STYLE_NORMAL_LABEL = "color: #333;";
|
||||
private static final String STYLE_EMPTY_MANDATORY_LABEL = "color: red;";
|
||||
|
|
|
@ -13,6 +13,10 @@ html,body {
|
|||
overflow: hidden;
|
||||
}
|
||||
|
||||
.z-html p{
|
||||
margin:0px;
|
||||
}
|
||||
|
||||
<%-- Tablet --%>
|
||||
.tablet-scrolling {
|
||||
-webkit-overflow-scrolling: touch;
|
||||
|
|
Loading…
Reference in New Issue