New menu class that has an entry at the very end, similar to the input
text prefix, that is always available
Change-Id: I03d8f689e37021d3daac6bf34f7d35f0e4d71999
diff --git a/dev/demo/alwaysmenu.html b/dev/demo/alwaysmenu.html
new file mode 100644
index 0000000..37ea5d7
--- /dev/null
+++ b/dev/demo/alwaysmenu.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>AlwaysMenu demo</title>
+ <meta charset="utf-8" />
+
+ <!-- Load remote -->
+ <script data-main="/demo/alwaysmenudemo.js" src="/js/lib/require.js" async="async"></script>
+ <link type="text/css" rel="stylesheet" href="/css/kalamar.css" />
+
+
+ <!-- Load local -->
+ <script data-main="alwaysmenudemo.js" src="../js/lib/require.js" async="async"></script>
+ <link type="text/css" rel="stylesheet" href="../css/kalamar.css" />
+
+ <style type="text/css" rel="stylesheet">
+.info {
+ background-color: #ddd;
+ color: black;
+ padding: 1em;
+ font-family: mono;
+}
+body {
+ margin: 0;
+ background-color: #ddd;
+}
+ </style>
+ </head>
+ <body>
+ <div style="position: absolute; background-color: #7ba400; height: 50px; width: 100%;"></div>
+
+ <div id="menu" class="vc" style="padding-top: 80px; padding-left: 80px;"></div>
+ <!-- <div id="largemenu" style="padding-top: 0px; padding-left: 500px;"></div> -->
+ <div id="multisortmenu" style="padding-top: 0px; padding-left: 550px;"></div>
+
+ <span id="choose-ql" class="menu select" style="position: absolute; right: 100px; top: 90px;">
+ <select name="ql">
+ <option value="poliqarp">Poliqarp</option>
+ <option value="cosmas2">Cosmas 2</option>
+ <option value="annis" selected>Annis QL</option>
+ <option value="cql">CQL</option>
+ </select>
+ </span>
+
+ <main>
+ <div>
+ <div id="pagination"><a rel="prev"><span><i class="fa fa-caret-left"></i></span></a><a rel="self"><span>1</span></a><a href="/kalamar?q=der+%5Bmate/m%3Dnumber:sg%5D&ql=poliqarp&p=2"><span>2</span></a><a href="/kalamar?q=der+%5Bmate/m%3Dnumber:sg%5D&ql=poliqarp&p=3"><span>3</span></a><span><i class="fa fa-ellipsis-h"></i></span><a href="/kalamar?q=der+%5Bmate/m%3Dnumber:sg%5D&ql=poliqarp&p=52230"><span>52230</span></a><a rel="next" href="/kalamar?q=der+%5Bmate/m%3Dnumber:sg%5D&ql=poliqarp&p=2"><span><i class="fa fa-caret-right"></i></span></a></div>
+ </div>
+ </main>
+ </body>
+</html>
diff --git a/dev/demo/alwaysmenudemo.js b/dev/demo/alwaysmenudemo.js
new file mode 100644
index 0000000..b6d37b6
--- /dev/null
+++ b/dev/demo/alwaysmenudemo.js
@@ -0,0 +1,187 @@
+requirejs.config({
+ baseUrl: '../js/src'
+ });
+ // here alwaysmenu instead of normal menu, then + alwaysEntry
+ require(['alwaysmenu','menu/item', 'menu/prefix', 'menu/lengthField', 'selectMenu', 'hint/item', 'hint/lengthField',
+ //'alwaysmenu/alwaysentry'
+ 'alwaysentry'
+ ],
+ function (alwaysMenuClass, itemClass, prefixClass, lengthFieldClass, selectMenuClass, hintItemClass, hintLengthField, alwaysEntryClass) {
+
+ /**
+ * Create own menu item class.
+ */
+ var OwnMenuItemClass = {
+ create : function (params) {
+ return Object.create(itemClass).upgradeTo(this)._init(params);
+ },
+
+ // content function
+ content : function (content) {
+ if (arguments.length === 1) {
+ this._content = content;
+ };
+ return this._content;
+ },
+
+ // enter or click
+ onclick : function () {
+ console.log(this._name);
+ },
+
+ // right arrow
+ further : function () {
+ console.log("Further: " + this._name);
+ },
+
+ // initialize item
+ _init : function (params) {
+ if (params[0] === undefined)
+ throw new Error("Missing parameters");
+
+ this._name = params[0];
+ this._content = document.createTextNode(this._name);
+ this._lcField = ' ' + this.content().textContent.toLowerCase();
+ return this;
+ }
+ };
+
+ /**
+ * Create own prefix class.
+ */
+ var OwnPrefixClass = {
+ create : function () {
+ return Object.create(prefixClass)
+ .upgradeTo(this)
+ ._init();
+ },
+ onclick : function () {
+ console.log('Prefix: ' + this.value());
+ }
+ };
+
+ /**
+ * Create own alwaysEntry class.
+ */
+ var OwnEntryClass = {
+ create : function () {
+ return alwaysEntryClass.create("Save")
+ .upgradeTo(this);
+ //._init();
+ },
+ onclick : function () {
+ console.log('Entry: ' + this.value());
+ }
+ };
+
+ /**
+ * Create own menu class.
+ */
+
+ var OwnMenu = {
+ create : function (list) {
+ const params = {
+ itemClass : OwnMenuItemClass,
+ prefixClass : OwnPrefixClass,
+ lengthFieldClass : lengthFieldClass,
+ alwaysEntryClass : OwnEntryClass
+ };
+ console.log("Am now in OwnMenu create",alwaysMenuClass); // we learn, that it definetly has all the functions defined in alwaysmenu.js
+ var obj = alwaysMenuClass.create(list,params)
+ .upgradeTo(this);
+ //._init(list, params);
+ obj._firstActive = true;
+ return obj;
+ }
+ };
+
+ var menu = OwnMenu.create([
+ ['Titel', 'title', 'string'],
+ ['Untertitel', 'subTitle', 'string'],
+ ['Beschreibung', 'desc', 'string'],
+ ['Veröffentlichungsdatum', 'pubDate', 'date'],
+ ['Länge', 'length', 'integer'],
+ ['Autor', 'author', 'string'],
+ ['Genre', 'genre', 'string'],
+ ['corpusID', 'corpusID', 'string'],
+ ['docID', 'docID', 'string'],
+ ['textID', 'textID', 'string']
+ ]);
+
+ /*
+ var largeMenu = alwaysMenuClass.create([
+ // http://www.ids-mannheim.de/cosmas2/projekt/referenz/stts/morph.html
+ // http://nachhalt.sfb632.uni-potsdam.de/owl-docu/stts.html
+ // "$.", "$(", "$,"
+ ["ADJA","ADJA ", "Attributive Adjective"],
+ ["ADJD","ADJD ", "Predicative Adjective"],
+ ["ADV","ADV ", "Adverb"],
+ ["APPO","APPO ", "Postposition"],
+ ["APPR","APPR ", "Preposition"],
+ ["APPRART","APPRART ", "Preposition with Determiner"],
+ ["APZR","APZR ","Right Circumposition"],
+ ["ART","ART ", "Determiner"],
+ ["CARD","CARD ", "Cardinal Number"],
+ ["FM","FM ", "Foreign Material"],
+ ["ITJ","ITJ ", "Interjection"],
+ ["KOKOM","KOKOM ", "Comparison Particle"],
+ ["KON","KON ", "Coordinating Conjuncion"],
+ ["KOUI","KOUI ", "Subordinating Conjunction with 'zu'"],
+ ["KOUS","KOUS ", "Subordinating Conjunction with Sentence"],
+ ["NE","NE ", "Named Entity"],
+ ["NN","NN ", "Normal Nomina"],
+ ["PAV", "PAV ", "Pronominal Adverb"],
+ ["PDAT","PDAT ","Attributive Demonstrative Pronoun"],
+ ["PDS","PDS ", "Substitutive Demonstrative Pronoun"],
+ ["PIAT","PIAT ", "Attributive Indefinite Pronoun without Determiner"],
+ ["PIDAT","PIDAT ", "Attributive Indefinite Pronoun with Determiner"],
+ ["PIS","PIS ", "Substitutive Indefinite Pronoun"],
+ ["PPER","PPER ", "Personal Pronoun"],
+ ["PPOSAT","PPOSAT ", "Attributive Possessive Pronoun"],
+ ["PPOSS","PPOSS ", "Substitutive Possessive Pronoun"],
+ ["PRELAT","PRELAT ", "Attributive Relative Pronoun"],
+ ["PRELS","PRELS ", "Substitutive Relative Pronoun"],
+ ["PRF","PRF ", "Reflexive Pronoun"],
+ ["PROAV","PROAV ", "Pronominal Adverb"],
+ ["PTKA","PTKA ","Particle with Adjective"],
+ ["PTKANT","PTKANT ", "Answering Particle"],
+ ["PTKNEG","PTKNEG ", "Negation Particle"],
+ ["PTKVZ","PTKVZ ", "Separated Verbal Particle"],
+ ["PTKZU","PTKZU ", "'zu' Particle"],
+ ["PWAT","PWAT ", "Attributive Interrogative Pronoun"],
+ ["PWAV","PWAV ", "Adverbial Interrogative Pronoun"],
+ ["PWS","PWS ", "Substitutive Interrogative Pronoun"],
+ ["TRUNC","TRUNC ","Truncated"],
+ ["VAFIN","VAFIN ", "Auxiliary Finite Verb"],
+ ["VAIMP","VAIMP ", "Auxiliary Finite Imperative Verb"],
+ ["VAINF","VAINF ", "Auxiliary Infinite Verb"],
+ ["VAPP","VAPP ", "Auxiliary Perfect Participle"],
+ ["VMFIN","VMFIN ", "Modal Finite Verb"],
+ ["VMINF","VMINF ", "Modal Infinite Verb"],
+ ["VMPP","VMPP ", "Modal Perfect Participle"],
+ ["VVFIN","VVFIN ","Finite Verb"],
+ ["VVIMP","VVIMP ", "Finite Imperative Verb"],
+ ["VVINF","VVINF ", "Infinite Verb"],
+ ["VVIZU","VVIZU ", "Infinite Verb with 'zu'"],
+ ["VVPP","VVPP ", "Perfect Participle"],
+ ["XY", "XY ", "Non-Word"]
+ ], { 'itemClass' : hintItemClass, 'lengthField' : hintLengthField , 'alwaysEntryClass' : OwnEntryClass});
+ */
+
+ /*var multiMenu = multiMenuClass.create([
+ ["textSigle", "textSigle"],
+ ["author", "author"]
+ ]);
+ */
+
+ document.getElementById('menu').appendChild(menu.element());
+ //document.getElementById('largemenu').appendChild(largeMenu.element());
+ // document.getElementById('multimenu').appendChild(multiMenu.element());
+
+ menu.limit(3).show(3);
+ menu.focus();
+
+ selectMenuClass.create(document.getElementById('choose-ql')).limit(5); // .show();
+ //largeMenu.limit(8).show(3);
+ });
+
\ No newline at end of file