Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ This will pull in the google closure library:
git submodule init

git submodule update


If you make an edit that changes a goog.provide or goog.require statement,
there are two ways to update deps.js: the first (recommended) is with the ant build script or you can use

If you make an edit that changes a goog.provide or goog.require statement,
there are two ways to update deps.js: the first (recommended) is with the ant build script or you can use
the command line to invoke calcdeps.py as described below. The ant script also provides for running the closure compiler
which, in addition to minimizing the code to a single file, also provides many useful checks.

With ant:

You need to have ant installed (http://ant.apache.org).
You need to have ant installed (http://ant.apache.org).

From the base jchemhub directory, to see the usage message, just execute

ant

Usage is the default target, so you should see output something like this:

Buildfile: build.xml

usage:
Expand All @@ -44,26 +44,26 @@ Usage is the default target, so you should see output something like this:
compile-whitespace-only compile with WHITESPACE_ONLY setting
usage Display main targets by running 'ant -projecthelp'
Default target: usage

To update deps.js, execute the build-deps target:

ant build-deps
The targets compile-whitespace-only, compile-simple, compile-advanced include only files to support jchemhub.controller.ReactionEditor.

The targets compile-whitespace-only, compile-simple, compile-advanced include only files to support jchemhub.controller.ReactionEditor.
The smallest download size will result from executing:

ant compile-advanced

The compile output will be created in a 'build' directory that will be created if necessary.

The target compile-check attempts to compile all jchemhub code. This purpose of this target is to take advantage of the closure compile-time checks that
include static type checking, access violations, etc. For more information on options (not all of which are currently enabled in the ant build script) see
include static type checking, access violations, etc. For more information on options (not all of which are currently enabled in the ant build script) see
http://code.google.com/p/closure-compiler/wiki/Warnings.


Alternatively, without ant, it is also possibly to execute the calcdeps python script as follows to re-generate deps.js:

cd third-party/closure/closure/goog/
python ../bin/calcdeps.py -o deps -p ../../../../jchemhub/ -p ../../closure/ > ../../../../jchemhub/deps.js

python ../bin/calcdeps.py -o deps -p ../../../../jchemhub/ -p ../../closure/ > ../../../../jchemhub/deps.js

8 changes: 4 additions & 4 deletions alltests.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
// limitations under the License.

var _allTests = [ "jchemhub/smiles/smiles_parser_test.html",
"jchemhub/math/line_test.html",
"jchemhub/math/line_test.html",
"/jchemhub/io/json_test.html",
"jchemhub/io/mdl_test.html",
"jchemhub/model/model_test.html",
"jchemhub/io/mdl_test.html",
"jchemhub/model/model_test.html",
"jchemhub/ring/ring_finder_test.html",
"jchemhub/view/plugin_test.html",
"jchemhub/view/plugin_test.html",
"jchemhub/view/reaction_editor_test.html"];
16 changes: 8 additions & 8 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Jchemhub Demo</title>
<!--
<!--
<script src="build/jchemhub-whitespace-only.js"></script>
<script src="build/jchemhub-simple.js"></script>
-->
Expand Down Expand Up @@ -38,25 +38,25 @@


<script>

function initPage(){

var buttons = [];
buttons.push(jchemhub.controller.ToolbarFactory.makeButton(
jchemhub.controller.plugins.ClearEditor.COMMAND, 'Clear Editor', 'Clear'));
var buttons = [];
buttons.push(jchemhub.controller.ToolbarFactory.makeButton(
jchemhub.controller.plugins.ClearEditor.COMMAND, 'Clear Editor', 'Clear'));
buttons.push(jchemhub.controller.ToolbarFactory.makeButton(jchemhub.controller.plugins.Zoom.COMMAND.ZOOM_IN, 'zoom in', '+'));
buttons.push(jchemhub.controller.ToolbarFactory.makeButton(jchemhub.controller.plugins.Zoom.COMMAND.ZOOM_OUT, 'zoom out', '-'));
buttons.push(jchemhub.controller.ToolbarFactory.makeButton(jchemhub.controller.plugins.UndoRedo.COMMAND.UNDO, 'undo', 'undo'));
buttons.push(jchemhub.controller.ToolbarFactory.makeButton(jchemhub.controller.plugins.UndoRedo.COMMAND.REDO, 'redo', 'redo'));

var toolbar = jchemhub.controller.DefaultToolbar.makeToolbar(buttons, goog.dom.getElement('reactionEditorToolbar'));
var model = jchemhub.io.json.readReaction(reactionDrawing);
var toolbar = jchemhub.controller.DefaultToolbar.makeToolbar(buttons, goog.dom.getElement('reactionEditorToolbar'));
var model = jchemhub.io.json.readReaction(reactionDrawing);
var editor = new jchemhub.controller.ReactionEditor(goog.dom.getElement('reactionEditorContainer'));
editor.registerPlugin(new jchemhub.controller.plugins.ClearEditor());
editor.registerPlugin(new jchemhub.controller.plugins.Zoom());
editor.registerPlugin(new jchemhub.controller.plugins.UndoRedo());
editor.registerPlugin(new jchemhub.controller.plugins.Highlight());

var toolbarController = new jchemhub.controller.ToolbarController(editor, toolbar);
editor.setModel(model);
};
Expand Down
20 changes: 10 additions & 10 deletions jchemhub/controller/atom_controller.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
goog.provide('jchemhub.controller.AtomController');
goog.require('goog.events.EventTarget');

/**
* @constructor
* @extends {goog.events.EventTarget}
*/
jchemhub.controller.AtomController = function(parentController) {
/**
* @constructor
* @extends {goog.events.EventTarget}
*/
jchemhub.controller.AtomController = function(parentController) {
goog.events.EventTarget.call(this);
this.setParentEventTarget(parentController);
};
goog.inherits(jchemhub.controller.AtomController, goog.events.EventTarget);
};
goog.inherits(jchemhub.controller.AtomController, goog.events.EventTarget);

jchemhub.controller.AtomController.prototype.handleMouseOver = function(atom, e){
this.dispatchEvent(jchemhub.controller.AtomController.EventType.MOUSEOVER);
Expand All @@ -18,8 +18,8 @@ jchemhub.controller.AtomController.prototype.handleMouseOver = function(atom, e)
jchemhub.controller.AtomController.prototype.handleMouseOut = function(atom, e){
this.dispatchEvent(jchemhub.controller.AtomController.EventType.MOUSEOUT);
};
/** @enum {string} */
jchemhub.controller.AtomController.EventType = {
/** @enum {string} */
jchemhub.controller.AtomController.EventType = {
MOUSEOVER: 'atom_mouseover',
MOUSEOUT: 'atom_mouseout'
};
};
2 changes: 1 addition & 1 deletion jchemhub/controller/bond_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jchemhub.controller.BondController.EventType = {
};

/**
*
*
* @param {jchemhub.controller.BondController} controller
* @param {jchemhub.model.Bond} bond
* @param {jchemhub.controller.BondController.EventType} type
Expand Down
48 changes: 24 additions & 24 deletions jchemhub/controller/defaulttoolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jchemhub.controller.DefaultToolbar.MSG_FONT_NORMAL_SERIF = goog
* <li>{@code value} - Value for the corresponding 'font-family' CSS style
* (e.g. 'Tahoma, Arial, sans-serif')
* </ul>
*
*
* @type {!Array.<{caption:string, value:string}>}
* @private
*/
Expand All @@ -54,7 +54,7 @@ jchemhub.controller.DefaultToolbar.FONTS_ = [ {
/**
* Locale-specific font descriptors. The object is a map of locale strings to
* arrays of font descriptors.
*
*
* @type {!Object.<!Array.<{caption:string, value:string}>>}
* @private
*/
Expand Down Expand Up @@ -100,7 +100,7 @@ jchemhub.controller.DefaultToolbar.I18N_FONTS_ = {

/**
* Default locale for font names.
*
*
* @type {string}
* @private
*/
Expand All @@ -110,7 +110,7 @@ jchemhub.controller.DefaultToolbar.locale_ = 'en-us';
* Sets the locale for the font names. If not set, defaults to 'en-us'. Used
* only for default creation of font names name. Must be set before font name
* menu is created.
*
*
* @param {string}
* locale Locale to use for the toolbar font names.
*/
Expand All @@ -123,7 +123,7 @@ jchemhub.controller.DefaultToolbar.setLocale = function(locale) {
* If jchemhub.controller.DefaultToolbar.setLocale was called to specify a locale for
* which locale-specific default fonts exist, those are added before common
* fonts.
*
*
* @param {!goog.ui.Select}
* button Font menu button.
*/
Expand Down Expand Up @@ -165,7 +165,7 @@ jchemhub.controller.DefaultToolbar.MSG_FONT_SIZE_HUGE = goog.getMsg('Huge');
* <li>{@code caption} - Caption to show in the font size menu (e.g. 'Huge')
* <li>{@code value} - Value for the corresponding HTML font size (e.g. 6)
* </ul>
*
*
* @type {!Array.<{caption:string, value:number}>}
* @private
*/
Expand All @@ -186,7 +186,7 @@ jchemhub.controller.DefaultToolbar.FONT_SIZES_ = [ {
/**
* Initializes the given font size menu button by adding default font sizes to
* it.
*
*
* @param {!goog.ui.Select}
* button Font size menu button.
*/
Expand Down Expand Up @@ -216,7 +216,7 @@ jchemhub.controller.DefaultToolbar.MSG_FORMAT_NORMAL = goog.getMsg('Normal');
* <li>{@code caption} - Caption to show in the menu (e.g. 'Minor heading')
* <li>{@code command} - Corresponding {@link goog.dom.TagName} (e.g. 'H4')
* </ul>
*
*
* @type {!Array.<{caption:string, command:string}>}
* @private
*/
Expand All @@ -237,7 +237,7 @@ jchemhub.controller.DefaultToolbar.FORMAT_OPTIONS_ = [ {
/**
* Initializes the given "Format block" menu button by adding default format
* options to the menu.
*
*
* @param {!goog.ui.Select}
* button "Format block" menu button.
*/
Expand All @@ -249,7 +249,7 @@ jchemhub.controller.DefaultToolbar.addDefaultFormatOptions = function(button) {
/**
* Creates a {@link goog.ui.Toolbar} containing a default set of editor toolbar
* buttons, and renders it into the given parent element.
*
*
* @param {!Element}
* elem Toolbar parent element.
* @param {boolean=}
Expand All @@ -274,7 +274,7 @@ jchemhub.controller.DefaultToolbar.makeDefaultToolbar = function(elem,
* {@code items} array must either be a {@link goog.editor.Command} (to create a
* built-in button) or a subclass of {@link goog.ui.Control} (to create a custom
* control).
*
*
* @param {!Array.<string|goog.ui.Control>} items Toolbar items; each must be a
* {@link goog.editor.Command} or a {@link goog.ui.Control}.
* @param {!Element}
Expand Down Expand Up @@ -309,7 +309,7 @@ jchemhub.controller.DefaultToolbar.makeToolbar = function(items, elem,
* {@link goog.editor.Command}, or null if no built-in button exists for the
* command. Note that this function is only intended to create built-in buttons;
* please don't try to hack it!
*
*
* @param {string}
* command Editor command ID.
* @param {goog.dom.DomHelper=}
Expand Down Expand Up @@ -347,15 +347,15 @@ jchemhub.controller.DefaultToolbar.makeBuiltInToolbarButton = function(command,

/**
* A set of built-in buttons to display in the default editor toolbar.
*
*
* @type {!Array.<string>}
*/
jchemhub.controller.DefaultToolbar.DEFAULT_BUTTONS = [ ];

/**
* A set of built-in buttons to display in the default editor toolbar when the
* editor chrome is right-to-left (BiDi mode only).
*
*
* @type {!Array.<string>}
*/
jchemhub.controller.DefaultToolbar.DEFAULT_BUTTONS_RTL = [];
Expand All @@ -364,7 +364,7 @@ jchemhub.controller.DefaultToolbar.DEFAULT_BUTTONS_RTL = [];
* Creates a toolbar button with the given ID, tooltip, and caption. Applies any
* custom CSS class names to the button's caption element. This button is
* designed to be used as the RTL button.
*
*
* @param {string}
* id Button ID; must equal a {@link jchemhub.controller.Command} for
* built-in buttons, anything else for custom buttons.
Expand Down Expand Up @@ -405,7 +405,7 @@ jchemhub.controller.DefaultToolbar.rtlButtonFactory_ = function(id, tooltip, cap
* Creates a toolbar button with the given ID, tooltip, and caption. Applies any
* custom CSS class names to the button's caption element. Designed to be used
* to create undo and redo buttons.
*
*
* @param {string}
* id Button ID; must equal a {@link jchemhub.controller.Command} for
* built-in buttons, anything else for custom buttons.
Expand Down Expand Up @@ -438,7 +438,7 @@ jchemhub.controller.DefaultToolbar.undoRedoButtonFactory_ = function(id, tooltip
* Creates a toolbar button with the given ID, tooltip, and caption. Applies any
* custom CSS class names to the button's caption element. Used to create a font
* face button, filled with default fonts.
*
*
* @param {string}
* id Button ID; must equal a {@link jchemhub.controller.Command} for
* built-in buttons, anything else for custom buttons.
Expand Down Expand Up @@ -493,7 +493,7 @@ jchemhub.controller.DefaultToolbar.fontFaceFactory_ = function(id, tooltip, capt
* Creates a toolbar button with the given ID, tooltip, and caption. Applies any
* custom CSS class names to the button's caption element. Use to create a font
* size button, filled with default font sizes.
*
*
* @param {string}
* id Button ID; must equal a {@link jchemhub.controller.Command} for
* built-in buttons, anything else for custom buttons.
Expand Down Expand Up @@ -544,7 +544,7 @@ jchemhub.controller.DefaultToolbar.fontSizeFactory_ = function(id, tooltip, capt

/**
* Function to update the state of a color menu button.
*
*
* @param {goog.ui.ToolbarColorMenuButton}
* button The button to which the color menu is attached.
* @param {number}
Expand Down Expand Up @@ -575,7 +575,7 @@ jchemhub.controller.DefaultToolbar.colorUpdateFromValue_ = function(button, valu
* Creates a toolbar button with the given ID, tooltip, and caption. Applies any
* custom CSS class names to the button's caption element. Use to create a font
* color button.
*
*
* @param {string}
* id Button ID; must equal a {@link jchemhub.controller.Command} for
* built-in buttons, anything else for custom buttons.
Expand Down Expand Up @@ -609,7 +609,7 @@ jchemhub.controller.DefaultToolbar.fontColorFactory_ = function(id, tooltip, cap
* Creates a toolbar button with the given ID, tooltip, and caption. Applies any
* custom CSS class names to the button's caption element. Use to create a font
* background color button.
*
*
* @param {string}
* id Button ID; must equal a {@link jchemhub.controller.Command} for
* built-in buttons, anything else for custom buttons.
Expand Down Expand Up @@ -643,7 +643,7 @@ jchemhub.controller.DefaultToolbar.backgroundColorFactory_ = function(id, toolti
* Creates a toolbar button with the given ID, tooltip, and caption. Applies any
* custom CSS class names to the button's caption element. Use to create the
* format menu, prefilled with default formats.
*
*
* @param {string}
* id Button ID; must equal a {@link jchemhub.controller.Command} for
* built-in buttons, anything else for custom buttons.
Expand Down Expand Up @@ -811,7 +811,7 @@ jchemhub.controller.DefaultToolbar.MSG_EDIT_HTML_CAPTION = goog.getMsg('Edit HTM
* Note that this object is only used for creating toolbar buttons for built-in
* editor commands; custom buttons aren't listed here. Please don't try to hack
* this!
*
*
* @type {Object.<!jchemhub.controller.ReactionEditor.ButtonDescriptor>}.
* @private
*/
Expand All @@ -831,7 +831,7 @@ jchemhub.controller.DefaultToolbar.ButtonDescriptor = goog.typedef;
* descriptor objects. This array is processed at JS parse time; each item is
* inserted into {@link jchemhub.controller.DefaultToolbar.buttons_}, and the array
* itself is deleted and (hopefully) garbage-collected.
*
*
* @type {Array.<!jchemhub.controller.ReactionEditor.ButtonDescriptor>}.
* @private
*/
Expand Down
Loading