http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/wicket-xhtml1.4-strict.dtd ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/wicket-xhtml1.4-strict.dtd b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/wicket-xhtml1.4-strict.dtd deleted file mode 100644 index 66d4f81..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/wicket-xhtml1.4-strict.dtd +++ /dev/null @@ -1,982 +0,0 @@ -<!-- - Extensible HTML version 1.0 Strict DTD - - This is the same as HTML 4 Strict except for - changes due to the differences between XML and SGML. - - Namespace = http://www.w3.org/1999/xhtml - - For further information, see: http://www.w3.org/TR/xhtml1 - - Copyright (c) 1998-2002 W3C (MIT, INRIA, Keio), - All Rights Reserved. - - This DTD module is identified by the PUBLIC and SYSTEM identifiers: - - PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" - - $Revision: 1.1 $ - $Date: 2002/08/01 13:56:03 $ - ---> - -<!--================ Character mnemonic entities =========================--> - -<!ENTITY % HTMLlat1 PUBLIC - "-//W3C//ENTITIES Latin 1 for XHTML//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent"> -%HTMLlat1; - -<!ENTITY % HTMLsymbol PUBLIC - "-//W3C//ENTITIES Symbols for XHTML//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent"> -%HTMLsymbol; - -<!ENTITY % HTMLspecial PUBLIC - "-//W3C//ENTITIES Special for XHTML//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent"> -%HTMLspecial; - -<!--================== Imported Names ====================================--> - -<!ENTITY % ContentType "CDATA"> - <!-- media type, as per [RFC2045] --> - -<!ENTITY % ContentTypes "CDATA"> - <!-- comma-separated list of media types, as per [RFC2045] --> - -<!ENTITY % Charset "CDATA"> - <!-- a character encoding, as per [RFC2045] --> - -<!ENTITY % Charsets "CDATA"> - <!-- a space separated list of character encodings, as per [RFC2045] --> - -<!ENTITY % LanguageCode "NMTOKEN"> - <!-- a language code, as per [RFC3066] --> - -<!ENTITY % Character "CDATA"> - <!-- a single character, as per section 2.2 of [XML] --> - -<!ENTITY % Number "CDATA"> - <!-- one or more digits --> - -<!ENTITY % LinkTypes "CDATA"> - <!-- space-separated list of link types --> - -<!ENTITY % MediaDesc "CDATA"> - <!-- single or comma-separated list of media descriptors --> - -<!ENTITY % URI "CDATA"> - <!-- a Uniform Resource Identifier, see [RFC2396] --> - -<!ENTITY % UriList "CDATA"> - <!-- a space separated list of Uniform Resource Identifiers --> - -<!ENTITY % Datetime "CDATA"> - <!-- date and time information. ISO date format --> - -<!ENTITY % Script "CDATA"> - <!-- script expression --> - -<!ENTITY % StyleSheet "CDATA"> - <!-- style sheet data --> - -<!ENTITY % Text "CDATA"> - <!-- used for titles etc. --> - -<!ENTITY % Length "CDATA"> - <!-- nn for pixels or nn% for percentage length --> - -<!ENTITY % MultiLength "CDATA"> - <!-- pixel, percentage, or relative --> - -<!ENTITY % Pixels "CDATA"> - <!-- integer representing length in pixels --> - -<!-- these are used for image maps --> - -<!ENTITY % Shape "(rect|circle|poly|default)"> - -<!ENTITY % Coords "CDATA"> - <!-- comma separated list of lengths --> - -<!--=================== Generic Attributes ===============================--> - -<!-- core attributes common to most elements - id document-wide unique id - class space separated list of classes - style associated style info - title advisory title/amplification - wicket:id the id for the Wicket framework - wicket:preview the preview attribute for the Wicket framework ---> -<!ENTITY % coreattrs - "id ID #IMPLIED - class CDATA #IMPLIED - style %StyleSheet; #IMPLIED - title %Text; #IMPLIED - wicket:id %Text; #IMPLIED - wicket:preview %Text; #IMPLIED" - > - -<!-- internationalization attributes - lang language code (backwards compatible) - xml:lang language code (as per XML 1.0 spec) - dir direction for weak/neutral text ---> -<!ENTITY % i18n - "lang %LanguageCode; #IMPLIED - xml:lang %LanguageCode; #IMPLIED - dir (ltr|rtl) #IMPLIED" - > - -<!-- attributes for common UI events - onclick a pointer button was clicked - ondblclick a pointer button was double clicked - onmousedown a pointer button was pressed down - onmouseup a pointer button was released - onmousemove a pointer was moved onto the element - onmouseout a pointer was moved away from the element - onkeypress a key was pressed and released - onkeydown a key was pressed down - onkeyup a key was released ---> -<!ENTITY % events - "onclick %Script; #IMPLIED - ondblclick %Script; #IMPLIED - onmousedown %Script; #IMPLIED - onmouseup %Script; #IMPLIED - onmouseover %Script; #IMPLIED - onmousemove %Script; #IMPLIED - onmouseout %Script; #IMPLIED - onkeypress %Script; #IMPLIED - onkeydown %Script; #IMPLIED - onkeyup %Script; #IMPLIED" - > - -<!-- attributes for elements that can get the focus - accesskey accessibility key character - tabindex position in tabbing order - onfocus the element got the focus - onblur the element lost the focus ---> -<!ENTITY % focus - "accesskey %Character; #IMPLIED - tabindex %Number; #IMPLIED - onfocus %Script; #IMPLIED - onblur %Script; #IMPLIED" - > - -<!ENTITY % attrs "%coreattrs; %i18n; %events;"> - -<!--=================== Text Elements ====================================--> - -<!ENTITY % special.pre - "br | span | bdo | map"> - - -<!ENTITY % special - "%special.pre; | object | img "> - -<!ENTITY % fontstyle "tt | i | b | big | small "> - -<!ENTITY % phrase "em | strong | dfn | code | q | - samp | kbd | var | cite | abbr | acronym | sub | sup "> - -<!ENTITY % inline.forms "input | select | textarea | label | button"> - -<!-- these can occur at block or inline level --> -<!ENTITY % misc.inline "ins | del | script"> - -<!-- these can only occur at block level --> -<!ENTITY % misc "noscript | %misc.inline;"> - -<!ENTITY % inline "a | %special; | %fontstyle; | %phrase; | %inline.forms;"> - -<!-- %Inline; covers inline or "text-level" elements --> -<!ENTITY % Inline "(#PCDATA | %inline; | %misc.inline;)*"> - -<!--================== Block level elements ==============================--> - -<!ENTITY % heading "h1|h2|h3|h4|h5|h6"> -<!ENTITY % lists "ul | ol | dl"> -<!ENTITY % blocktext "pre | hr | blockquote | address"> - -<!ENTITY % block - "p | %heading; | div | %lists; | %blocktext; | fieldset | table"> - -<!ENTITY % Block "(%block; | form | %misc;)*"> - -<!-- %Flow; mixes block and inline and is used for list items etc. --> -<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*"> - -<!--================== Content models for exclusions =====================--> - -<!-- a elements use %Inline; excluding a --> - -<!ENTITY % a.content - "(#PCDATA | %special; | %fontstyle; | %phrase; | %inline.forms; | %misc.inline;)*"> - -<!-- pre uses %Inline excluding big, small, sup or sup --> - -<!ENTITY % pre.content - "(#PCDATA | a | %fontstyle; | %phrase; | %special.pre; | %misc.inline; - | %inline.forms;)*"> - -<!-- form uses %Block; excluding form --> - -<!ENTITY % form.content "(%block; | %misc;)*"> - -<!-- button uses %Flow; but excludes a, form and form controls --> - -<!ENTITY % button.content - "(#PCDATA | p | %heading; | div | %lists; | %blocktext; | - table | %special; | %fontstyle; | %phrase; | %misc;)*"> - -<!--================ Document Structure ==================================--> - -<!-- the namespace URI designates the document profile --> - -<!ELEMENT html (head, body)> -<!ATTLIST html - %i18n; - id ID #IMPLIED - xmlns %URI; #FIXED 'http://www.w3.org/1999/xhtml' - > - -<!--================ Document Head =======================================--> - -<!ENTITY % head.misc "(script|style|meta|link|object)*"> - -<!-- content model is %head.misc; combined with a single - title and an optional base element in any order --> - -<!ELEMENT head (%head.misc;, - ((title, %head.misc;, (base, %head.misc;)?) | - (base, %head.misc;, (title, %head.misc;))))> - -<!ATTLIST head - %i18n; - id ID #IMPLIED - profile %URI; #IMPLIED - > - -<!-- The title element is not considered part of the flow of text. - It should be displayed, for example as the page header or - window title. Exactly one title is required per document. - --> -<!ELEMENT title (#PCDATA)> -<!ATTLIST title - %i18n; - id ID #IMPLIED - > - -<!-- document base URI --> - -<!ELEMENT base EMPTY> -<!ATTLIST base - href %URI; #REQUIRED - id ID #IMPLIED - > - -<!-- generic metainformation --> -<!ELEMENT meta EMPTY> -<!ATTLIST meta - %i18n; - id ID #IMPLIED - http-equiv CDATA #IMPLIED - name CDATA #IMPLIED - content CDATA #REQUIRED - scheme CDATA #IMPLIED - > - -<!-- - Relationship values can be used in principle: - - a) for document specific toolbars/menus when used - with the link element in document head e.g. - start, contents, previous, next, index, end, help - b) to link to a separate style sheet (rel="stylesheet") - c) to make a link to a script (rel="script") - d) by stylesheets to control how collections of - html nodes are rendered into printed documents - e) to make a link to a printable version of this document - e.g. a PostScript or PDF version (rel="alternate" media="print") ---> - -<!ELEMENT link EMPTY> -<!ATTLIST link - %attrs; - charset %Charset; #IMPLIED - href %URI; #IMPLIED - hreflang %LanguageCode; #IMPLIED - type %ContentType; #IMPLIED - rel %LinkTypes; #IMPLIED - rev %LinkTypes; #IMPLIED - media %MediaDesc; #IMPLIED - > - -<!-- style info, which may include CDATA sections --> -<!ELEMENT style (#PCDATA)> -<!ATTLIST style - %i18n; - id ID #IMPLIED - type %ContentType; #REQUIRED - media %MediaDesc; #IMPLIED - title %Text; #IMPLIED - xml:space (preserve) #FIXED 'preserve' - > - -<!-- script statements, which may include CDATA sections --> -<!ELEMENT script (#PCDATA)> -<!ATTLIST script - id ID #IMPLIED - charset %Charset; #IMPLIED - type %ContentType; #REQUIRED - src %URI; #IMPLIED - defer (defer) #IMPLIED - xml:space (preserve) #FIXED 'preserve' - > - -<!-- alternate content container for non script-based rendering --> - -<!ELEMENT noscript %Block;> -<!ATTLIST noscript - %attrs; - > - -<!--=================== Document Body ====================================--> - -<!ELEMENT body %Block;> -<!ATTLIST body - %attrs; - onload %Script; #IMPLIED - onunload %Script; #IMPLIED - > - -<!ELEMENT div %Flow;> <!-- generic language/style container --> -<!ATTLIST div - %attrs; - > - -<!--=================== Paragraphs =======================================--> - -<!ELEMENT p %Inline;> -<!ATTLIST p - %attrs; - > - -<!--=================== Headings =========================================--> - -<!-- - There are six levels of headings from h1 (the most important) - to h6 (the least important). ---> - -<!ELEMENT h1 %Inline;> -<!ATTLIST h1 - %attrs; - > - -<!ELEMENT h2 %Inline;> -<!ATTLIST h2 - %attrs; - > - -<!ELEMENT h3 %Inline;> -<!ATTLIST h3 - %attrs; - > - -<!ELEMENT h4 %Inline;> -<!ATTLIST h4 - %attrs; - > - -<!ELEMENT h5 %Inline;> -<!ATTLIST h5 - %attrs; - > - -<!ELEMENT h6 %Inline;> -<!ATTLIST h6 - %attrs; - > - -<!--=================== Lists ============================================--> - -<!-- Unordered list --> - -<!ELEMENT ul (li)+> -<!ATTLIST ul - %attrs; - > - -<!-- Ordered (numbered) list --> - -<!ELEMENT ol (li)+> -<!ATTLIST ol - %attrs; - > - -<!-- list item --> - -<!ELEMENT li %Flow;> -<!ATTLIST li - %attrs; - > - -<!-- definition lists - dt for term, dd for its definition --> - -<!ELEMENT dl (dt|dd)+> -<!ATTLIST dl - %attrs; - > - -<!ELEMENT dt %Inline;> -<!ATTLIST dt - %attrs; - > - -<!ELEMENT dd %Flow;> -<!ATTLIST dd - %attrs; - > - -<!--=================== Address ==========================================--> - -<!-- information on author --> - -<!ELEMENT address %Inline;> -<!ATTLIST address - %attrs; - > - -<!--=================== Horizontal Rule ==================================--> - -<!ELEMENT hr EMPTY> -<!ATTLIST hr - %attrs; - > - -<!--=================== Preformatted Text ================================--> - -<!-- content is %Inline; excluding "img|object|big|small|sub|sup" --> - -<!ELEMENT pre %pre.content;> -<!ATTLIST pre - %attrs; - xml:space (preserve) #FIXED 'preserve' - > - -<!--=================== Block-like Quotes ================================--> - -<!ELEMENT blockquote %Block;> -<!ATTLIST blockquote - %attrs; - cite %URI; #IMPLIED - > - -<!--=================== Inserted/Deleted Text ============================--> - -<!-- - ins/del are allowed in block and inline content, but its - inappropriate to include block content within an ins element - occurring in inline content. ---> -<!ELEMENT ins %Flow;> -<!ATTLIST ins - %attrs; - cite %URI; #IMPLIED - datetime %Datetime; #IMPLIED - > - -<!ELEMENT del %Flow;> -<!ATTLIST del - %attrs; - cite %URI; #IMPLIED - datetime %Datetime; #IMPLIED - > - -<!--================== The Anchor Element ================================--> - -<!-- content is %Inline; except that anchors shouldn't be nested --> - -<!ELEMENT a %a.content;> -<!ATTLIST a - %attrs; - %focus; - charset %Charset; #IMPLIED - type %ContentType; #IMPLIED - name NMTOKEN #IMPLIED - href %URI; #IMPLIED - hreflang %LanguageCode; #IMPLIED - rel %LinkTypes; #IMPLIED - rev %LinkTypes; #IMPLIED - shape %Shape; "rect" - coords %Coords; #IMPLIED - > - -<!--===================== Inline Elements ================================--> - -<!ELEMENT span %Inline;> <!-- generic language/style container --> -<!ATTLIST span - %attrs; - > - -<!ELEMENT bdo %Inline;> <!-- I18N BiDi over-ride --> -<!ATTLIST bdo - %coreattrs; - %events; - lang %LanguageCode; #IMPLIED - xml:lang %LanguageCode; #IMPLIED - dir (ltr|rtl) #REQUIRED - > - -<!ELEMENT br EMPTY> <!-- forced line break --> -<!ATTLIST br - %coreattrs; - > - -<!ELEMENT em %Inline;> <!-- emphasis --> -<!ATTLIST em %attrs;> - -<!ELEMENT strong %Inline;> <!-- strong emphasis --> -<!ATTLIST strong %attrs;> - -<!ELEMENT dfn %Inline;> <!-- definitional --> -<!ATTLIST dfn %attrs;> - -<!ELEMENT code %Inline;> <!-- program code --> -<!ATTLIST code %attrs;> - -<!ELEMENT samp %Inline;> <!-- sample --> -<!ATTLIST samp %attrs;> - -<!ELEMENT kbd %Inline;> <!-- something user would type --> -<!ATTLIST kbd %attrs;> - -<!ELEMENT var %Inline;> <!-- variable --> -<!ATTLIST var %attrs;> - -<!ELEMENT cite %Inline;> <!-- citation --> -<!ATTLIST cite %attrs;> - -<!ELEMENT abbr %Inline;> <!-- abbreviation --> -<!ATTLIST abbr %attrs;> - -<!ELEMENT acronym %Inline;> <!-- acronym --> -<!ATTLIST acronym %attrs;> - -<!ELEMENT q %Inline;> <!-- inlined quote --> -<!ATTLIST q - %attrs; - cite %URI; #IMPLIED - > - -<!ELEMENT sub %Inline;> <!-- subscript --> -<!ATTLIST sub %attrs;> - -<!ELEMENT sup %Inline;> <!-- superscript --> -<!ATTLIST sup %attrs;> - -<!ELEMENT tt %Inline;> <!-- fixed pitch font --> -<!ATTLIST tt %attrs;> - -<!ELEMENT i %Inline;> <!-- italic font --> -<!ATTLIST i %attrs;> - -<!ELEMENT b %Inline;> <!-- bold font --> -<!ATTLIST b %attrs;> - -<!ELEMENT big %Inline;> <!-- bigger font --> -<!ATTLIST big %attrs;> - -<!ELEMENT small %Inline;> <!-- smaller font --> -<!ATTLIST small %attrs;> - -<!--==================== Object ======================================--> -<!-- - object is used to embed objects as part of HTML pages. - param elements should precede other content. Parameters - can also be expressed as attribute/value pairs on the - object element itself when brevity is desired. ---> - -<!ELEMENT object (#PCDATA | param | %block; | form | %inline; | %misc;)*> -<!ATTLIST object - %attrs; - declare (declare) #IMPLIED - classid %URI; #IMPLIED - codebase %URI; #IMPLIED - data %URI; #IMPLIED - type %ContentType; #IMPLIED - codetype %ContentType; #IMPLIED - archive %UriList; #IMPLIED - standby %Text; #IMPLIED - height %Length; #IMPLIED - width %Length; #IMPLIED - usemap %URI; #IMPLIED - name NMTOKEN #IMPLIED - tabindex %Number; #IMPLIED - > - -<!-- - param is used to supply a named property value. - In XML it would seem natural to follow RDF and support an - abbreviated syntax where the param elements are replaced - by attribute value pairs on the object start tag. ---> -<!ELEMENT param EMPTY> -<!ATTLIST param - id ID #IMPLIED - name CDATA #IMPLIED - value CDATA #IMPLIED - valuetype (data|ref|object) "data" - type %ContentType; #IMPLIED - > - -<!--=================== Images ===========================================--> - -<!-- - To avoid accessibility problems for people who aren't - able to see the image, you should provide a text - description using the alt and longdesc attributes. - In addition, avoid the use of server-side image maps. - Note that in this DTD there is no name attribute. That - is only available in the transitional and frameset DTD. ---> - -<!ELEMENT img EMPTY> -<!ATTLIST img - %attrs; - src %URI; #REQUIRED - alt %Text; #REQUIRED - longdesc %URI; #IMPLIED - height %Length; #IMPLIED - width %Length; #IMPLIED - usemap %URI; #IMPLIED - ismap (ismap) #IMPLIED - > - -<!-- usemap points to a map element which may be in this document - or an external document, although the latter is not widely supported --> - -<!--================== Client-side image maps ============================--> - -<!-- These can be placed in the same document or grouped in a - separate document although this isn't yet widely supported --> - -<!ELEMENT map ((%block; | form | %misc;)+ | area+)> -<!ATTLIST map - %i18n; - %events; - id ID #REQUIRED - class CDATA #IMPLIED - style %StyleSheet; #IMPLIED - title %Text; #IMPLIED - name NMTOKEN #IMPLIED - > - -<!ELEMENT area EMPTY> -<!ATTLIST area - %attrs; - %focus; - shape %Shape; "rect" - coords %Coords; #IMPLIED - href %URI; #IMPLIED - nohref (nohref) #IMPLIED - alt %Text; #REQUIRED - > - -<!--================ Forms ===============================================--> -<!ELEMENT form %form.content;> <!-- forms shouldn't be nested --> - -<!ATTLIST form - %attrs; - action %URI; #REQUIRED - method (get|post) "get" - enctype %ContentType; "application/x-www-form-urlencoded" - onsubmit %Script; #IMPLIED - onreset %Script; #IMPLIED - accept %ContentTypes; #IMPLIED - accept-charset %Charsets; #IMPLIED - > - -<!-- - Each label must not contain more than ONE field - Label elements shouldn't be nested. ---> -<!ELEMENT label %Inline;> -<!ATTLIST label - %attrs; - for IDREF #IMPLIED - accesskey %Character; #IMPLIED - onfocus %Script; #IMPLIED - onblur %Script; #IMPLIED - > - -<!ENTITY % InputType - "(text | password | checkbox | - radio | submit | reset | - file | hidden | image | button)" - > - -<!-- the name attribute is required for all but submit & reset --> - -<!ELEMENT input EMPTY> <!-- form control --> -<!ATTLIST input - %attrs; - %focus; - type %InputType; "text" - name CDATA #IMPLIED - value CDATA #IMPLIED - checked (checked) #IMPLIED - disabled (disabled) #IMPLIED - readonly (readonly) #IMPLIED - size CDATA #IMPLIED - maxlength %Number; #IMPLIED - src %URI; #IMPLIED - alt CDATA #IMPLIED - usemap %URI; #IMPLIED - onselect %Script; #IMPLIED - onchange %Script; #IMPLIED - accept %ContentTypes; #IMPLIED - > - -<!ELEMENT select (optgroup|option)+> <!-- option selector --> -<!ATTLIST select - %attrs; - name CDATA #IMPLIED - size %Number; #IMPLIED - multiple (multiple) #IMPLIED - disabled (disabled) #IMPLIED - tabindex %Number; #IMPLIED - onfocus %Script; #IMPLIED - onblur %Script; #IMPLIED - onchange %Script; #IMPLIED - > - -<!ELEMENT optgroup (option)+> <!-- option group --> -<!ATTLIST optgroup - %attrs; - disabled (disabled) #IMPLIED - label %Text; #REQUIRED - > - -<!ELEMENT option (#PCDATA)> <!-- selectable choice --> -<!ATTLIST option - %attrs; - selected (selected) #IMPLIED - disabled (disabled) #IMPLIED - label %Text; #IMPLIED - value CDATA #IMPLIED - > - -<!ELEMENT textarea (#PCDATA)> <!-- multi-line text field --> -<!ATTLIST textarea - %attrs; - %focus; - name CDATA #IMPLIED - rows %Number; #REQUIRED - cols %Number; #REQUIRED - disabled (disabled) #IMPLIED - readonly (readonly) #IMPLIED - onselect %Script; #IMPLIED - onchange %Script; #IMPLIED - > - -<!-- - The fieldset element is used to group form fields. - Only one legend element should occur in the content - and if present should only be preceded by whitespace. ---> -<!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*> -<!ATTLIST fieldset - %attrs; - > - -<!ELEMENT legend %Inline;> <!-- fieldset label --> -<!ATTLIST legend - %attrs; - accesskey %Character; #IMPLIED - > - -<!-- - Content is %Flow; excluding a, form and form controls ---> -<!ELEMENT button %button.content;> <!-- push button --> -<!ATTLIST button - %attrs; - %focus; - name CDATA #IMPLIED - value CDATA #IMPLIED - type (button|submit|reset) "submit" - disabled (disabled) #IMPLIED - > - -<!--======================= Tables =======================================--> - -<!-- Derived from IETF HTML table standard, see [RFC1942] --> - -<!-- - The border attribute sets the thickness of the frame around the - table. The default units are screen pixels. - - The frame attribute specifies which parts of the frame around - the table should be rendered. The values are not the same as - CALS to avoid a name clash with the valign attribute. ---> -<!ENTITY % TFrame "(void|above|below|hsides|lhs|rhs|vsides|box|border)"> - -<!-- - The rules attribute defines which rules to draw between cells: - - If rules is absent then assume: - "none" if border is absent or border="0" otherwise "all" ---> - -<!ENTITY % TRules "(none | groups | rows | cols | all)"> - -<!-- horizontal alignment attributes for cell contents - - char alignment char, e.g. char=':' - charoff offset for alignment char ---> -<!ENTITY % cellhalign - "align (left|center|right|justify|char) #IMPLIED - char %Character; #IMPLIED - charoff %Length; #IMPLIED" - > - -<!-- vertical alignment attributes for cell contents --> -<!ENTITY % cellvalign - "valign (top|middle|bottom|baseline) #IMPLIED" - > - -<!ELEMENT table - (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))> -<!ELEMENT caption %Inline;> -<!ELEMENT thead (tr)+> -<!ELEMENT tfoot (tr)+> -<!ELEMENT tbody (tr)+> -<!ELEMENT colgroup (col)*> -<!ELEMENT col EMPTY> -<!ELEMENT tr (th|td)+> -<!ELEMENT th %Flow;> -<!ELEMENT td %Flow;> - -<!ATTLIST table - %attrs; - summary %Text; #IMPLIED - width %Length; #IMPLIED - border %Pixels; #IMPLIED - frame %TFrame; #IMPLIED - rules %TRules; #IMPLIED - cellspacing %Length; #IMPLIED - cellpadding %Length; #IMPLIED - > - -<!ATTLIST caption - %attrs; - > - -<!-- -colgroup groups a set of col elements. It allows you to group -several semantically related columns together. ---> -<!ATTLIST colgroup - %attrs; - span %Number; "1" - width %MultiLength; #IMPLIED - %cellhalign; - %cellvalign; - > - -<!-- - col elements define the alignment properties for cells in - one or more columns. - - The width attribute specifies the width of the columns, e.g. - - width=64 width in screen pixels - width=0.5* relative width of 0.5 - - The span attribute causes the attributes of one - col element to apply to more than one column. ---> -<!ATTLIST col - %attrs; - span %Number; "1" - width %MultiLength; #IMPLIED - %cellhalign; - %cellvalign; - > - -<!-- - Use thead to duplicate headers when breaking table - across page boundaries, or for static headers when - tbody sections are rendered in scrolling panel. - - Use tfoot to duplicate footers when breaking table - across page boundaries, or for static footers when - tbody sections are rendered in scrolling panel. - - Use multiple tbody sections when rules are needed - between groups of table rows. ---> -<!ATTLIST thead - %attrs; - %cellhalign; - %cellvalign; - > - -<!ATTLIST tfoot - %attrs; - %cellhalign; - %cellvalign; - > - -<!ATTLIST tbody - %attrs; - %cellhalign; - %cellvalign; - > - -<!ATTLIST tr - %attrs; - %cellhalign; - %cellvalign; - > - - -<!-- Scope is simpler than headers attribute for common tables --> -<!ENTITY % Scope "(row|col|rowgroup|colgroup)"> - -<!-- th is for headers, td for data and for cells acting as both --> - -<!ATTLIST th - %attrs; - abbr %Text; #IMPLIED - axis CDATA #IMPLIED - headers IDREFS #IMPLIED - scope %Scope; #IMPLIED - rowspan %Number; "1" - colspan %Number; "1" - %cellhalign; - %cellvalign; - > - -<!ATTLIST td - %attrs; - abbr %Text; #IMPLIED - axis CDATA #IMPLIED - headers IDREFS #IMPLIED - scope %Scope; #IMPLIED - rowspan %Number; "1" - colspan %Number; "1" - %cellhalign; - %cellvalign; - > -
http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/FormAbstract.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/FormAbstract.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/FormAbstract.java deleted file mode 100644 index 2b8260d..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/FormAbstract.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.panels; - -import java.util.List; -import org.apache.wicket.markup.head.CssHeaderItem; -import org.apache.wicket.markup.head.IHeaderResponse; -import org.apache.wicket.markup.html.IHeaderContributor; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.markup.html.form.IFormSubmitter; -import org.apache.wicket.model.IModel; -import org.apache.wicket.request.resource.CssResourceReference; -import org.apache.isis.core.commons.authentication.AuthenticationSession; -import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider; -import org.apache.isis.core.commons.authentication.AuthenticationSessionProviderAware; -import org.apache.isis.core.metamodel.adapter.ObjectAdapter; -import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager; -import org.apache.isis.core.runtime.system.context.IsisContext; -import org.apache.isis.core.runtime.system.persistence.PersistenceSession; -import org.apache.isis.viewer.wicket.model.isis.PersistenceSessionProvider; -import org.apache.isis.viewer.wicket.ui.app.registry.ComponentFactoryRegistry; -import org.apache.isis.viewer.wicket.ui.app.registry.ComponentFactoryRegistryAccessor; -import org.apache.isis.viewer.wicket.ui.pages.PageClassRegistry; -import org.apache.isis.viewer.wicket.ui.pages.PageClassRegistryAccessor; - -public abstract class FormAbstract<T> extends Form<T> implements IHeaderContributor, ComponentFactoryRegistryAccessor, PageClassRegistryAccessor, AuthenticationSessionProvider, PersistenceSessionProvider { - - private static final long serialVersionUID = 1L; - - public FormAbstract(final String id) { - super(id); - } - - public FormAbstract(final String id, final IModel<T> model) { - super(id, model); - } - - - // /////////////////////////////////////////////////////////////////// - // process() override - // /////////////////////////////////////////////////////////////////// - - private String preValidationErrorIfAny; - /** - * Temporarily made available during {@link #process(IFormSubmitter)}, - * for the benefit of any form validation. - */ - protected String getPreValidationErrorIfAny() { - return preValidationErrorIfAny; - } - - @Override - public void process(final IFormSubmitter submittingComponent) { - try { - - if(submittingComponent instanceof IFormSubmitterWithPreValidateHook) { - IFormSubmitterWithPreValidateHook componentWithPreSubmitHook = (IFormSubmitterWithPreValidateHook) submittingComponent; - preValidationErrorIfAny = componentWithPreSubmitHook.preValidate(); - } - - if(preValidationErrorIfAny != null) { - // an exception has already occurred, so disable for remainder of thread. - AdapterManager.ConcurrencyChecking.executeWithConcurrencyCheckingDisabled(new Runnable(){ - @Override - public void run() { - FormAbstract.super.process(submittingComponent); - } - }); - } else { - super.process(submittingComponent); - } - - } finally { - preValidationErrorIfAny = null; - } - } - - - // /////////////////////////////////////////////////////////////////// - // Convenience - // /////////////////////////////////////////////////////////////////// - - @Override - public ComponentFactoryRegistry getComponentFactoryRegistry() { - return ((ComponentFactoryRegistryAccessor) getApplication()).getComponentFactoryRegistry(); - } - - @Override - public PageClassRegistry getPageClassRegistry() { - return ((PageClassRegistryAccessor) getApplication()).getPageClassRegistry(); - } - - // /////////////////////////////////////////////////////////////////// - // Dependencies (from IsisContext) - // /////////////////////////////////////////////////////////////////// - - @Override - public PersistenceSession getPersistenceSession() { - return IsisContext.getPersistenceSession(); - } - - @Override - public AuthenticationSession getAuthenticationSession() { - return IsisContext.getAuthenticationSession(); - } - - protected List<ObjectAdapter> getServiceAdapters() { - return IsisContext.getPersistenceSession().getServices(); - } - - // ///////////////////////////////////////////////// - // *Provider impl. - // ///////////////////////////////////////////////// - - @Override - public void injectInto(final Object candidate) { - if (AuthenticationSessionProviderAware.class.isAssignableFrom(candidate.getClass())) { - final AuthenticationSessionProviderAware cast = AuthenticationSessionProviderAware.class.cast(candidate); - cast.setAuthenticationSessionProvider(this); - } - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/IFormSubmitterWithPreValidateHook.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/IFormSubmitterWithPreValidateHook.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/IFormSubmitterWithPreValidateHook.java deleted file mode 100644 index b5e3c21..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/IFormSubmitterWithPreValidateHook.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.panels; - -public interface IFormSubmitterWithPreValidateHook { - String preValidate(); -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java deleted file mode 100644 index 15ef6f0..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.panels; - -import org.apache.wicket.Component; -import org.apache.wicket.Session; -import org.apache.wicket.markup.html.IHeaderContributor; -import org.apache.wicket.markup.html.panel.Panel; -import org.apache.wicket.model.IModel; -import org.apache.isis.core.commons.authentication.AuthenticationSession; -import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider; -import org.apache.isis.core.commons.authentication.AuthenticationSessionProviderAware; -import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager; -import org.apache.isis.core.runtime.system.context.IsisContext; -import org.apache.isis.core.runtime.system.persistence.PersistenceSession; -import org.apache.isis.viewer.wicket.model.hints.UiHintContainer; -import org.apache.isis.viewer.wicket.model.isis.PersistenceSessionProvider; -import org.apache.isis.viewer.wicket.ui.ComponentType; -import org.apache.isis.viewer.wicket.ui.app.registry.ComponentFactoryRegistry; -import org.apache.isis.viewer.wicket.ui.app.registry.ComponentFactoryRegistryAccessor; -import org.apache.isis.viewer.wicket.ui.util.Components; - -/** - * Convenience adapter for {@link Panel}s built up using {@link ComponentType}s. - */ -// TODO mgrigorov: extend GenericPanel and make T the type of the model object, not the model -public abstract class PanelAbstract<T extends IModel<?>> extends Panel implements IHeaderContributor, PersistenceSessionProvider, AuthenticationSessionProvider { - - private static final long serialVersionUID = 1L; - - private ComponentType componentType; - - public PanelAbstract(final ComponentType componentType) { - this(componentType, null); - } - - public PanelAbstract(final String id) { - this(id, null); - } - - public PanelAbstract(final ComponentType componentType, final T model) { - this(componentType.getWicketId(), model); - } - - public PanelAbstract(final String id, final T model) { - super(id, model); - this.componentType = ComponentType.lookup(id); - } - - - /** - * Will be null if created using {@link #PanelAbstract(String, IModel)}. - */ - public ComponentType getComponentType() { - return componentType; - } - - @SuppressWarnings("unchecked") - public T getModel() { - return (T) getDefaultModel(); - } - - /** - * For subclasses - * - * @return - */ - protected Component addOrReplace(final ComponentType componentType, final IModel<?> model) { - return getComponentFactoryRegistry().addOrReplaceComponent(this, componentType, model); - } - - /** - * For subclasses - */ - protected void permanentlyHide(final ComponentType... componentIds) { - Components.permanentlyHide(this, componentIds); - } - - /** - * For subclasses - */ - public void permanentlyHide(final String... ids) { - Components.permanentlyHide(this, ids); - } - - - // /////////////////////////////////////////////////////////////////// - // Hint support - // /////////////////////////////////////////////////////////////////// - - public UiHintContainer getUiHintContainer() { - return UiHintContainer.Util.hintContainerOf(this); - } - - public <T extends UiHintContainer> T getUiHintContainer(final Class<T> additionalConstraint) { - return UiHintContainer.Util.hintContainerOf(this, additionalConstraint); - } - - - // /////////////////////////////////////////////////////////////////// - // Convenience - // /////////////////////////////////////////////////////////////////// - - /** - * The underlying {@link AuthenticationSession Isis session} wrapped in the - * {@link #getWebSession() Wicket session}. - * - * @return - */ - @Override - public AuthenticationSession getAuthenticationSession() { - final AuthenticationSessionProvider asa = (AuthenticationSessionProvider) Session.get(); - return asa.getAuthenticationSession(); - } - - // /////////////////////////////////////////////////////////////////// - // Dependencies (from IsisContext) - // /////////////////////////////////////////////////////////////////// - - @Override - public PersistenceSession getPersistenceSession() { - return IsisContext.getPersistenceSession(); - } - - public AdapterManager getAdapterManager() { - return getPersistenceSession().getAdapterManager(); - } - - - // ///////////////////////////////////////////////// - // Dependency Injection - // ///////////////////////////////////////////////// - - protected ComponentFactoryRegistry getComponentFactoryRegistry() { - return ((ComponentFactoryRegistryAccessor) getApplication()).getComponentFactoryRegistry(); - } - - - // ///////////////////////////////////////////////// - // *Provider impl. - // ///////////////////////////////////////////////// - - @Override - public void injectInto(final Object candidate) { - if (AuthenticationSessionProviderAware.class.isAssignableFrom(candidate.getClass())) { - final AuthenticationSessionProviderAware cast = AuthenticationSessionProviderAware.class.cast(candidate); - cast.setAuthenticationSessionProvider(this); - } - } - - /** - * Helper method that looks up a domain service by type - * - * @param serviceClass The class of the domain service to lookup - * @param <S> The type of the domain service to lookup - * @return The found domain service - */ - protected <S> S lookupService(final Class<S> serviceClass) { - return getPersistenceSession().getServicesInjector().lookupService(serviceClass); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelUtil.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelUtil.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelUtil.java deleted file mode 100644 index 4c7af42..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelUtil.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.panels; - -import com.google.common.base.Strings; -import org.apache.wicket.markup.head.CssHeaderItem; -import org.apache.wicket.markup.head.CssReferenceHeaderItem; -import org.apache.wicket.markup.head.IHeaderResponse; -import org.apache.wicket.request.resource.CssResourceReference; - -public final class PanelUtil { - - private PanelUtil(){} - - /** - * The contribution to the header performed implicitly by {@link PanelAbstract}. - */ - public static void renderHead(final IHeaderResponse response, final Class<?> cls) { - final CssResourceReference cssResourceReference = cssResourceReferenceFor(cls); - if(cssResourceReference == null) { - return; - } - final CssReferenceHeaderItem forReference = CssHeaderItem.forReference(cssResourceReference); - response.render(forReference); - } - - public static CssResourceReference cssResourceReferenceFor(final Class<?> cls) { - return cssResourceReferenceFor(cls, null); - } - - public static CssResourceReference cssResourceReferenceFor(final Class<?> cls, final String suffix) { - final String url = cssFor(cls, suffix); - if(url == null) { - return null; - } - return new CssResourceReference(cls, url); - } - - private static String cssFor(final Class<?> cls, String suffix) { - if(cls == null) { - return null; - } - String simpleName = cls.getSimpleName(); - if(Strings.isNullOrEmpty(simpleName)) { - return null; // eg inner classes - } - String string; - if (suffix != null) { - string = ("-" + suffix); - } else { - string = ""; - } - return simpleName + string + ".css"; - } -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/Components.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/Components.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/Components.java deleted file mode 100644 index 93939c1..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/Components.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.util; - -import org.apache.wicket.Component; -import org.apache.wicket.MarkupContainer; -import org.apache.wicket.markup.html.basic.Label; - -import org.apache.isis.viewer.wicket.ui.ComponentType; - -public final class Components { - - private Components() { - } - - /** - * Permanently hides by replacing with a {@link Label} that has an empty - * string for its caption. - */ - public static void permanentlyHide(final MarkupContainer container, final String... ids) { - for (final String id : ids) { - permanentlyHideSingle(container, id); - } - } - - /** - * @see #permanentlyHide(MarkupContainer, String...) - */ - public static void permanentlyHide(final MarkupContainer container, final ComponentType... componentIds) { - for (final ComponentType componentType : componentIds) { - final String wicketId = componentType.getWicketId(); - permanentlyHideSingle(container, wicketId); - } - } - - /** - * Not overloaded because - although compiles ok on JDK6u20 (Mac), fails to - * on JDK6u18 (Ubuntu) - */ - private static void permanentlyHideSingle(final MarkupContainer container, final String id) { - final Label label = new Label(id, ""); - label.setVisible(false); - container.addOrReplace(label); - } - - /** - * Sets the visibility of the child component(s) within the supplied - * container. - */ - public static void setVisible(final MarkupContainer container, final boolean visibility, final String... ids) { - for (final String id : ids) { - setVisible(container, visibility, id); - } - } - - /** - * @see #setVisible(MarkupContainer, boolean, String...) - */ - public static void setVisible(final MarkupContainer container, final boolean visibility, final ComponentType... componentTypes) { - for (final ComponentType componentType : componentTypes) { - final String wicketId = componentType.getWicketId(); - setVisible(container, visibility, wicketId); - } - } - - private static void setVisible(final MarkupContainer container, final boolean visibility, final String wicketId) { - final Component childComponent = container.get(wicketId); - childComponent.setVisible(visibility); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/CssClassAppender.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/CssClassAppender.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/CssClassAppender.java deleted file mode 100644 index 884bd26..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/CssClassAppender.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.util; - -import com.google.common.base.Strings; -import org.apache.wicket.MarkupContainer; -import org.apache.wicket.behavior.AttributeAppender; -import org.apache.wicket.markup.ComponentTag; -import org.apache.wicket.model.IModel; -import org.apache.wicket.model.Model; - -/** - * Implementation of {@link AttributeAppender} that appends the provided CSS - * <tt>class</tt> attribute. - */ -public class CssClassAppender extends AttributeAppender { - - private static final long serialVersionUID = 1L; - - public CssClassAppender(final IModel<String> appendModel) { - super("class", appendModel, " "); - } - - public CssClassAppender(final String append) { - this(Model.of(append)); - } - - /** - * Adds CSS class to tag (providing that the class is non-null and non-empty). - */ - public static void appendCssClassTo( - final ComponentTag tag, - final String cssClass) { - if(Strings.isNullOrEmpty(cssClass)) { - return; - } - tag.append("class", cssClass, " "); - } - - /** - * Adds CSS class to container (providing that the class is non-null and non-empty). - */ - public static void appendCssClassTo( - final MarkupContainer markupContainer, - final String cssClass) { - if(Strings.isNullOrEmpty(cssClass)) { - return; - } - markupContainer.add(new CssClassAppender(cssClass)); - } - - /** - * Utility method to sanitize string into a single CSS class. - */ - public static String asCssStyle(final String str) { - return str.toLowerCase().replaceAll("[^A-Za-z0-9- ]", "").replaceAll("\\s+", "-"); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/CssClassRemover.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/CssClassRemover.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/CssClassRemover.java deleted file mode 100644 index 6999555..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/CssClassRemover.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.util; - -import java.util.Set; - -import com.google.common.base.Joiner; -import com.google.common.base.Splitter; -import com.google.common.collect.Sets; - -import org.apache.wicket.AttributeModifier; -import org.apache.wicket.behavior.AttributeAppender; -import org.apache.wicket.model.Model; - -/** - * Implementation of {@link AttributeAppender} that appends the provided CSS - * <tt>class</tt> attribute. - */ -public class CssClassRemover extends AttributeModifier { - - private static final long serialVersionUID = 1L; - - public CssClassRemover(String cssClass) { - super("class", new Model<String>(cssClass)); - } - - @Override - protected String newValue(String currentValue, String valueToRemove) { - if (currentValue == null) return ""; - - Set<String> classes = Sets.newHashSet(Splitter.on(" ").split(currentValue)); - classes.remove(valueToRemove); - return Joiner.on(" ").join(classes); - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/Links.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/Links.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/Links.java deleted file mode 100644 index 5d58417..0000000 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/Links.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.util; - -import org.apache.wicket.Page; -import org.apache.wicket.markup.ComponentTag; -import org.apache.wicket.markup.html.form.SubmitLink; -import org.apache.wicket.markup.html.link.AbstractLink; -import org.apache.wicket.markup.html.link.BookmarkablePageLink; -import org.apache.wicket.markup.html.link.Link; -import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.apache.isis.viewer.wicket.model.mementos.PageParameterNames; - -public final class Links { - - public static <T extends Page> AbstractLink newSubmitLink(final String linkId, final PageParameters pageParameters, final Class<T> pageClass) { - return new SubmitLink(linkId) { - private static final long serialVersionUID = 1L; - @Override - // TODO mgrigorov: consider overriding onAfterSubmit instead - public void onSubmit() { - getForm().setResponsePage(pageClass, pageParameters); - super.onSubmit(); - } - }; - } - - /** - * @deprecated Use {@link #newBookmarkablePageLink(String, org.apache.wicket.request.mapper.parameter.PageParameters, Class)} instead - */ - @Deprecated - public static <T extends Page> AbstractLink newAbstractLink(final String linkId, final PageParameters pageParameters, final Class<T> pageClass) { - - return new Link<T>(linkId) { - private static final long serialVersionUID = 1L; - @Override - public void onClick() { - this.setResponsePage(pageClass, pageParameters); - } - - }; - } - - // TODO mgrigorov: what is the added value ? - public static <T extends Page> AbstractLink newBookmarkablePageLink( - final String linkId, final PageParameters pageParameters, final Class<T> pageClass) { - - return new BookmarkablePageLink<Void>(linkId, pageClass, pageParameters); - } - - public static <T extends Page> AbstractLink newBookmarkablePageLinkWithAnchor( - final String linkId, final PageParameters pageParameters, final Class<T> pageClass) { - - final String hints = PageParameterNames.ANCHOR.getStringFrom(pageParameters); - if(hints != null) { - PageParameterNames.ANCHOR.removeFrom(pageParameters); - return new BookmarkablePageLink<T>(linkId, pageClass, pageParameters) { - private static final long serialVersionUID = 1L; - - @Override - protected CharSequence appendAnchor(ComponentTag tag, CharSequence url) { - if(url != null) { - url = url + "#" + hints; - } - return url; - } - }; - } else { - return newBookmarkablePageLink(linkId, pageParameters, pageClass); - } - - } -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/main/resources/images/Default.png ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/resources/images/Default.png b/component/viewer/wicket/ui/src/main/resources/images/Default.png deleted file mode 100644 index 255999f..0000000 Binary files a/component/viewer/wicket/ui/src/main/resources/images/Default.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/ComponentFactoryAbstractTest_init.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/ComponentFactoryAbstractTest_init.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/ComponentFactoryAbstractTest_init.java deleted file mode 100644 index a47fb1b..0000000 --- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/ComponentFactoryAbstractTest_init.java +++ /dev/null @@ -1,109 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 org.apache.isis.viewer.wicket.ui; - -import org.apache.wicket.Component; -import org.apache.wicket.model.IModel; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; - -public class ComponentFactoryAbstractTest_init { - - @Rule - public ExpectedException thrown= ExpectedException.none(); - - @Test - public void canInstantiateComponentFactoryWithNoComponentClass() { - class ComponentFactoryWithNoComponentClass extends ComponentFactoryAbstract { - - private static final long serialVersionUID = 1L; - - public ComponentFactoryWithNoComponentClass() { - super(null); - } - - @Override - protected ApplicationAdvice appliesTo(IModel<?> model) { - return null; - } - - @Override - public Component createComponent(String id, IModel<?> model) { - return null; - } - - } - - new ComponentFactoryWithNoComponentClass(); - } - - @Test - public void canInstantiateComponentFactoryWithComponentClass() { - class ComponentClass {}; - class ComponentFactoryWithComponentClass extends ComponentFactoryAbstract { - - private static final long serialVersionUID = 1L; - - public ComponentFactoryWithComponentClass() { - super(null, ComponentClass.class); - } - - @Override - protected ApplicationAdvice appliesTo(IModel<?> model) { - return null; - } - - @Override - public Component createComponent(String id, IModel<?> model) { - return null; - } - - } - - new ComponentFactoryWithComponentClass(); - } - - @Test - public void cannotInstantiateComponentFactoryWithIncorrectComponentClass() { - thrown.expect(IllegalArgumentException.class); - - class ComponentFactoryWithIncorrectComponentClass extends ComponentFactoryAbstract { - - private static final long serialVersionUID = 1L; - - public ComponentFactoryWithIncorrectComponentClass() { - super(null, ComponentFactoryWithIncorrectComponentClass.class); - } - - @Override - protected ApplicationAdvice appliesTo(IModel<?> model) { - return null; - } - - @Override - public Component createComponent(String id, IModel<?> model) { - return null; - } - - } - - new ComponentFactoryWithIncorrectComponentClass(); - } - - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/ComponentType_ConstantsTest.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/ComponentType_ConstantsTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/ComponentType_ConstantsTest.java deleted file mode 100644 index 3930778..0000000 --- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/ComponentType_ConstantsTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui; - -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; - -import org.junit.Test; - -public class ComponentType_ConstantsTest { - - @Test - public void testToString() { - assertThat(ComponentType.COLLECTION_CONTENTS.toString(), is("collectionContents")); - } - - public enum X { - FOO, BAR - } -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionContentsSelectorDropdownPanelTest.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionContentsSelectorDropdownPanelTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionContentsSelectorDropdownPanelTest.java deleted file mode 100644 index 408dd28..0000000 --- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionContentsSelectorDropdownPanelTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.components.collection.selector; - -import java.util.Arrays; -import java.util.List; -import org.jmock.auto.Mock; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2; -import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode; -import org.apache.isis.viewer.wicket.ui.ComponentFactory; -import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - -public class CollectionContentsSelectorDropdownPanelTest { - - @Rule - public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES); - - @Mock - private ComponentFactory one; - - @Mock - private ComponentFactory two; - - private ComponentFactory ajaxTableComponentFactory; - - @Before - public void setUp() throws Exception { - ajaxTableComponentFactory = new CollectionContentsAsAjaxTablePanelFactory(); - } - - @Test - public void testOrderAjaxTableToEnd() { - - List<ComponentFactory> componentFactories = - Arrays.<ComponentFactory>asList( - one, - ajaxTableComponentFactory, - two); - List<ComponentFactory> orderAjaxTableToEnd = CollectionSelectorHelper.orderAjaxTableToEnd(componentFactories); - assertThat(orderAjaxTableToEnd.get(0), is(one)); - assertThat(orderAjaxTableToEnd.get(1), is(two)); - assertThat(orderAjaxTableToEnd.get(2), is(ajaxTableComponentFactory)); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanelTest_abbreviated.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanelTest_abbreviated.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanelTest_abbreviated.java deleted file mode 100644 index 5ab35e5..0000000 --- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanelTest_abbreviated.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.components.entity.icontitle; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - -import org.junit.Test; - -public class EntityIconAndTitlePanelTest_abbreviated { - - @Test - public void notTruncated() throws Exception { - assertThat(EntityIconAndTitlePanel.abbreviated("abcdef", 6), is("abcdef")); - } - - @Test - public void truncated() throws Exception { - assertThat(EntityIconAndTitlePanel.abbreviated("abcdefg", 6), is("abc...")); - } - - @Test - public void notTruncatedAtEllipsesLimit() throws Exception { - assertThat(EntityIconAndTitlePanel.abbreviated("abc", 3), is("abc")); - assertThat(EntityIconAndTitlePanel.abbreviated("ab", 2), is("ab")); - assertThat(EntityIconAndTitlePanel.abbreviated("a", 1), is("a")); - } - - @Test - public void truncatedAtEllipsesLimit() throws Exception { - assertThat(EntityIconAndTitlePanel.abbreviated("abcd", 3), is("")); - assertThat(EntityIconAndTitlePanel.abbreviated("abc", 2), is("")); - assertThat(EntityIconAndTitlePanel.abbreviated("ab", 1), is("")); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/DateConverterForApplibDateTest.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/DateConverterForApplibDateTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/DateConverterForApplibDateTest.java deleted file mode 100644 index 2d8f93a..0000000 --- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/DateConverterForApplibDateTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.components.scalars.isisapplib; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - -import java.util.TimeZone; - -import org.jmock.Expectations; -import org.jmock.auto.Mock; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; - -import org.apache.isis.applib.value.Date; -import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2; -import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode; -import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings; - -public class DateConverterForApplibDateTest { - - @Rule - public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES); - - @Mock - private WicketViewerSettings settings; - - private TimeZone timezone; - - @Before - public void setUp() throws Exception { - context.checking(new Expectations() { - { - allowing(settings).getDatePattern(); - will(returnValue("yyyy-MM-dd")); - } - }); - } - - @Before - public void fixTimezone() throws Exception { - timezone = TimeZone.getDefault(); - TimeZone.setDefault(TimeZone.getTimeZone("UTC")); - } - - @Before - public void restoreTimezone() throws Exception { - TimeZone.setDefault(timezone); - } - - @Test - public void roundtripWhenParsingDateFormat() { - final DateConverterForApplibDate converter = new DateConverterForApplibDate(settings, 0); - final Date dt = converter.convertToObject("2013-05-11", null); - assertThat(dt, is(new Date(2013, 05, 11))); - - final String str = converter.convertToString(dt, null); - assertThat(str, is("2013-05-11")); - } - - @Test - public void roundtripWhenParsingDateFormatWithAdjustBy() { - final DateConverterForApplibDate converter = new DateConverterForApplibDate(settings, -1); - final Date dt = converter.convertToObject("2013-05-11", null); - assertThat(dt, is(new Date(2013, 05, 12))); - - final String str = converter.convertToString(dt, null); - assertThat(str, is("2013-05-11")); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/DateConverterForApplibDateTimeTest.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/DateConverterForApplibDateTimeTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/DateConverterForApplibDateTimeTest.java deleted file mode 100644 index a664690..0000000 --- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/DateConverterForApplibDateTimeTest.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.components.scalars.isisapplib; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - -import java.util.TimeZone; - -import org.jmock.Expectations; -import org.jmock.auto.Mock; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; - -import org.apache.isis.applib.value.DateTime; -import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2; -import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode; -import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings; - -public class DateConverterForApplibDateTimeTest { - - @Rule - public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES); - - @Mock - private WicketViewerSettings settings; - - private TimeZone timezone; - - @Before - public void setUp() throws Exception { - context.checking(new Expectations() { - { - allowing(settings).getDatePattern(); - will(returnValue("yyyy-MM-dd")); - allowing(settings).getDateTimePattern(); - will(returnValue("yyyy-MM-dd HH:mm")); - } - }); - } - - @Before - public void fixTimezone() throws Exception { - timezone = TimeZone.getDefault(); - TimeZone.setDefault(TimeZone.getTimeZone("UTC")); - } - - @Before - public void restoreTimezone() throws Exception { - TimeZone.setDefault(timezone); - } - - @Test - public void roundtripWhenParsingDateFormat() { - final DateConverterForApplibDateTime converter = new DateConverterForApplibDateTime(settings, 0); - final DateTime dt = converter.convertToObject("2013-05-11", null); - assertThat(dt, is(new DateTime(2013, 05, 11, 0, 0))); - - final String str = converter.convertToString(dt, null); - assertThat(str, is("2013-05-11 00:00")); - } - - @Test - public void roundtripWhenParsingDateTimeFormat() { - final DateConverterForApplibDateTime converter = new DateConverterForApplibDateTime(settings, 0); - final DateTime dt = converter.convertToObject("2013-05-11 00:00", null); - assertThat(dt, is(new DateTime(2013, 05, 11, 0, 0))); - - final String str = converter.convertToString(dt, null); - assertThat(str, is("2013-05-11 00:00")); - } - - @Test - public void roundtripWhenParsingDateFormatWithAdjustBy() { - final DateConverterForApplibDateTime converter = new DateConverterForApplibDateTime(settings, -1); - final DateTime dt = converter.convertToObject("2013-05-11", null); - assertThat(dt, is(new DateTime(2013, 05, 12, 0, 0))); - - final String str = converter.convertToString(dt, null); - assertThat(str, is("2013-05-11 00:00")); - } - - @Test - public void roundtripWhenParsingDateTimeFormatWithAdjustBy() { - final DateConverterForApplibDateTime converter = new DateConverterForApplibDateTime(settings, -1); - final DateTime dt = converter.convertToObject("2013-05-11 00:00", null); - assertThat(dt, is(new DateTime(2013, 05, 12, 0, 0))); - - final String str = converter.convertToString(dt, null); - assertThat(str, is("2013-05-11 00:00")); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/d84c6609/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaSqlDateTest.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaSqlDateTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaSqlDateTest.java deleted file mode 100644 index 5f79e55..0000000 --- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaSqlDateTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 org.apache.isis.viewer.wicket.ui.components.scalars.jdkdates; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - -import org.jmock.Expectations; -import org.jmock.auto.Mock; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; - -import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2; -import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode; -import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings; - -public class DateConverterForJavaSqlDateTest { - - @Rule - public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES); - - @Mock - private WicketViewerSettings settings; - - @Before - public void setUp() throws Exception { - context.checking(new Expectations() { - { - allowing(settings).getDatePattern(); - will(returnValue("yyyy-MM-dd")); - allowing(settings).getDatePickerPattern(); - will(returnValue("yy-mm-dd")); - } - }); - } - - @Test - public void roundtrip() { - final DateConverterForJavaSqlDate converter = new DateConverterForJavaSqlDate(settings, 0); - final java.sql.Date dt = converter.convertToObject("2013-05-11", null); - assertThat(dt, is(newJavaSqlDate(2013, 5, 11))); - - final String str = converter.convertToString(dt, null); - assertThat(str, is("2013-05-11")); - } - - @Test - public void roundtripWithAdjustBy() { - final DateConverterForJavaSqlDate converter = new DateConverterForJavaSqlDate(settings, -1); - final java.sql.Date dt = converter.convertToObject("2013-05-11", null); - assertThat(dt, is(newJavaSqlDate(2013, 5, 12))); - - final String str = converter.convertToString(dt, null); - assertThat(str, is("2013-05-11")); - } - - @SuppressWarnings("deprecation") - private java.sql.Date newJavaSqlDate(int yyyy, int mm, int dd) { - return new java.sql.Date(yyyy-1900, mm-1, dd); - } - -}