Update wmts-hidpi, add nicer-api-docs
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
// Copyright 2009 The Closure Library Authors.
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// This file has been auto-generated by GenJsDeps, please do not edit.
|
||||
|
||||
goog.addDependency('demos/editor/equationeditor.js', ['goog.demos.editor.EquationEditor'], ['goog.ui.equation.EquationEditorDialog']);
|
||||
goog.addDependency('demos/editor/helloworld.js', ['goog.demos.editor.HelloWorld'], ['goog.dom', 'goog.dom.TagName', 'goog.editor.Plugin']);
|
||||
goog.addDependency('demos/editor/helloworlddialog.js', ['goog.demos.editor.HelloWorldDialog', 'goog.demos.editor.HelloWorldDialog.OkEvent'], ['goog.dom.TagName', 'goog.events.Event', 'goog.string', 'goog.ui.editor.AbstractDialog', 'goog.ui.editor.AbstractDialog.Builder', 'goog.ui.editor.AbstractDialog.EventType']);
|
||||
goog.addDependency('demos/editor/helloworlddialogplugin.js', ['goog.demos.editor.HelloWorldDialogPlugin', 'goog.demos.editor.HelloWorldDialogPlugin.Command'], ['goog.demos.editor.HelloWorldDialog', 'goog.dom.TagName', 'goog.editor.plugins.AbstractDialogPlugin', 'goog.editor.range', 'goog.functions', 'goog.ui.editor.AbstractDialog.EventType']);
|
||||
@@ -0,0 +1,40 @@
|
||||
// Copyright 2008 The Closure Library Authors. All Rights Reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
/**
|
||||
* @see equationeditor.html
|
||||
*/
|
||||
|
||||
goog.provide('goog.demos.editor.EquationEditor');
|
||||
|
||||
goog.require('goog.ui.equation.EquationEditorDialog');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
goog.demos.editor.EquationEditor = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new editor and opens the dialog.
|
||||
* @param {string} initialEquation The initial equation value to use.
|
||||
*/
|
||||
goog.demos.editor.EquationEditor.prototype.openEditor = function(
|
||||
initialEquation) {
|
||||
var editorDialog = new goog.ui.equation.EquationEditorDialog(initialEquation);
|
||||
editorDialog.setVisible(true);
|
||||
};
|
||||
@@ -0,0 +1,81 @@
|
||||
// Copyright 2008 The Closure Library Authors. All Rights Reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
/**
|
||||
* @fileoverview A simple plugin that inserts 'Hello World!' on command. This
|
||||
* plugin is intended to be an example of a very simple plugin for plugin
|
||||
* developers.
|
||||
*
|
||||
* @author gak@google.com (Gregory Kick)
|
||||
* @see helloworld.html
|
||||
*/
|
||||
|
||||
goog.provide('goog.demos.editor.HelloWorld');
|
||||
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.dom.TagName');
|
||||
goog.require('goog.editor.Plugin');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Plugin to insert 'Hello World!' into an editable field.
|
||||
* @constructor
|
||||
* @extends {goog.editor.Plugin}
|
||||
*/
|
||||
goog.demos.editor.HelloWorld = function() {
|
||||
goog.editor.Plugin.call(this);
|
||||
};
|
||||
goog.inherits(goog.demos.editor.HelloWorld, goog.editor.Plugin);
|
||||
|
||||
|
||||
/** @override */
|
||||
goog.demos.editor.HelloWorld.prototype.getTrogClassId = function() {
|
||||
return 'HelloWorld';
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Commands implemented by this plugin.
|
||||
* @enum {string}
|
||||
*/
|
||||
goog.demos.editor.HelloWorld.COMMAND = {
|
||||
HELLO_WORLD: '+helloWorld'
|
||||
};
|
||||
|
||||
|
||||
/** @override */
|
||||
goog.demos.editor.HelloWorld.prototype.isSupportedCommand = function(
|
||||
command) {
|
||||
return command == goog.demos.editor.HelloWorld.COMMAND.HELLO_WORLD;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Executes a command. Does not fire any BEFORECHANGE, CHANGE, or
|
||||
* SELECTIONCHANGE events (these are handled by the super class implementation
|
||||
* of {@code execCommand}.
|
||||
* @param {string} command Command to execute.
|
||||
* @override
|
||||
* @protected
|
||||
*/
|
||||
goog.demos.editor.HelloWorld.prototype.execCommandInternal = function(
|
||||
command) {
|
||||
var domHelper = this.getFieldObject().getEditableDomHelper();
|
||||
var range = this.getFieldObject().getRange();
|
||||
range.removeContents();
|
||||
var newNode =
|
||||
domHelper.createDom(goog.dom.TagName.SPAN, null, 'Hello World!');
|
||||
range.insertNode(newNode, false);
|
||||
};
|
||||
@@ -0,0 +1,171 @@
|
||||
// Copyright 2008 The Closure Library Authors. All Rights Reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
/**
|
||||
* @fileoverview An example of how to write a dialog to be opened by a plugin.
|
||||
*
|
||||
*/
|
||||
|
||||
goog.provide('goog.demos.editor.HelloWorldDialog');
|
||||
goog.provide('goog.demos.editor.HelloWorldDialog.OkEvent');
|
||||
|
||||
goog.require('goog.dom.TagName');
|
||||
goog.require('goog.events.Event');
|
||||
goog.require('goog.string');
|
||||
goog.require('goog.ui.editor.AbstractDialog');
|
||||
|
||||
|
||||
// *** Public interface ***************************************************** //
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates a dialog to let the user enter a customized hello world message.
|
||||
* @param {goog.dom.DomHelper} domHelper DomHelper to be used to create the
|
||||
* dialog's dom structure.
|
||||
* @constructor
|
||||
* @extends {goog.ui.editor.AbstractDialog}
|
||||
*/
|
||||
goog.demos.editor.HelloWorldDialog = function(domHelper) {
|
||||
goog.ui.editor.AbstractDialog.call(this, domHelper);
|
||||
};
|
||||
goog.inherits(goog.demos.editor.HelloWorldDialog,
|
||||
goog.ui.editor.AbstractDialog);
|
||||
|
||||
|
||||
// *** Event **************************************************************** //
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* OK event object for the hello world dialog.
|
||||
* @param {string} message Customized hello world message chosen by the user.
|
||||
* @constructor
|
||||
* @extends {goog.events.Event}
|
||||
*/
|
||||
goog.demos.editor.HelloWorldDialog.OkEvent = function(message) {
|
||||
this.message = message;
|
||||
};
|
||||
goog.inherits(goog.demos.editor.HelloWorldDialog.OkEvent, goog.events.Event);
|
||||
|
||||
|
||||
/**
|
||||
* Event type.
|
||||
* @type {goog.ui.editor.AbstractDialog.EventType}
|
||||
* @override
|
||||
*/
|
||||
goog.demos.editor.HelloWorldDialog.OkEvent.prototype.type =
|
||||
goog.ui.editor.AbstractDialog.EventType.OK;
|
||||
|
||||
|
||||
/**
|
||||
* Customized hello world message chosen by the user.
|
||||
* @type {string}
|
||||
*/
|
||||
goog.demos.editor.HelloWorldDialog.OkEvent.prototype.message;
|
||||
|
||||
|
||||
// *** Protected interface ************************************************** //
|
||||
|
||||
|
||||
/** @override */
|
||||
goog.demos.editor.HelloWorldDialog.prototype.createDialogControl = function() {
|
||||
var builder = new goog.ui.editor.AbstractDialog.Builder(this);
|
||||
/** @desc Title of the hello world dialog. */
|
||||
var MSG_HELLO_WORLD_DIALOG_TITLE = goog.getMsg('Add a Hello World message');
|
||||
builder.setTitle(MSG_HELLO_WORLD_DIALOG_TITLE).
|
||||
setContent(this.createContent_());
|
||||
return builder.build();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates and returns the event object to be used when dispatching the OK
|
||||
* event to listeners, or returns null to prevent the dialog from closing.
|
||||
* @param {goog.events.Event} e The event object dispatched by the wrapped
|
||||
* dialog.
|
||||
* @return {goog.demos.editor.HelloWorldDialog.OkEvent} The event object to be
|
||||
* used when dispatching the OK event to listeners.
|
||||
* @protected
|
||||
* @override
|
||||
*/
|
||||
goog.demos.editor.HelloWorldDialog.prototype.createOkEvent = function(e) {
|
||||
var message = this.getMessage_();
|
||||
if (message &&
|
||||
goog.demos.editor.HelloWorldDialog.isValidHelloWorld_(message)) {
|
||||
return new goog.demos.editor.HelloWorldDialog.OkEvent(message);
|
||||
} else {
|
||||
/** @desc Error message telling the user why their message was rejected. */
|
||||
var MSG_HELLO_WORLD_DIALOG_ERROR =
|
||||
goog.getMsg('Your message must contain the words "hello" and "world".');
|
||||
this.dom.getWindow().alert(MSG_HELLO_WORLD_DIALOG_ERROR);
|
||||
return null; // Prevents the dialog from closing.
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// *** Private implementation *********************************************** //
|
||||
|
||||
|
||||
/**
|
||||
* Input element where the user will type their hello world message.
|
||||
* @type {Element}
|
||||
* @private
|
||||
*/
|
||||
goog.demos.editor.HelloWorldDialog.prototype.input_;
|
||||
|
||||
|
||||
/**
|
||||
* Creates the DOM structure that makes up the dialog's content area.
|
||||
* @return {Element} The DOM structure that makes up the dialog's content area.
|
||||
* @private
|
||||
*/
|
||||
goog.demos.editor.HelloWorldDialog.prototype.createContent_ = function() {
|
||||
/** @desc Sample hello world message to prepopulate the dialog with. */
|
||||
var MSG_HELLO_WORLD_DIALOG_SAMPLE = goog.getMsg('Hello, world!');
|
||||
this.input_ = this.dom.createDom(goog.dom.TagName.INPUT,
|
||||
{size: 25, value: MSG_HELLO_WORLD_DIALOG_SAMPLE});
|
||||
/** @desc Prompt telling the user to enter a hello world message. */
|
||||
var MSG_HELLO_WORLD_DIALOG_PROMPT =
|
||||
goog.getMsg('Enter your Hello World message');
|
||||
return this.dom.createDom(goog.dom.TagName.DIV,
|
||||
null,
|
||||
[MSG_HELLO_WORLD_DIALOG_PROMPT, this.input_]);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the hello world message currently typed into the dialog's input.
|
||||
* @return {?string} The hello world message currently typed into the dialog's
|
||||
* input, or null if called before the input is created.
|
||||
* @private
|
||||
*/
|
||||
goog.demos.editor.HelloWorldDialog.prototype.getMessage_ = function() {
|
||||
return this.input_ && this.input_.value;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether or not the given message contains the strings "hello" and
|
||||
* "world". Case-insensitive and order doesn't matter.
|
||||
* @param {string} message The message to be checked.
|
||||
* @return {boolean} Whether or not the given message contains the strings
|
||||
* "hello" and "world".
|
||||
* @private
|
||||
*/
|
||||
goog.demos.editor.HelloWorldDialog.isValidHelloWorld_ = function(message) {
|
||||
message = message.toLowerCase();
|
||||
return goog.string.contains(message, 'hello') &&
|
||||
goog.string.contains(message, 'world');
|
||||
};
|
||||
@@ -0,0 +1,116 @@
|
||||
// Copyright 2008 The Closure Library Authors. All Rights Reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
/**
|
||||
* @fileoverview An example of how to write a dialog plugin.
|
||||
*
|
||||
*/
|
||||
|
||||
goog.provide('goog.demos.editor.HelloWorldDialogPlugin');
|
||||
goog.provide('goog.demos.editor.HelloWorldDialogPlugin.Command');
|
||||
|
||||
goog.require('goog.demos.editor.HelloWorldDialog');
|
||||
goog.require('goog.dom.TagName');
|
||||
goog.require('goog.editor.plugins.AbstractDialogPlugin');
|
||||
goog.require('goog.editor.range');
|
||||
goog.require('goog.functions');
|
||||
goog.require('goog.ui.editor.AbstractDialog');
|
||||
|
||||
|
||||
// *** Public interface ***************************************************** //
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A plugin that opens the hello world dialog.
|
||||
* @constructor
|
||||
* @extends {goog.editor.plugins.AbstractDialogPlugin}
|
||||
*/
|
||||
goog.demos.editor.HelloWorldDialogPlugin = function() {
|
||||
goog.editor.plugins.AbstractDialogPlugin.call(this,
|
||||
goog.demos.editor.HelloWorldDialogPlugin.Command.HELLO_WORLD_DIALOG);
|
||||
};
|
||||
goog.inherits(goog.demos.editor.HelloWorldDialogPlugin,
|
||||
goog.editor.plugins.AbstractDialogPlugin);
|
||||
|
||||
|
||||
/**
|
||||
* Commands implemented by this plugin.
|
||||
* @enum {string}
|
||||
*/
|
||||
goog.demos.editor.HelloWorldDialogPlugin.Command = {
|
||||
HELLO_WORLD_DIALOG: 'helloWorldDialog'
|
||||
};
|
||||
|
||||
|
||||
/** @override */
|
||||
goog.demos.editor.HelloWorldDialogPlugin.prototype.getTrogClassId =
|
||||
goog.functions.constant('HelloWorldDialog');
|
||||
|
||||
|
||||
// *** Protected interface ************************************************** //
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new instance of the dialog and registers for the relevant events.
|
||||
* @param {goog.dom.DomHelper} dialogDomHelper The dom helper to be used to
|
||||
* create the dialog.
|
||||
* @return {goog.demos.editor.HelloWorldDialog} The dialog.
|
||||
* @override
|
||||
* @protected
|
||||
*/
|
||||
goog.demos.editor.HelloWorldDialogPlugin.prototype.createDialog = function(
|
||||
dialogDomHelper) {
|
||||
var dialog = new goog.demos.editor.HelloWorldDialog(dialogDomHelper);
|
||||
dialog.addEventListener(goog.ui.editor.AbstractDialog.EventType.OK,
|
||||
this.handleOk_,
|
||||
false,
|
||||
this);
|
||||
return dialog;
|
||||
};
|
||||
|
||||
|
||||
// *** Private implementation *********************************************** //
|
||||
|
||||
|
||||
/**
|
||||
* Handles the OK event from the dialog by inserting the hello world message
|
||||
* into the field.
|
||||
* @param {goog.demos.editor.HelloWorldDialog.OkEvent} e OK event object.
|
||||
* @private
|
||||
*/
|
||||
goog.demos.editor.HelloWorldDialogPlugin.prototype.handleOk_ = function(e) {
|
||||
// First restore the selection so we can manipulate the field's content
|
||||
// according to what was selected.
|
||||
this.restoreOriginalSelection();
|
||||
|
||||
// Notify listeners that the field's contents are about to change.
|
||||
this.getFieldObject().dispatchBeforeChange();
|
||||
|
||||
// Now we can clear out what was previously selected (if anything).
|
||||
var range = this.getFieldObject().getRange();
|
||||
range.removeContents();
|
||||
// And replace it with a span containing our hello world message.
|
||||
var createdNode = this.getFieldDomHelper().createDom(goog.dom.TagName.SPAN,
|
||||
null,
|
||||
e.message);
|
||||
createdNode = range.insertNode(createdNode, false);
|
||||
// Place the cursor at the end of the new text node (false == to the right).
|
||||
goog.editor.range.placeCursorNextTo(createdNode, false);
|
||||
|
||||
// Notify listeners that the field's selection has changed.
|
||||
this.getFieldObject().dispatchSelectionChangeEvent();
|
||||
// Notify listeners that the field's contents have changed.
|
||||
this.getFieldObject().dispatchChange();
|
||||
};
|
||||
Reference in New Issue
Block a user