Block(ly) Factory prompts should have defaults. Drop unused copy of colourpicker code.

This commit is contained in:
Neil Fraser
2016-10-11 12:16:17 -07:00
parent c102734ccb
commit 5df55ddea0
19 changed files with 71 additions and 189 deletions

View File

@@ -75,8 +75,8 @@ goog.inherits(Blockly.WorkspaceSvg, Blockly.Workspace);
Blockly.WorkspaceSvg.prototype.resizeHandlerWrapper_ = null; Blockly.WorkspaceSvg.prototype.resizeHandlerWrapper_ = null;
/** /**
* The render status of an SVG workspace. * The render status of an SVG workspace.
* Returns `true` for visible workspaces and `false` for non-visible, or headless, workspaces. * Returns `true` for visible workspaces and `false` for non-visible, or headless, workspaces.
* @type {boolean} * @type {boolean}
*/ */
Blockly.WorkspaceSvg.prototype.rendered = true; Blockly.WorkspaceSvg.prototype.rendered = true;
@@ -316,7 +316,7 @@ Blockly.WorkspaceSvg.prototype.dispose = function() {
* @param {?string} prototypeName Name of the language object containing * @param {?string} prototypeName Name of the language object containing
* type-specific functions for this block. * type-specific functions for this block.
* @param {string=} opt_id Optional ID. Use this ID if provided, otherwise * @param {string=} opt_id Optional ID. Use this ID if provided, otherwise
* create a new id. * create a new ID.
* @return {!Blockly.BlockSvg} The created block. * @return {!Blockly.BlockSvg} The created block.
*/ */
Blockly.WorkspaceSvg.prototype.newBlock = function(prototypeName, opt_id) { Blockly.WorkspaceSvg.prototype.newBlock = function(prototypeName, opt_id) {

View File

@@ -1,12 +1,12 @@
/** /**
* @license * @license
* Visual Blocks Editor * Blockly Demos: Block Factory
* *
* Copyright 2016 Google Inc. * Copyright 2016 Google Inc.
* https://developers.google.com/blockly/ * https://developers.google.com/blockly/
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* You may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
@@ -134,7 +134,7 @@ AppController.prototype.exportBlockLibraryToFile = function() {
var blockLibText = this.formatBlockLibraryForExport_(blockLib); var blockLibText = this.formatBlockLibraryForExport_(blockLib);
// Get file name. // Get file name.
var filename = prompt('Enter the file name under which to save your block ' + var filename = prompt('Enter the file name under which to save your block ' +
'library.'); 'library.', 'library.xml');
// Download file if all necessary parameters are provided. // Download file if all necessary parameters are provided.
if (filename) { if (filename) {
FactoryUtils.createAndDownloadFile(blockLibText, filename, 'xml'); FactoryUtils.createAndDownloadFile(blockLibText, filename, 'xml');

View File

@@ -1,12 +1,12 @@
/** /**
* @license * @license
* Visual Blocks Editor * Blockly Demos: Block Factory
* *
* Copyright 2016 Google Inc. * Copyright 2016 Google Inc.
* https://developers.google.com/blockly/ * https://developers.google.com/blockly/
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* You may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0

View File

@@ -1,12 +1,12 @@
/** /**
* @license * @license
* Visual Blocks Editor * Blockly Demos: Block Factory
* *
* Copyright 2016 Google Inc. * Copyright 2016 Google Inc.
* https://developers.google.com/blockly/ * https://developers.google.com/blockly/
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* You may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0

View File

@@ -1,12 +1,12 @@
/** /**
* @license * @license
* Visual Blocks Editor * Blockly Demos: Block Factory
* *
* Copyright 2016 Google Inc. * Copyright 2016 Google Inc.
* https://developers.google.com/blockly/ * https://developers.google.com/blockly/
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* You may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0

View File

@@ -1,12 +1,12 @@
/** /**
* @license * @license
* Visual Blocks Editor * Blockly Demos: Block Factory
* *
* Copyright 2016 Google Inc. * Copyright 2016 Google Inc.
* https://developers.google.com/blockly/ * https://developers.google.com/blockly/
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* You may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0

View File

@@ -1,12 +1,12 @@
/** /**
* @license * @license
* Visual Blocks Editor * Blockly Demos: Block Factory
* *
* Copyright 2016 Google Inc. * Copyright 2016 Google Inc.
* https://developers.google.com/blockly/ * https://developers.google.com/blockly/
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* You may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
@@ -166,5 +166,5 @@ BlockLibraryStorage.prototype.getBlockXmlTextMap = function() {
* @return {boolean} Whether or not blockType is stored in block library. * @return {boolean} Whether or not blockType is stored in block library.
*/ */
BlockLibraryStorage.prototype.has = function(blockType) { BlockLibraryStorage.prototype.has = function(blockType) {
return this.blocks[blockType] ? true : false; return !!this.blocks[blockType];
}; };

View File

@@ -1,12 +1,12 @@
/** /**
* @license * @license
* Visual Blocks Editor * Blockly Demos: Block Factory
* *
* Copyright 2016 Google Inc. * Copyright 2016 Google Inc.
* https://developers.google.com/blockly/ * https://developers.google.com/blockly/
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* You may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0

View File

@@ -1,12 +1,12 @@
/** /**
* @license * @license
* Visual Blocks Editor * Blockly Demos: Block Factory
* *
* Copyright 2016 Google Inc. * Copyright 2016 Google Inc.
* https://developers.google.com/blockly/ * https://developers.google.com/blockly/
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* You may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0

View File

@@ -1,12 +1,12 @@
/** /**
* @license * @license
* Visual Blocks Editor * Blockly Demos: Block Factory
* *
* Copyright 2016 Google Inc. * Copyright 2016 Google Inc.
* https://developers.google.com/blockly/ * https://developers.google.com/blockly/
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* You may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0

View File

@@ -1,12 +1,12 @@
/** /**
* @license * @license
* Visual Blocks Editor * Blockly Demos: Block Factory
* *
* Copyright 2016 Google Inc. * Copyright 2016 Google Inc.
* https://developers.google.com/blockly/ * https://developers.google.com/blockly/
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* You may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0

View File

@@ -1,12 +1,12 @@
/** /**
* @license * @license
* Visual Blocks Editor * Blockly Demos: Block Factory
* *
* Copyright 2016 Google Inc. * Copyright 2016 Google Inc.
* https://developers.google.com/blockly/ * https://developers.google.com/blockly/
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* You may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0

View File

@@ -1,6 +1,6 @@
/** /**
* @license * @license
* Visual Blocks Editor * Blockly Demos: Block Factory
* *
* Copyright 2016 Google Inc. * Copyright 2016 Google Inc.
* https://developers.google.com/blockly/ * https://developers.google.com/blockly/

View File

@@ -454,70 +454,6 @@ goog.require('goog.ui.ColorPicker');
<category name="Functions" colour="290" custom="PROCEDURE"></category> <category name="Functions" colour="290" custom="PROCEDURE"></category>
</xml> </xml>
<script type="text/javascript"> <script type="text/javascript">
// Array of Blockly category colors, variety of hues with saturation 45%
// and value 65% as specified in Blockly Developer documentation:
// https://developers.google.com/blockly/guides/create-custom-blocks/define-blocks
var colors = ['#A65C5C',
'#A6635C',
'#A66A5C',
'#A6725C',
'#A6795C',
'#A6815C',
'#A6885C',
'#A6905C',
'#A6975C',
'#A69F5C',
'#A6A65C',
'#9FA65C',
'#97A65C',
'#90A65C',
'#88A65C',
'#81A65C',
'#79A65C',
'#6FA65C',
'#66A65C',
'#5EA65C',
'#5CA661',
'#5CA668',
'#5CA66F',
'#5CA677',
'#5CA67E',
'#5CA686',
'#5CA68D',
'#5CA695',
'#5CA69C',
'#5CA6A4',
'#5CA1A6',
'#5C9AA6',
'#5C92A6',
'#5C8BA6',
'#5C83A6',
'#5C7CA6',
'#5C74A6',
'#5C6AA6',
'#5C61A6',
'#5E5CA6',
'#665CA6',
'#6D5CA6',
'#745CA6',
'#7C5CA6',
'#835CA6',
'#8B5CA6',
'#925CA6',
'#9A5CA6',
'#A15CA6',
'#A65CA4',
'#A65C9C',
'#A65C95',
'#A65C8D',
'#A65C86',
'#A65C7E',
'#A65C77',
'#A65C6F',
'#A65C66',
'#A65C61',
'#A65C5E'];
// Create empty workspace for configuring workspace. // Create empty workspace for configuring workspace.
var toolboxWorkspace = Blockly.inject('toolbox_blocks', var toolboxWorkspace = Blockly.inject('toolbox_blocks',
{grid: {grid:
@@ -726,20 +662,6 @@ goog.require('goog.ui.ColorPicker');
} }
}); });
// Create color picker with specific set of Blockly colors.
var colorPicker = new goog.ui.ColorPicker();
colorPicker.setColors(colors);
// Create and render the popup color picker and attach to button.
var popupPicker = new goog.ui.PopupColorPicker(null, colorPicker);
popupPicker.render();
popupPicker.attach(document.getElementById('dropdown_color'));
popupPicker.setFocusable(true);
goog.events.listen(popupPicker, 'change', function(e) {
controller.changeSelectedCategoryColor(popupPicker.getSelectedColor());
document.getElementById('dropdownDiv_editCategory').classList.remove
("show");
});
// Disable category editing buttons until categories are created. // Disable category editing buttons until categories are created.
document.getElementById('button_remove').disabled = true; document.getElementById('button_remove').disabled = true;
document.getElementById('button_up').disabled = true; document.getElementById('button_up').disabled = true;

View File

@@ -1,6 +1,6 @@
/** /**
* @license * @license
* Visual Blocks Editor * Blockly Demos: Block Factory
* *
* Copyright 2016 Google Inc. * Copyright 2016 Google Inc.
* https://developers.google.com/blockly/ * https://developers.google.com/blockly/
@@ -108,8 +108,8 @@ WorkspaceFactoryController.prototype.addCategory = function() {
// After possibly creating a category, check again if it's the first category. // After possibly creating a category, check again if it's the first category.
var isFirstCategory = !this.model.hasElements(); var isFirstCategory = !this.model.hasElements();
// Get name from user. // Get name from user.
name = this.promptForNewCategoryName('Enter the name of your new category: '); name = this.promptForNewCategoryName('Enter the name of your new category:');
if (!name) { //Exit if cancelled. if (!name) { // Exit if cancelled.
return; return;
} }
// Create category. // Create category.
@@ -117,7 +117,7 @@ WorkspaceFactoryController.prototype.addCategory = function() {
// Switch to category. // Switch to category.
this.switchElement(this.model.getCategoryIdByName(name)); this.switchElement(this.model.getCategoryIdByName(name));
// Sets the default options for injecting the workspace // Sets the default options for injecting the workspace
// when there are categories if adding the first category. // when there are categories if adding the first category.
if (isFirstCategory) { if (isFirstCategory) {
this.view.setCategoryOptions(this.model.hasElements()); this.view.setCategoryOptions(this.model.hasElements());
@@ -152,7 +152,7 @@ WorkspaceFactoryController.prototype.createCategory = function(name) {
*/ */
WorkspaceFactoryController.prototype.addClickToSwitch = function(tab, id) { WorkspaceFactoryController.prototype.addClickToSwitch = function(tab, id) {
var self = this; var self = this;
var clickFunction = function(id) { // Keep this in scope for switchElement var clickFunction = function(id) { // Keep this in scope for switchElement.
return function() { return function() {
self.switchElement(id); self.switchElement(id);
}; };
@@ -237,15 +237,18 @@ WorkspaceFactoryController.prototype.removeElement = function() {
/** /**
* Gets a valid name for a new category from the user. * Gets a valid name for a new category from the user.
* @param {string} promptString Prompt for the user to enter a name. * @param {string} promptString Prompt for the user to enter a name.
* @param {string=} opt_oldName The current name.
* @return {string} Valid name for a new category, or null if cancelled. * @return {string} Valid name for a new category, or null if cancelled.
*/ */
WorkspaceFactoryController.prototype.promptForNewCategoryName = WorkspaceFactoryController.prototype.promptForNewCategoryName =
function(promptString) { function(promptString, opt_oldName) {
var defaultName = opt_oldName;
do { do {
var name = prompt(promptString); var name = prompt(promptString, defaultName);
if (!name) { // If cancelled. if (!name) { // If cancelled.
return null; return null;
} }
defaultName = name;
} while (this.model.hasCategoryByName(name)); } while (this.model.hasCategoryByName(name));
return name; return name;
}; };
@@ -316,9 +319,12 @@ WorkspaceFactoryController.prototype.clearAndLoadElement = function(id) {
*/ */
WorkspaceFactoryController.prototype.exportXmlFile = function(exportMode) { WorkspaceFactoryController.prototype.exportXmlFile = function(exportMode) {
// Get file name. // Get file name.
var fileName = prompt('File Name for ' + (exportMode == if (exportMode == WorkspaceFactoryController.MODE_TOOLBOX) {
WorkspaceFactoryController.MODE_TOOLBOX ? 'toolbox XML: ' : var fileName = prompt('File Name for toolbox XML:', 'toolbox.xml');
'pre-loaded workspace XML: ')); } else {
var fileName = prompt('File Name for pre-loaded workspace XML:',
'workspace.xml');
}
if (!fileName) { // If cancelled. if (!fileName) { // If cancelled.
return; return;
} }
@@ -349,7 +355,8 @@ WorkspaceFactoryController.prototype.exportXmlFile = function(exportMode) {
* file name from the user and downloads the options object to that file. * file name from the user and downloads the options object to that file.
*/ */
WorkspaceFactoryController.prototype.exportInjectFile = function() { WorkspaceFactoryController.prototype.exportInjectFile = function() {
var fileName = prompt('File Name for starter Blockly workspace code: '); var fileName = prompt('File Name for starter Blockly workspace code:',
'workspace.js');
if (!fileName) { // If cancelled. if (!fileName) { // If cancelled.
return; return;
} }
@@ -474,18 +481,20 @@ WorkspaceFactoryController.prototype.reinjectPreview = function(tree) {
* currently in use, exits if user presses cancel. * currently in use, exits if user presses cancel.
*/ */
WorkspaceFactoryController.prototype.changeCategoryName = function() { WorkspaceFactoryController.prototype.changeCategoryName = function() {
var selected = this.model.getSelected();
// Return if a category is not selected. // Return if a category is not selected.
if (this.model.getSelected().type != ListElement.TYPE_CATEGORY) { if (selected.type != ListElement.TYPE_CATEGORY) {
return; return;
} }
// Get new name from user. // Get new name from user.
window.foo = selected;
var newName = this.promptForNewCategoryName('What do you want to change this' var newName = this.promptForNewCategoryName('What do you want to change this'
+ ' category\'s name to?'); + ' category\'s name to?', selected.name);
if (!newName) { // If cancelled. if (!newName) { // If cancelled.
return; return;
} }
// Change category name. // Change category name.
this.model.getSelected().changeName(newName); selected.changeName(newName);
this.view.updateCategoryName(newName, this.model.getSelectedId()); this.view.updateCategoryName(newName, this.model.getSelectedId());
// Update preview. // Update preview.
this.updatePreview(); this.updatePreview();

View File

@@ -1,6 +1,6 @@
/** /**
* @license * @license
* Visual Blocks Editor * Blockly Demos: Block Factory
* *
* Copyright 2016 Google Inc. * Copyright 2016 Google Inc.
* https://developers.google.com/blockly/ * https://developers.google.com/blockly/

View File

@@ -1,12 +1,12 @@
/** /**
* @license * @license
* Visual Blocks Editor * Blockly Demos: Block Factory
* *
* Copyright 2016 Google Inc. * Copyright 2016 Google Inc.
* https://developers.google.com/blockly/ * https://developers.google.com/blockly/
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* You may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
@@ -65,68 +65,20 @@ WorkspaceFactoryInit.initWorkspaceFactory = function(controller) {
WorkspaceFactoryInit.initColorPicker_ = function(controller) { WorkspaceFactoryInit.initColorPicker_ = function(controller) {
// Array of Blockly category colors, variety of hues with saturation 45% // Array of Blockly category colors, variety of hues with saturation 45%
// and value 65% as specified in Blockly Developer documentation: // and value 65% as specified in Blockly Developer documentation:
// https://developers.google.com/blockly/guides/create-custom-blocks/define-blocks // developers.google.com/blockly/guides/create-custom-blocks/define-blocks
var colors = [ var colors = [
'#A65C5C', '#A65C5C', '#A6635C', '#A66A5C', '#A6725C', '#A6795C',
'#A6635C', '#A6815C', '#A6885C', '#A6905C', '#A6975C', '#A69F5C',
'#A66A5C', '#A6A65C', '#9FA65C', '#97A65C', '#90A65C', '#88A65C',
'#A6725C', '#81A65C', '#79A65C', '#6FA65C', '#66A65C', '#5EA65C',
'#A6795C', '#5CA661', '#5CA668', '#5CA66F', '#5CA677', '#5CA67E',
'#A6815C', '#5CA686', '#5CA68D', '#5CA695', '#5CA69C', '#5CA6A4',
'#A6885C', '#5CA1A6', '#5C9AA6', '#5C92A6', '#5C8BA6', '#5C83A6',
'#A6905C', '#5C7CA6', '#5C74A6', '#5C6AA6', '#5C61A6', '#5E5CA6',
'#A6975C', '#665CA6', '#6D5CA6', '#745CA6', '#7C5CA6', '#835CA6',
'#A69F5C', '#8B5CA6', '#925CA6', '#9A5CA6', '#A15CA6', '#A65CA4',
'#A6A65C', '#A65C9C', '#A65C95', '#A65C8D', '#A65C86', '#A65C7E',
'#9FA65C', '#A65C77', '#A65C6F', '#A65C66', '#A65C61', '#A65C5E'
'#97A65C',
'#90A65C',
'#88A65C',
'#81A65C',
'#79A65C',
'#6FA65C',
'#66A65C',
'#5EA65C',
'#5CA661',
'#5CA668',
'#5CA66F',
'#5CA677',
'#5CA67E',
'#5CA686',
'#5CA68D',
'#5CA695',
'#5CA69C',
'#5CA6A4',
'#5CA1A6',
'#5C9AA6',
'#5C92A6',
'#5C8BA6',
'#5C83A6',
'#5C7CA6',
'#5C74A6',
'#5C6AA6',
'#5C61A6',
'#5E5CA6',
'#665CA6',
'#6D5CA6',
'#745CA6',
'#7C5CA6',
'#835CA6',
'#8B5CA6',
'#925CA6',
'#9A5CA6',
'#A15CA6',
'#A65CA4',
'#A65C9C',
'#A65C95',
'#A65C8D',
'#A65C86',
'#A65C7E',
'#A65C77',
'#A65C6F',
'#A65C66',
'#A65C61',
'#A65C5E'
]; ];
// Create color picker with specific set of Blockly colors. // Create color picker with specific set of Blockly colors.

View File

@@ -1,6 +1,6 @@
/** /**
* @license * @license
* Visual Blocks Editor * Blockly Demos: Block Factory
* *
* Copyright 2016 Google Inc. * Copyright 2016 Google Inc.
* https://developers.google.com/blockly/ * https://developers.google.com/blockly/

View File

@@ -1,6 +1,6 @@
/** /**
* @license * @license
* Visual Blocks Editor * Blockly Demos: Block Factory
* *
* Copyright 2016 Google Inc. * Copyright 2016 Google Inc.
* https://developers.google.com/blockly/ * https://developers.google.com/blockly/
@@ -112,11 +112,10 @@ WorkspaceFactoryView.prototype.updateState = function(selectedIndex, selected) {
document.getElementById('button_editCategory').disabled = selectedIndex < 0 || document.getElementById('button_editCategory').disabled = selectedIndex < 0 ||
selected.type != ListElement.TYPE_CATEGORY; selected.type != ListElement.TYPE_CATEGORY;
document.getElementById('button_remove').disabled = selectedIndex < 0; document.getElementById('button_remove').disabled = selectedIndex < 0;
document.getElementById('button_up').disabled = document.getElementById('button_up').disabled = selectedIndex <= 0;
selectedIndex <= 0 ? true : false;
var table = document.getElementById('categoryTable'); var table = document.getElementById('categoryTable');
document.getElementById('button_down').disabled = selectedIndex >= document.getElementById('button_down').disabled = selectedIndex >=
table.rows.length - 1 || selectedIndex < 0 ? true : false; table.rows.length - 1 || selectedIndex < 0;
// Disable/enable the workspace as necessary. // Disable/enable the workspace as necessary.
this.disableWorkspace(this.shouldDisableWorkspace(selected)); this.disableWorkspace(this.shouldDisableWorkspace(selected));
}; };