Skip to content

Commit

Permalink
Renamed *NavigateButton to *NavigateMenu. Removed unused UI texts.
Browse files Browse the repository at this point in the history
  • Loading branch information
awegmueller committed Nov 24, 2015
1 parent d734358 commit 9d25693
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 78 deletions.
Expand Up @@ -88,9 +88,7 @@ public void contributeUiTextKeys(Set<String> textKeys) {
"ui.remove",
"ui.add",
"ui.FilterBy",
"ui.Show",
"ui.Up",
"ui.Back",
"ui.Continue",
"ui.Ignore",
"ui.ErrorCodeX",
Expand Down
Expand Up @@ -291,9 +291,9 @@ __include("scout/form/fields/wizard/WizardProgressField.js");
__include("scout/form/fields/wizard/WizardProgressFieldLayout.js");
__include("scout/form/fields/wrappedform/WrappedFormField.js");
// More misc. elements
__include("scout/desktop/AbstractNavigateButton.js"); // requires Button.js
__include("scout/desktop/NavigateDownButton.js");
__include("scout/desktop/NavigateUpButton.js");
__include("scout/desktop/AbstractNavigateMenu.js"); // requires Menu.js
__include("scout/desktop/NavigateDownMenu.js");
__include("scout/desktop/NavigateUpMenu.js");

__include("scout/mobileObjectFactories.js");
__include("scout/table/MobileTable.js");
Expand Down
6 changes: 3 additions & 3 deletions org.eclipse.scout.rt.ui.html/src/main/js/scout-module.js
Expand Up @@ -294,7 +294,7 @@ __include("scout/form/fields/wizard/WizardProgressFieldLayout.js");
__include("scout/form/fields/wrappedform/WrappedFormField.js");
// More misc. elements
__include("scout/desktop/DesktopFormController.js");
__include("scout/desktop/AbstractNavigateButton.js"); // requires Button.js
__include("scout/desktop/NavigateDownButton.js");
__include("scout/desktop/NavigateUpButton.js");
__include("scout/desktop/AbstractNavigateMenu.js"); // requires Menu.js
__include("scout/desktop/NavigateDownMenu.js");
__include("scout/desktop/NavigateUpMenu.js");
}(window.scout = window.scout || {}, jQuery));
Expand Up @@ -14,8 +14,8 @@
* the server which nodes have been selected. We do that for better user experience. In a first attempt
* the whole navigation logic was on the server, which caused a lag and flickering in the UI.
*/
scout.AbstractNavigateButton = function() {
scout.AbstractNavigateButton.parent.call(this);
scout.AbstractNavigateMenu = function() {
scout.AbstractNavigateMenu.parent.call(this);

this.node;
this.outline;
Expand All @@ -30,21 +30,19 @@ scout.AbstractNavigateButton = function() {
*/
this._additionalCssClass = '';
};
scout.inherits(scout.AbstractNavigateButton, scout.Menu);
scout.inherits(scout.AbstractNavigateMenu, scout.Menu);

scout.AbstractNavigateButton.prototype._init = function(options) {
scout.AbstractNavigateButton.parent.prototype._init.call(this, options);
scout.AbstractNavigateMenu.prototype._init = function(options) {
scout.AbstractNavigateMenu.parent.prototype._init.call(this, options);

this.node = options.node;
this.outline = options.outline;
};

// FIXME AWE: re-name to *Menu

/**
* @override
*/
scout.AbstractNavigateButton.prototype._render = function($parent) {
scout.AbstractNavigateMenu.prototype._render = function($parent) {
if (this._isDetail()) {
this._onClickFunc = this._setDetailVisible.bind(this);
} else {
Expand All @@ -58,7 +56,7 @@ scout.AbstractNavigateButton.prototype._render = function($parent) {
this.iconId = this._defaultIconId;
}
this.enabled = this._buttonEnabled();
scout.AbstractNavigateButton.parent.prototype._render.call(this, $parent);
scout.AbstractNavigateMenu.parent.prototype._render.call(this, $parent);
this.$container.addClass('navigate-button small');
this.$container.addClass(this._additionalCssClass);
this.outline.keyStrokeContext.registerKeyStroke(this);
Expand All @@ -67,12 +65,12 @@ scout.AbstractNavigateButton.prototype._render = function($parent) {
/**
* @override Action.js
*/
scout.AbstractNavigateButton.prototype._remove = function() {
scout.AbstractNavigateButton.parent.prototype._remove.call(this);
scout.AbstractNavigateMenu.prototype._remove = function() {
scout.AbstractNavigateMenu.parent.prototype._remove.call(this);
this.outline.keyStrokeContext.unregisterKeyStroke(this);
};

scout.AbstractNavigateButton.prototype._setDetailVisible = function() {
scout.AbstractNavigateMenu.prototype._setDetailVisible = function() {
var detailVisible = this._toggleDetail();
$.log.debug('show detail-' + detailVisible ? 'form' : 'table');
this.node.detailFormVisibleByUi = detailVisible;
Expand All @@ -82,7 +80,7 @@ scout.AbstractNavigateButton.prototype._setDetailVisible = function() {
/**
* @override Menu.js
*/
scout.AbstractNavigateButton.prototype.doAction = function(event) {
scout.AbstractNavigateMenu.prototype.doAction = function(event) {
if (!this.prepareDoAction(event)) {
return false;
}
Expand All @@ -93,7 +91,7 @@ scout.AbstractNavigateButton.prototype.doAction = function(event) {
/**
* Called when enabled state must be re-calculated and probably rendered.
*/
scout.AbstractNavigateButton.prototype.updateEnabled = function() {
scout.AbstractNavigateMenu.prototype.updateEnabled = function() {
this.enabled = this._buttonEnabled();
if (this.rendered) {
this._renderEnabled();
Expand Down
Expand Up @@ -8,32 +8,31 @@
* Contributors:
* BSI Business Systems Integration AG - initial API and implementation
******************************************************************************/
scout.NavigateDownButton = function(outline, node) {
scout.NavigateDownButton.parent.call(this, outline, node);
// FIXME AWE: remove texts ui.Show and ui.Back? still required?
scout.NavigateDownMenu = function(outline, node) {
scout.NavigateDownMenu.parent.call(this, outline, node);
this._defaultIconId = scout.icons.ANGLE_DOWN;
this._defaultText = 'ui.Continue';
this.iconId = this._defaultIconId;
this.keyStroke = 'enter';
};
scout.inherits(scout.NavigateDownButton, scout.AbstractNavigateButton);
scout.inherits(scout.NavigateDownMenu, scout.AbstractNavigateMenu);

scout.NavigateDownButton.prototype._render = function($parent) {
scout.NavigateDownButton.parent.prototype._render.call(this, $parent);
scout.NavigateDownMenu.prototype._render = function($parent) {
scout.NavigateDownMenu.parent.prototype._render.call(this, $parent);
this.$container.addClass('down');
};

scout.NavigateDownButton.prototype._isDetail = function() {
scout.NavigateDownMenu.prototype._isDetail = function() {
// Button is in "detail mode" if there are both detail form and detail table visible and detail form is _not_ hidden.
return !!(this.node.detailFormVisible && this.node.detailForm &&
this.node.detailTableVisible && this.node.detailTable && this.node.detailFormVisibleByUi);
};

scout.NavigateDownButton.prototype._toggleDetail = function() {
scout.NavigateDownMenu.prototype._toggleDetail = function() {
return false;
};

scout.NavigateDownButton.prototype._buttonEnabled = function() {
scout.NavigateDownMenu.prototype._buttonEnabled = function() {
if (this._isDetail()) {
return true;
}
Expand All @@ -50,7 +49,7 @@ scout.NavigateDownButton.prototype._buttonEnabled = function() {
}
};

scout.NavigateDownButton.prototype._drill = function() {
scout.NavigateDownMenu.prototype._drill = function() {
var drillNode;

if (this.node.detailTable) {
Expand Down
Expand Up @@ -8,41 +8,41 @@
* Contributors:
* BSI Business Systems Integration AG - initial API and implementation
******************************************************************************/
scout.NavigateUpButton = function(options) {
scout.NavigateUpButton.parent.call(this);
scout.NavigateUpMenu = function(options) {
scout.NavigateUpMenu.parent.call(this);
this._defaultIconId = scout.icons.ANGLE_UP;
this._defaultText = 'ui.Up';
this._additionalCssClass = 'small-gap';
this.iconId = this._defaultIconId;
this.keyStroke = 'backspace';
};
scout.inherits(scout.NavigateUpButton, scout.AbstractNavigateButton);
scout.inherits(scout.NavigateUpMenu, scout.AbstractNavigateMenu);

scout.NavigateUpButton.prototype._render = function($parent) {
scout.NavigateUpButton.parent.prototype._render.call(this, $parent);
scout.NavigateUpMenu.prototype._render = function($parent) {
scout.NavigateUpMenu.parent.prototype._render.call(this, $parent);
this.$container.addClass('up');
};

scout.NavigateUpButton.prototype._isDetail = function() {
scout.NavigateUpMenu.prototype._isDetail = function() {
// Button is in "detail mode" if there are both detail form and detail table visible and detail form _is_ hidden.
return !!(this.node.detailFormVisible && this.node.detailForm &&
this.node.detailTableVisible && this.node.detailTable && !this.node.detailFormVisibleByUi);
};

scout.NavigateUpButton.prototype._toggleDetail = function() {
scout.NavigateUpMenu.prototype._toggleDetail = function() {
return true;
};

/**
* Returns true when current node has either a parentNode or if current node is a
* top-level node without a parent and the outline has a default detail-form.
*/
scout.NavigateUpButton.prototype._buttonEnabled = function() {
scout.NavigateUpMenu.prototype._buttonEnabled = function() {
var parentNode = this.node.parentNode;
return !!parentNode || !!this.outline.defaultDetailForm || !!this.outline.outlineOverview;
};

scout.NavigateUpButton.prototype._drill = function() {
scout.NavigateUpMenu.prototype._drill = function() {
var parentNode = this.node.parentNode;
if (parentNode) {
$.log.debug('drill up to node ' + parentNode);
Expand Down
Expand Up @@ -11,7 +11,7 @@
scout.Outline = function() {
scout.Outline.parent.call(this);
this._addAdapterProperties(['defaultDetailForm', 'views', 'dialogs', 'messageBoxes', 'fileChoosers']);
this.navigateUpInProgress = false; // see NavigateUpButton.js
this.navigateUpInProgress = false; // see NavigateUpMenu.js
this._additionalContainerClasses += ' outline';
this._treeItemPaddingLeft = 37;
this._treeItemPaddingLevel = 20;
Expand Down Expand Up @@ -185,7 +185,7 @@ scout.Outline.prototype._initTreeNode = function(node, parentNode) {

scout.Outline.prototype._initDetailTable = function(node) {
var menus = this._createOutlineNavigationButtons(node, node.detailTable.staticMenus),
button = this._getMenu(menus, scout.NavigateDownButton),
button = this._getMenu(menus, scout.NavigateDownMenu),
that = this;
node.detailTable.staticMenus = menus;

Expand Down Expand Up @@ -234,16 +234,16 @@ scout.Outline.prototype._decorateNode = function(node) {

scout.Outline.prototype._createOutlineNavigationButtons = function(node, staticMenus) {
var menus = scout.arrays.ensure(staticMenus);
if (!this._hasMenu(menus, scout.NavigateUpButton)) {
var upButton = scout.create('NavigateUpButton', {
if (!this._hasMenu(menus, scout.NavigateUpMenu)) {
var upButton = scout.create('NavigateUpMenu', {
parent: this,
outline: this,
node: node
});
menus.push(upButton);
}
if (!this._hasMenu(menus, scout.NavigateDownButton)) {
var downButton = scout.create('NavigateDownButton', {
if (!this._hasMenu(menus, scout.NavigateDownMenu)) {
var downButton = scout.create('NavigateDownMenu', {
parent: this,
outline: this,
node: node
Expand Down Expand Up @@ -433,7 +433,7 @@ scout.Outline.prototype._isGroupingEnd = function(node) {
/* event handling */

scout.Outline.prototype._onDetailTableRowsSelected = function(event) {
var button = this._getMenu(event.detailTable.staticMenus, scout.NavigateDownButton);
var button = this._getMenu(event.detailTable.staticMenus, scout.NavigateDownMenu);
button.updateEnabled();
};

Expand Down
Expand Up @@ -42,14 +42,14 @@ scout.defaultObjectFactories = [{
return new scout.OutlineViewButton();
}
}, {
objectType: 'NavigateDownButton',
objectType: 'NavigateDownMenu',
create: function() {
return new scout.NavigateDownButton();
return new scout.NavigateDownMenu();
}
}, {
objectType: 'NavigateUpButton',
objectType: 'NavigateUpMenu',
create: function() {
return new scout.NavigateUpButton();
return new scout.NavigateUpMenu();
}
}, {
objectType: 'FormToolButton',
Expand Down
@@ -1,6 +1,5 @@
ui.Aggregation=Aggregation
ui.Average=Average
ui.Back=Back
ui.BooleanColumnGroupingFalse=Unchecked
ui.BooleanColumnGroupingTrue=Checked
ui.Browse=Browse
Expand Down Expand Up @@ -78,7 +77,6 @@ ui.SelectNone=Select none
ui.ServerError=Server error
ui.SessionExpiredMsg=The session has expired, please reload the page.
ui.SessionTimeout=Session timeout
ui.Show=Show
ui.ShowAllNodes=Show all {0}
ui.Sum=Sum
ui.TableRowCount0=No row
Expand Down
@@ -1,6 +1,5 @@
ui.Aggregation=Aggregierung
ui.Average=Durchschnitt
ui.Back=Zur\u00FCck
ui.BooleanColumnGroupingFalse=Nicht markierte
ui.BooleanColumnGroupingTrue=Markierte
ui.Browse=Durchsuchen
Expand Down Expand Up @@ -78,7 +77,6 @@ ui.SelectNone=Keine ausw\u00E4hlen
ui.ServerError=Serverfehler
ui.SessionExpiredMsg=Die Sitzung ist abgelaufen, bitte laden Sie die Seite neu.
ui.SessionTimeout=Session-Timeout
ui.Show=Anzeigen
ui.ShowAllNodes=Alle {0} anzeigen
ui.Sum=Summe
ui.TableRowCount0=Keine Zeile
Expand Down
Expand Up @@ -8,7 +8,7 @@
* Contributors:
* BSI Business Systems Integration AG - initial API and implementation
******************************************************************************/
describe("NavigateDownButton", function() {
describe('NavigateDownMenu', function() {

var session, outline, menu, node = {};

Expand All @@ -19,18 +19,18 @@ describe("NavigateDownButton", function() {
session: session,
handleOutlineContent: function() {}
};
var model = createSimpleModel('NavigateDownButton', session);
var model = createSimpleModel('NavigateDownMenu', session);
model.outline = outline;
model.node = node;
menu = new scout.NavigateDownButton();
menu = new scout.NavigateDownMenu();
menu.init(model);
});

it("_toggleDetail is always false", function() {
it('_toggleDetail is always false', function() {
expect(menu._toggleDetail()).toBe(false);
});

it("_isDetail returns true or false depending on the state of the detail-form and detail-table", function() {
it('_isDetail returns true or false depending on the state of the detail-form and detail-table', function() {
// true when both detailForm and detailTable are visible
node.detailForm = {};
node.detailFormVisible = true;
Expand Down Expand Up @@ -62,22 +62,22 @@ describe("NavigateDownButton", function() {
expect(menu._isDetail()).toBe(false);
});

describe("_buttonEnabled", function() {
describe('_buttonEnabled', function() {

it("is disabled when node is a leaf", function() {
it('is disabled when node is a leaf', function() {
node.leaf = true; // node is a leaf
expect(menu._buttonEnabled()).toBe(false);
});

it("is enabled when node is not a leaf and we're currently displaying the detail", function() {
it('is enabled when node is not a leaf and we\'re currently displaying the detail', function() {
node.leaf = false; // node is not a leaf
menu._isDetail = function() { // currently we're displaying the detail-form
return true;
};
expect(menu._buttonEnabled()).toBe(true);
});

it("is only enabled when detail-table has exactly one selected row", function() {
it('is only enabled when detail-table has exactly one selected row', function() {
node.leaf = false; // node is not a leaf
menu._isDetail = function() { // currently we're not displaying the detail-form
return false;
Expand All @@ -94,7 +94,7 @@ describe("NavigateDownButton", function() {
});
});

it("_drill drills down to first selected row in the detail table", function() {
it('_drill drills down to first selected row in the detail table', function() {
var drillNode = {};
node.detailTable = {
selectedRows: [{
Expand Down

0 comments on commit 9d25693

Please sign in to comment.