Search in sources :

Example 6 with KeySerializer

use of com.revolsys.ui.html.serializer.key.KeySerializer in project com.revolsys.open by revolsys.

the class RecordHtmlUiBuilder method newDataTableMap.

protected Map<String, Object> newDataTableMap(final HttpServletRequest request, final String pageName, final Query query) {
    final String search = request.getParameter("search[value]");
    final List<String> fieldNames = new ArrayList<>();
    final List<KeySerializer> serializers = getSerializers(pageName, "list");
    final Or or = new Or();
    for (int i = 0; ; i++) {
        final String name = request.getParameter("columns[" + i + "][name]");
        if (Property.hasValue(name)) {
            final KeySerializer serializer = serializers.get(i);
            final String fieldName = serializer.getSortFieldName();
            fieldNames.add(fieldName);
            if (Property.hasValue(search)) {
                if (HttpServletUtils.getBooleanParameter(request, "columns[" + i + "][searchable]")) {
                    or.or(Q.iLike("T." + fieldName, search));
                }
            }
        } else {
            break;
        }
    }
    if (!or.isEmpty()) {
        query.and(or);
    }
    final Map<String, Boolean> orderBy = getDataTableSortOrder(fieldNames, request);
    query.setOrderBy(orderBy);
    final RecordStore recordStore = getRecordStore();
    return newDataTableMap(request, recordStore, query, pageName);
}
Also used : Or(com.revolsys.record.query.Or) RecordStore(com.revolsys.record.schema.RecordStore) ArrayList(java.util.ArrayList) KeySerializer(com.revolsys.ui.html.serializer.key.KeySerializer)

Example 7 with KeySerializer

use of com.revolsys.ui.html.serializer.key.KeySerializer in project com.revolsys.open by revolsys.

the class KeySerializerDetailSerializer method serializeValue.

@Override
public void serializeValue(final XmlWriter out, final int index) {
    if (index < getSize()) {
        final KeySerializer serializer = this.serializers.get(index);
        serializer.serialize(out, this.object);
    } else {
        out.entityRef("nbsp");
    }
}
Also used : KeySerializer(com.revolsys.ui.html.serializer.key.KeySerializer)

Example 8 with KeySerializer

use of com.revolsys.ui.html.serializer.key.KeySerializer in project com.revolsys.open by revolsys.

the class KeySerializerDetailSerializer method serializeLabel.

@Override
public void serializeLabel(final XmlWriter out, final int index) {
    if (index < getSize()) {
        final KeySerializer serializer = this.serializers.get(index);
        final String label = serializer.getLabel();
        out.text(label);
    } else {
        out.entityRef("nbsp");
    }
}
Also used : KeySerializer(com.revolsys.ui.html.serializer.key.KeySerializer)

Example 9 with KeySerializer

use of com.revolsys.ui.html.serializer.key.KeySerializer in project com.revolsys.open by revolsys.

the class KeySerializerTableSerializer method serializeHeaderCell.

@Override
public void serializeHeaderCell(final XmlWriter out, final int col) {
    if (col < this.colCount) {
        final KeySerializer serializer = getSerializer(col);
        out.text(serializer.getLabel());
    } else {
        out.entityRef("nbsp");
    }
}
Also used : KeySerializer(com.revolsys.ui.html.serializer.key.KeySerializer)

Example 10 with KeySerializer

use of com.revolsys.ui.html.serializer.key.KeySerializer in project com.revolsys.open by revolsys.

the class KeySerializerTableSerializer method getHeaderCssClass.

@Override
public String getHeaderCssClass(final int col) {
    if (col < this.colCount) {
        final KeySerializer serializer = getSerializer(col);
        final String name = serializer.getName();
        if (Property.hasValue(name)) {
            return name.replaceAll("\\.", "_");
        }
    }
    return "";
}
Also used : KeySerializer(com.revolsys.ui.html.serializer.key.KeySerializer)

Aggregations

KeySerializer (com.revolsys.ui.html.serializer.key.KeySerializer)13 ArrayList (java.util.ArrayList)5 LinkedHashMap (java.util.LinkedHashMap)3 ElementContainer (com.revolsys.ui.html.view.ElementContainer)2 TabElementContainer (com.revolsys.ui.html.view.TabElementContainer)2 Menu (com.revolsys.ui.model.Menu)2 List (java.util.List)2 Record (com.revolsys.record.Record)1 Or (com.revolsys.record.query.Or)1 RecordStore (com.revolsys.record.schema.RecordStore)1 Field (com.revolsys.ui.html.fields.Field)1 TextAreaField (com.revolsys.ui.html.fields.TextAreaField)1 TextField (com.revolsys.ui.html.fields.TextField)1 TableBodyLayout (com.revolsys.ui.html.layout.TableBodyLayout)1 BuilderSerializer (com.revolsys.ui.html.serializer.BuilderSerializer)1 KeySerializerTableSerializer (com.revolsys.ui.html.serializer.KeySerializerTableSerializer)1 RowsTableSerializer (com.revolsys.ui.html.serializer.RowsTableSerializer)1 TypeSerializer (com.revolsys.ui.html.serializer.type.TypeSerializer)1 ButtonsToolbarElement (com.revolsys.ui.html.view.ButtonsToolbarElement)1 Element (com.revolsys.ui.html.view.Element)1