Esanders has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/204267

Change subject: Rename Context to LinearContext
......................................................................

Rename Context to LinearContext

Makes way for a base Context class from which LinearContext
and TableContext can inherit.

Change-Id: I55718d61c1e19243f05e37894451c693647a6119
---
M build/modules.json
M demos/ve/desktop.html
M demos/ve/mobile.html
M src/ui/ve.ui.DesktopContext.js
R src/ui/ve.ui.LinearContext.js
M src/ui/ve.ui.MobileContext.js
M tests/index.html
7 files changed, 40 insertions(+), 40 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/67/204267/1

diff --git a/build/modules.json b/build/modules.json
index 6e225b8..4ad6d68 100644
--- a/build/modules.json
+++ b/build/modules.json
@@ -358,7 +358,7 @@
                        "src/ui/ve.ui.js",
                        "src/ui/ve.ui.Overlay.js",
                        "src/ui/ve.ui.Surface.js",
-                       "src/ui/ve.ui.Context.js",
+                       "src/ui/ve.ui.LinearContext.js",
                        "src/ui/ve.ui.ModeledFactory.js",
                        "src/ui/ve.ui.ContextItem.js",
                        "src/ui/ve.ui.ContextItemFactory.js",
diff --git a/demos/ve/desktop.html b/demos/ve/desktop.html
index 3426bb1..fc11153 100644
--- a/demos/ve/desktop.html
+++ b/demos/ve/desktop.html
@@ -319,7 +319,7 @@
                <script src="../../src/ui/ve.ui.js"></script>
                <script src="../../src/ui/ve.ui.Overlay.js"></script>
                <script src="../../src/ui/ve.ui.Surface.js"></script>
-               <script src="../../src/ui/ve.ui.Context.js"></script>
+               <script src="../../src/ui/ve.ui.LinearContext.js"></script>
                <script src="../../src/ui/ve.ui.ModeledFactory.js"></script>
                <script src="../../src/ui/ve.ui.ContextItem.js"></script>
                <script src="../../src/ui/ve.ui.ContextItemFactory.js"></script>
diff --git a/demos/ve/mobile.html b/demos/ve/mobile.html
index 135304e..5116589 100644
--- a/demos/ve/mobile.html
+++ b/demos/ve/mobile.html
@@ -320,7 +320,7 @@
                <script src="../../src/ui/ve.ui.js"></script>
                <script src="../../src/ui/ve.ui.Overlay.js"></script>
                <script src="../../src/ui/ve.ui.Surface.js"></script>
-               <script src="../../src/ui/ve.ui.Context.js"></script>
+               <script src="../../src/ui/ve.ui.LinearContext.js"></script>
                <script src="../../src/ui/ve.ui.ModeledFactory.js"></script>
                <script src="../../src/ui/ve.ui.ContextItem.js"></script>
                <script src="../../src/ui/ve.ui.ContextItemFactory.js"></script>
diff --git a/src/ui/ve.ui.DesktopContext.js b/src/ui/ve.ui.DesktopContext.js
index 10b67de..cc5caee 100644
--- a/src/ui/ve.ui.DesktopContext.js
+++ b/src/ui/ve.ui.DesktopContext.js
@@ -8,15 +8,15 @@
  * Context menu and inspectors.
  *
  * @class
- * @extends ve.ui.Context
+ * @extends ve.ui.LinearContext
  *
  * @constructor
  * @param {ve.ui.Surface} surface
  * @param {Object} [config] Configuration options
  */
-ve.ui.DesktopContext = function VeUiDesktopContext( surface, config ) {
+ve.ui.DesktopContext = function VeUiDesktopContext() {
        // Parent constructor
-       ve.ui.DesktopContext.super.call( this, surface, config );
+       ve.ui.DesktopContext.super.apply( this, arguments );
 
        // Properties
        this.popup = new OO.ui.PopupWidget( { $container: this.surface.$element 
} );
@@ -52,7 +52,7 @@
 
 /* Inheritance */
 
-OO.inheritClass( ve.ui.DesktopContext, ve.ui.Context );
+OO.inheritClass( ve.ui.DesktopContext, ve.ui.LinearContext );
 
 /* Methods */
 
diff --git a/src/ui/ve.ui.Context.js b/src/ui/ve.ui.LinearContext.js
similarity index 85%
rename from src/ui/ve.ui.Context.js
rename to src/ui/ve.ui.LinearContext.js
index dab3a85..fab599e 100644
--- a/src/ui/ve.ui.Context.js
+++ b/src/ui/ve.ui.LinearContext.js
@@ -1,5 +1,5 @@
 /*!
- * VisualEditor UserInterface Context class.
+ * VisualEditor UserInterface Linear Context class.
  *
  * @copyright 2011-2015 VisualEditor Team and others; see 
http://ve.mit-license.org
  */
@@ -16,9 +16,9 @@
  * @param {ve.ui.Surface} surface
  * @param {Object} [config] Configuration options
  */
-ve.ui.Context = function VeUiContext( surface, config ) {
+ve.ui.LinearContext = function VeUiLinearContext( surface, config ) {
        // Parent constructor
-       ve.ui.Context.super.call( this, config );
+       ve.ui.LinearContext.super.call( this, config );
 
        // Mixin constructors
        OO.ui.GroupElement.call( this, config );
@@ -44,17 +44,17 @@
        // Initialization
        // Hide element using a class, not this.toggle, as child implementations
        // of toggle may require the instance to be fully constructed before 
running.
-       this.$group.addClass( 've-ui-context-menu' );
+       this.$group.addClass( 've-ui-linearContext-menu' );
        this.$element
-               .addClass( 've-ui-context oo-ui-element-hidden' )
+               .addClass( 've-ui-linearContext oo-ui-element-hidden' )
                .append( this.$group );
-       this.inspectors.$element.addClass( 've-ui-context-inspectors' );
+       this.inspectors.$element.addClass( 've-ui-linearContext-inspectors' );
 };
 
 /* Inheritance */
 
-OO.inheritClass( ve.ui.Context, OO.ui.Element );
-OO.mixinClass( ve.ui.Context, OO.ui.GroupElement );
+OO.inheritClass( ve.ui.LinearContext, OO.ui.Element );
+OO.mixinClass( ve.ui.LinearContext, OO.ui.GroupElement );
 
 /* Static Property */
 
@@ -65,11 +65,11 @@
  * @inheritable
  * @property {boolean}
  */
-ve.ui.Context.static.basicRendering = false;
+ve.ui.LinearContext.static.basicRendering = false;
 
 /* Methods */
 
-ve.ui.Context.prototype.shouldUseBasicRendering = function () {
+ve.ui.LinearContext.prototype.shouldUseBasicRendering = function () {
        return this.constructor.static.basicRendering;
 };
 
@@ -86,7 +86,7 @@
  *
  * @see #afterContextChange
  */
-ve.ui.Context.prototype.onContextChange = function () {
+ve.ui.LinearContext.prototype.onContextChange = function () {
        if ( this.inspector && ( this.inspector.isOpening() || 
this.inspector.isClosing() ) ) {
                // Cancel debounced change handler
                clearTimeout( this.afterContextChangeTimeout );
@@ -105,7 +105,7 @@
 /**
  * Handle document update event.
  */
-ve.ui.Context.prototype.onDocumentUpdate = function () {
+ve.ui.LinearContext.prototype.onDocumentUpdate = function () {
        // Only mind this event if the menu is visible
        if ( this.isVisible() && !this.isEmpty() ) {
                // Reuse the debounced context change hanlder
@@ -116,7 +116,7 @@
 /**
  * Handle debounced context change events.
  */
-ve.ui.Context.prototype.afterContextChange = function () {
+ve.ui.LinearContext.prototype.afterContextChange = function () {
        var selectedNode = this.surface.getModel().getSelectedNode();
 
        // Reset debouncing state
@@ -162,7 +162,7 @@
  *   closing, the second argument will be the opening data
  * @param {Object} data Window opening data
  */
-ve.ui.Context.prototype.onInspectorOpening = function ( win, opening ) {
+ve.ui.LinearContext.prototype.onInspectorOpening = function ( win, opening ) {
        var context = this,
                observer = this.surface.getView().surfaceObserver;
        this.inspector = win;
@@ -219,7 +219,7 @@
  *
  * @return {boolean} Context is visible
  */
-ve.ui.Context.prototype.isVisible = function () {
+ve.ui.LinearContext.prototype.isVisible = function () {
        return this.visible;
 };
 
@@ -228,7 +228,7 @@
  *
  * @return {boolean} Content is inspectable
  */
-ve.ui.Context.prototype.isInspectable = function () {
+ve.ui.LinearContext.prototype.isInspectable = function () {
        return !!this.getRelatedSources().length;
 };
 
@@ -237,7 +237,7 @@
  *
  * @return {boolean} Context menu is embeddable
  */
-ve.ui.Context.prototype.isEmbeddable = function () {
+ve.ui.LinearContext.prototype.isEmbeddable = function () {
        var i, len,
                sources = this.getRelatedSources();
 
@@ -259,7 +259,7 @@
  *   representing each compatible type (either `item` or `tool`), symbolic 
name of the item or tool
  *   and the model the item or tool is compatible with
  */
-ve.ui.Context.prototype.getRelatedSources = function () {
+ve.ui.LinearContext.prototype.getRelatedSources = function () {
        var i, len, toolClass, items, tools, models, selectedModels;
 
        if ( !this.relatedSources ) {
@@ -303,7 +303,7 @@
  *
  * @return {ve.ui.Surface}
  */
-ve.ui.Context.prototype.getSurface = function () {
+ve.ui.LinearContext.prototype.getSurface = function () {
        return this.surface;
 };
 
@@ -312,7 +312,7 @@
  *
  * @return {ve.ui.WindowManager}
  */
-ve.ui.Context.prototype.getInspectors = function () {
+ve.ui.LinearContext.prototype.getInspectors = function () {
        return this.inspectors;
 };
 
@@ -323,7 +323,7 @@
  * @abstract
  * @return {ve.ui.WindowManager} Inspector window manager
  */
-ve.ui.Context.prototype.createInspectorWindowManager = null;
+ve.ui.LinearContext.prototype.createInspectorWindowManager = null;
 
 /**
  * Toggle the menu.
@@ -331,12 +331,12 @@
  * @param {boolean} [show] Show the menu, omit to toggle
  * @chainable
  */
-ve.ui.Context.prototype.toggleMenu = function ( show ) {
+ve.ui.LinearContext.prototype.toggleMenu = function ( show ) {
        show = show === undefined ? !this.choosing : !!show;
 
        if ( show !== this.choosing ) {
                this.choosing = show;
-               this.$element.toggleClass( 've-ui-context-choosing', show );
+               this.$element.toggleClass( 've-ui-linearContext-choosing', show 
);
                if ( show ) {
                        this.setupMenuItems();
                } else {
@@ -353,7 +353,7 @@
  * @protected
  * @chainable
  */
-ve.ui.Context.prototype.setupMenuItems = function () {
+ve.ui.LinearContext.prototype.setupMenuItems = function () {
        var i, len, source,
                sources = this.getRelatedSources(),
                items = [];
@@ -385,7 +385,7 @@
  * @protected
  * @chainable
  */
-ve.ui.Context.prototype.teardownMenuItems = function () {
+ve.ui.LinearContext.prototype.teardownMenuItems = function () {
        var i, len;
 
        for ( i = 0, len = this.items.length; i < len; i++ ) {
@@ -402,7 +402,7 @@
  * @param {boolean} [show] Show the context, omit to toggle
  * @return {jQuery.Promise} Promise resolved when context is finished 
showing/hiding
  */
-ve.ui.Context.prototype.toggle = function ( show ) {
+ve.ui.LinearContext.prototype.toggle = function ( show ) {
        show = show === undefined ? !this.visible : !!show;
        if ( show !== this.visible ) {
                this.visible = show;
@@ -416,7 +416,7 @@
  *
  * @chainable
  */
-ve.ui.Context.prototype.updateDimensions = function () {
+ve.ui.LinearContext.prototype.updateDimensions = function () {
        // Override in subclass if context is positioned relative to content
        return this;
 };
@@ -424,7 +424,7 @@
 /**
  * Destroy the context, removing all DOM elements.
  */
-ve.ui.Context.prototype.destroy = function () {
+ve.ui.LinearContext.prototype.destroy = function () {
        // Disconnect events
        this.surface.getModel().disconnect( this );
        this.inspectors.disconnect( this );
diff --git a/src/ui/ve.ui.MobileContext.js b/src/ui/ve.ui.MobileContext.js
index 43204dc..171f718 100644
--- a/src/ui/ve.ui.MobileContext.js
+++ b/src/ui/ve.ui.MobileContext.js
@@ -8,15 +8,15 @@
  * UserInterface context that displays inspector full screen.
  *
  * @class
- * @extends ve.ui.Context
+ * @extends ve.ui.LinearContext
  *
  * @constructor
  * @param {ve.ui.Surface} surface
  * @param {Object} [config] Configuration options
  */
-ve.ui.MobileContext = function VeUiMobileContext( surface, config ) {
+ve.ui.MobileContext = function VeUiMobileContext() {
        // Parent constructor
-       ve.ui.MobileContext.super.call( this, surface, config );
+       ve.ui.MobileContext.super.apply( this, arguments );
 
        // Properties
        this.transitioning = null;
@@ -36,7 +36,7 @@
 
 /* Inheritance */
 
-OO.inheritClass( ve.ui.MobileContext, ve.ui.Context );
+OO.inheritClass( ve.ui.MobileContext, ve.ui.LinearContext );
 
 /* Static Properties */
 
diff --git a/tests/index.html b/tests/index.html
index 20942dd..9a4acf1 100644
--- a/tests/index.html
+++ b/tests/index.html
@@ -255,7 +255,7 @@
                <script src="../src/ui/ve.ui.js"></script>
                <script src="../src/ui/ve.ui.Overlay.js"></script>
                <script src="../src/ui/ve.ui.Surface.js"></script>
-               <script src="../src/ui/ve.ui.Context.js"></script>
+               <script src="../src/ui/ve.ui.LinearContext.js"></script>
                <script src="../src/ui/ve.ui.ModeledFactory.js"></script>
                <script src="../src/ui/ve.ui.ContextItem.js"></script>
                <script src="../src/ui/ve.ui.ContextItemFactory.js"></script>

-- 
To view, visit https://gerrit.wikimedia.org/r/204267
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I55718d61c1e19243f05e37894451c693647a6119
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <esand...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to