GUAC-932: Migrate ClientProperties to new "types/" convention. Explicitly note type elsewhere.

This commit is contained in:
Michael Jumper
2014-11-30 18:08:34 -08:00
parent aab0297d40
commit 437d389ffc
3 changed files with 39 additions and 14 deletions

View File

@@ -135,7 +135,7 @@ angular.module('home').controller('clientController', ['$scope', '$routeParams',
// Get DAO for reading connections and groups // Get DAO for reading connections and groups
var connectionGroupDAO = $injector.get('connectionGroupDAO'); var connectionGroupDAO = $injector.get('connectionGroupDAO');
var connectionDAO = $injector.get('connectionDAO'); var connectionDAO = $injector.get('connectionDAO');
var ClientProperties = $injector.get('clientProperties'); var ClientProperties = $injector.get('ClientProperties');
// Client settings and state // Client settings and state
$scope.clientProperties = new ClientProperties(); $scope.clientProperties = new ClientProperties();

View File

@@ -30,12 +30,29 @@ angular.module('client').directive('guacClient', [function guacClient() {
restrict: 'E', restrict: 'E',
replace: true, replace: true,
scope: { scope: {
// Parameters for controlling client state
clientProperties : '=',
// Parameters for initially connecting /**
id : '=', * Parameters for controlling client state.
connectionParameters : '=' *
* @type ClientProperties|Object
*/
clientProperties : '=',
/**
* The ID of the Guacamole connection to connect to.
*
* @type String
*/
id : '=',
/**
* Arbitrary URL-encoded parameters to append to the connection
* string when connecting.
*
* @type String
*/
connectionParameters : '='
}, },
templateUrl: 'app/client/templates/guacClient.html', templateUrl: 'app/client/templates/guacClient.html',
controller: ['$scope', '$injector', '$element', function guacClientController($scope, $injector, $element) { controller: ['$scope', '$injector', '$element', function guacClientController($scope, $injector, $element) {

View File

@@ -23,14 +23,20 @@
/** /**
* A service for generating new guacClient properties objects. * A service for generating new guacClient properties objects.
*/ */
angular.module('client').factory('clientProperties', [function clientProperties() { angular.module('client').factory('ClientProperties', [function defineClientProperties() {
/** /**
* Object used for interacting with a guacClient directive. * Object used for interacting with a guacClient directive.
* *
* @constructor * @constructor
* @param {ClientProperties|Object} [template={}]
* The object whose properties should be copied within the new
* ClientProperties.
*/ */
return function() { var ClientProperties = function ClientProperties(template) {
// Use empty object by default
template = template || {};
/** /**
* Whether the display should be scaled automatically to fit within the * Whether the display should be scaled automatically to fit within the
@@ -38,7 +44,7 @@ angular.module('client').factory('clientProperties', [function clientProperties(
* *
* @type Boolean * @type Boolean
*/ */
this.autoFit = true; this.autoFit = template.autoFit || true;
/** /**
* The current scale. If autoFit is true, the effect of setting this * The current scale. If autoFit is true, the effect of setting this
@@ -46,28 +52,28 @@ angular.module('client').factory('clientProperties', [function clientProperties(
* *
* @type Number * @type Number
*/ */
this.scale = 1; this.scale = template.scale || 1;
/** /**
* The minimum scale value. * The minimum scale value.
* *
* @type Number * @type Number
*/ */
this.minScale = 1; this.minScale = template.minScale || 1;
/** /**
* The maximum scale value. * The maximum scale value.
* *
* @type Number * @type Number
*/ */
this.maxScale = 3; this.maxScale = template.maxScale || 3;
/** /**
* Whether or not the client should listen to keyboard events. * Whether or not the client should listen to keyboard events.
* *
* @type Boolean * @type Boolean
*/ */
this.keyboardEnabled = true; this.keyboardEnabled = template.keyboardEnabled || true;
/** /**
* Whether translation of touch to mouse events should emulate an * Whether translation of touch to mouse events should emulate an
@@ -75,8 +81,10 @@ angular.module('client').factory('clientProperties', [function clientProperties(
* *
* @type Boolean * @type Boolean
*/ */
this.emulateAbsoluteMouse = true; this.emulateAbsoluteMouse = template.emulateAbsoluteMouse || true;
}; };
return ClientProperties;
}]); }]);