[web]查询页标题显示表注释

This commit is contained in:
datagear 2018-12-06 20:12:22 +08:00
parent 6eab5c7e87
commit 63c8c872e2
2 changed files with 53 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import java.util.Locale;
import org.datagear.model.Label;
import org.datagear.model.Model;
import org.datagear.model.Property;
import org.datagear.model.features.DescLabel;
import org.datagear.model.features.NameLabel;
import org.datagear.model.support.IllegalPropertyPathException;
import org.datagear.model.support.MU;
@ -324,4 +325,48 @@ public class ModelUtils
return property.getName();
}
/**
* 获取{@linkplain Model}的展示描述
*
* @param model
* @param locale
* @return
*/
public static String displayDesc(Model model, Locale locale)
{
DescLabel descLabel = model.getFeature(DescLabel.class);
if (descLabel != null)
{
Label label = descLabel.getValue();
if (label != null)
return label.getValue(locale);
}
return "";
}
/**
* 获取{@linkplain Property}的展示描述
*
* @param model
* @param locale
* @return
*/
public static String displayDesc(Property property, Locale locale)
{
DescLabel descLabel = property.getFeature(DescLabel.class);
if (descLabel != null)
{
Label label = descLabel.getValue();
if (label != null)
return label.getValue(locale);
}
return "";
}
}

View File

@ -27,6 +27,14 @@ List<PropertyPathDisplayName> conditionSource = (List<PropertyPathDisplayName>)r
<fmt:message key='query' />
<fmt:message key='titleSeparator' />
<%=WebUtils.escapeHtml(ModelUtils.displayName(model, WebUtils.getLocale(request)))%>
<%
String diplayDesc = ModelUtils.displayDesc(model, WebUtils.getLocale(request));
if(diplayDesc != null && !diplayDesc.isEmpty()){
%>
<fmt:message key='bracketLeft' />
<%=WebUtils.escapeHtml(diplayDesc)%>
<fmt:message key='bracketRight' />
<%}%>
<fmt:message key='bracketLeft' />
<%=WebUtils.escapeHtml(schema.getTitle())%>
<fmt:message key='bracketRight' />