|
Lift Framework example source code file (MetaMapper.scala)
The Lift Framework MetaMapper.scala source code/* * Copyright 2006-2011 WorldWide Conferencing, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.liftweb package mapper import java.lang.reflect.Method import java.sql.{ResultSet, Types, PreparedStatement} import java.util.{Date, Locale} import collection.mutable.{ListBuffer, HashMap} import collection.immutable.{SortedMap, TreeMap} import xml._ import common._ import json._ import util.Helpers._ import util.{NamedPF, FieldError, Helpers} import http.{LiftRules, S, SHtml, RequestMemoize, Factory} import http.js._ trait BaseMetaMapper { type RealType <: Mapper[RealType] def beforeSchemifier: Unit def afterSchemifier: Unit def dbTableName: String def _dbTableNameLC: String def mappedFields: scala.collection.Seq[BaseMappedField]; def dbAddTable: Box[() => Unit] def dbIndexes: List[BaseIndex[RealType]] } /** * Rules and functions shared by all Mappers */ object MapperRules extends Factory { /** * This function converts a header name into the appropriate * XHTML format for displaying across the headers of a * formatted block. The default is <th> for use * in XHTML tables. If you change this function, the change * will be used for all MetaMappers, unless they've been * explicitly changed. */ var displayNameToHeaderElement: String => NodeSeq = in => <th>{in} /** * This function converts an element into the appropriate * XHTML format for displaying across a line * formatted block. The default is <td> for use * in XHTML tables. If you change this function, the change * will be used for all MetaMappers, unless they've been * explicitly changed. */ var displayFieldAsLineElement: NodeSeq => NodeSeq = in => <td>{in} |
/**
* This function is the global (for all MetaMappers that have
* not changed their formatFormElement function) that
* converts a name and form for a given field in the
* model to XHTML for presentation in the browser. By
* default, a table row ( <tr> ) is presented, but
* you can change the function to display something else.
*/
var formatFormElement: (NodeSeq, NodeSeq) => NodeSeq =
(name, form) =>
<xml:group>|
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.