NIFI-140:

- Address style issues with slider widget in processor configuration and provenance lineage.
- Documentation in count, center, and ellipsis plugins.
- Disable text selection over canvas, new processor dialog, and context menu.
- Updated the draggable component icons to support dragging over all parts of the page. Only creating new component when the drop occurs over the canvas. Other drops will be disabled.
This commit is contained in:
Matt Gilman 2014-12-30 10:37:51 -05:00
parent 7589ad356e
commit b823189452
10 changed files with 68 additions and 20 deletions

View File

@ -84,7 +84,7 @@
<jsp:include page="/WEB-INF/partials/canvas/fill-color-dialog.jsp"/> <jsp:include page="/WEB-INF/partials/canvas/fill-color-dialog.jsp"/>
<jsp:include page="/WEB-INF/partials/canvas/connections-dialog.jsp"/> <jsp:include page="/WEB-INF/partials/canvas/connections-dialog.jsp"/>
<jsp:include page="/WEB-INF/partials/canvas/flow-status.jsp"/> <jsp:include page="/WEB-INF/partials/canvas/flow-status.jsp"/>
<div id="canvas-container"><!-- inject canvas here --></div> <div id="canvas-container" class="unselectable"></div>
<div id="canvas-tooltips"> <div id="canvas-tooltips">
<div id="processor-tooltips"></div> <div id="processor-tooltips"></div>
<div id="port-tooltips"></div> <div id="port-tooltips"></div>
@ -111,6 +111,6 @@
<jsp:include page="/WEB-INF/partials/connection-details.jsp"/> <jsp:include page="/WEB-INF/partials/connection-details.jsp"/>
<div id="faded-background"></div> <div id="faded-background"></div>
<div id="glass-pane"></div> <div id="glass-pane"></div>
<div id="context-menu"></div> <div id="context-menu" class="unselectable"></div>
</body> </body>
</html> </html>

View File

@ -53,5 +53,5 @@
</div> </div>
<div id="birdseye-collapse" class="birdseye-expanded"></div> <div id="birdseye-collapse" class="birdseye-expanded"></div>
<div id="birdseye-container"> <div id="birdseye-container">
<div id="birdseye"><!-- inject outline here --></div> <div id="birdseye"></div>
</div> </div>

View File

@ -37,7 +37,7 @@
</div> </div>
</div> </div>
<div id="processor-types-container"> <div id="processor-types-container">
<div id="processor-types-table"></div> <div id="processor-types-table" class="unselectable"></div>
<div id="processor-description-container"> <div id="processor-description-container">
<div id="processor-type-name" class="ellipsis"></div> <div id="processor-type-name" class="ellipsis"></div>
<div id="processor-type-description" class="ellipsis multiline"></div> <div id="processor-type-description" class="ellipsis multiline"></div>

View File

@ -76,6 +76,15 @@ div.context-menu-item-text {
General Styles General Styles
*/ */
.unselectable {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.clear { .clear {
clear: both; clear: both;
} }

View File

@ -143,6 +143,7 @@ div.relationship-description {
#run-duration-slider { #run-duration-slider {
margin-top: 5px; margin-top: 5px;
border-radius: 0;
} }
#run-duration-slider .ui-slider-handle { #run-duration-slider .ui-slider-handle {

View File

@ -529,6 +529,16 @@ div.progress-label {
margin-left: 10px; margin-left: 10px;
} }
#provenance-lineage-slider {
border-radius: 0;
}
#provenance-lineage-slider .ui-slider-handle {
border-radius: 0;
border: 1px solid #999;
outline: none;
}
#event-timeline { #event-timeline {
margin-top: 8px; margin-top: 8px;
color: #9F6000; color: #9F6000;

View File

@ -14,6 +14,14 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/**
* Simple jQuery plugin to center any matched elements. Implementation
* specifics suggested on StackOverflow.
*
* @param {type} $
* @returns {undefined}
*/
(function ($) { (function ($) {
$.fn.center = function () { $.fn.center = function () {
return this.each(function () { return this.each(function () {
@ -23,5 +31,5 @@
'left': ($(window).width() - $(this).outerWidth()) / 2 + $(window).scrollLeft() + 'px' 'left': ($(window).width() - $(this).outerWidth()) / 2 + $(window).scrollLeft() + 'px'
}); });
}); });
} };
})(jQuery); })(jQuery);

View File

@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/** /**
* Adds a simple character counter functionality to the matched elements. The * Adds a simple character counter functionality to the matched elements. The
* options are specified in the following format: * options are specified in the following format:
@ -22,6 +23,11 @@
* charCountField: element or dom id for displaying the remaining characters (must support .text()) * charCountField: element or dom id for displaying the remaining characters (must support .text())
* maxLength: maxlength in case the matched element does not have a max length set * maxLength: maxlength in case the matched element does not have a max length set
* } * }
*
* Implementation specifics suggested on StackOverflow.
*
* @param {type} $
* @returns {undefined}
*/ */
(function ($) { (function ($) {
@ -38,14 +44,16 @@
}; };
var methods = { var methods = {
/** /**
* Initializes the combo box. * Initializes the count widget.
*
* @param {type} options
*/ */
init: function (options) { init: function (options) {
return this.each(function () { return this.each(function () {
// ensure the options have been properly specified // ensure the options have been properly specified
if (isDefinedAndNotNull(options) && if (isDefinedAndNotNull(options) && isDefinedAndNotNull(options.charCountField)) {
isDefinedAndNotNull(options.charCountField)) {
// get the field // get the field
var field = $(this); var field = $(this);
@ -87,5 +95,5 @@
} else { } else {
return methods.init.apply(this, arguments); return methods.init.apply(this, arguments);
} }
} };
})(jQuery); })(jQuery);

View File

@ -14,6 +14,14 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/**
* Plugin to provide support for generating ellipsis. This plugin comprises
* a number of suggested techniques found on StackOverflow.
*
* @param {type} $
* @returns {undefined}
*/
(function ($) { (function ($) {
var entityMap = { var entityMap = {
@ -40,6 +48,8 @@
* white-space: nowrap; * white-space: nowrap;
* *
* If multiline is desired, add a 'multiline' class to the element. * If multiline is desired, add a 'multiline' class to the element.
*
* @param {type} addTooltip
*/ */
$.fn.ellipsis = function (addTooltip) { $.fn.ellipsis = function (addTooltip) {
addTooltip = (typeof addTooltip === 'undefined' || addTooltip === null) ? true : addTooltip; addTooltip = (typeof addTooltip === 'undefined' || addTooltip === null) ? true : addTooltip;
@ -50,7 +60,6 @@
return ('textOverflow' in s || 'OTextOverflow' in s); return ('textOverflow' in s || 'OTextOverflow' in s);
} }
// function to performing a binary search - this approach was found on stackoverflow
function binarySearch(length, funct) { function binarySearch(length, funct) {
var low = 0; var low = 0;
var high = length - 1; var high = length - 1;

View File

@ -66,10 +66,11 @@ nf.CanvasToolbox = (function () {
}, function () { }, function () {
$(this).removeClass(hoverCls).addClass(cls); $(this).removeClass(hoverCls).addClass(cls);
}).draggable({ }).draggable({
'zIndex': 1011,
'helper': function () { 'helper': function () {
return $('<div class="toolbox-icon"></div>').addClass(dragCls); return $('<div class="toolbox-icon"></div>').addClass(dragCls).appendTo('body');
}, },
'containment': '#canvas-container', 'containment': 'body',
'stop': function (e, ui) { 'stop': function (e, ui) {
var translate = nf.Canvas.View.translate(); var translate = nf.Canvas.View.translate();
var scale = nf.Canvas.View.scale(); var scale = nf.Canvas.View.scale();
@ -77,15 +78,17 @@ nf.CanvasToolbox = (function () {
var mouseX = e.originalEvent.pageX; var mouseX = e.originalEvent.pageX;
var mouseY = e.originalEvent.pageY - nf.Canvas.CANVAS_OFFSET; var mouseY = e.originalEvent.pageY - nf.Canvas.CANVAS_OFFSET;
// adjust the x and y coordinates accordingly // invoke the drop handler if we're over the canvas
var x = (mouseX / scale) - (translate[0] / scale); if (mouseX >= 0 && mouseY >= 0) {
var y = (mouseY / scale) - (translate[1] / scale); // adjust the x and y coordinates accordingly
var x = (mouseX / scale) - (translate[0] / scale);
var y = (mouseY / scale) - (translate[1] / scale);
// invoke the drop handler dropHandler({
dropHandler({ x: x,
x: x, y: y
y: y });
}); }
} }
}).appendTo(toolbox); }).appendTo(toolbox);
}; };