Committed by
Gerrit Code Review
GUI -- Toolbar and ButtonService appearance work - styled light and dark themed buttons and toolbar.
Change-Id: I07f2d6adcf5a028fa76f50301d6bdfd1e75b1188
Showing
5 changed files
with
86 additions
and
23 deletions
| ... | @@ -18,8 +18,64 @@ | ... | @@ -18,8 +18,64 @@ |
| 18 | ONOS GUI -- Button Service -- CSS file | 18 | ONOS GUI -- Button Service -- CSS file |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | -.btn svg.embeddedIcon, | 21 | +.light .tbarArrow svg.embeddedIcon .icon.tableColSortAsc .glyph { |
| 22 | -.tog svg.embeddedIcon, | 22 | + fill: #838383; |
| 23 | -.rad svg.embeddedIcon { | 23 | +} |
| 24 | +.dark .tbarArrow svg.embeddedIcon .icon.tableColSortAsc .glyph { | ||
| 25 | + fill: #B2B2B2; | ||
| 26 | +} | ||
| 27 | + | ||
| 28 | +.button, | ||
| 29 | +.toggleButton, | ||
| 30 | +.radioSet, | ||
| 31 | +.separator { | ||
| 32 | + display: inline-block; | ||
| 33 | +} | ||
| 34 | +.button, | ||
| 35 | +.toggleButton { | ||
| 36 | + padding: 0 4px 0 4px; | ||
| 37 | +} | ||
| 38 | +.radioSet .toggleButton { | ||
| 39 | + padding: 0 0 0 4px; | ||
| 40 | +} | ||
| 41 | + | ||
| 42 | +.button svg.embeddedIcon, | ||
| 43 | +.toggleButton svg.embeddedIcon { | ||
| 24 | cursor: pointer; | 44 | cursor: pointer; |
| 25 | } | 45 | } |
| 46 | +.button svg.embeddedIcon .icon rect, | ||
| 47 | +.toggleButton svg.embeddedIcon .icon rect { | ||
| 48 | + stroke: none; | ||
| 49 | +} | ||
| 50 | + | ||
| 51 | +/* Selected button color */ | ||
| 52 | +.light .button svg.embeddedIcon, | ||
| 53 | +.light .toggleButton.selected svg.embeddedIcon { | ||
| 54 | + fill: #838383; | ||
| 55 | +} | ||
| 56 | +.light .button svg.embeddedIcon .glyph, | ||
| 57 | +.light .toggleButton.selected svg.embeddedIcon .glyph { | ||
| 58 | + fill: white; | ||
| 59 | +} | ||
| 60 | +.dark .button svg.embeddedIcon, | ||
| 61 | +.dark .toggleButton.selected svg.embeddedIcon { | ||
| 62 | + fill: #151515; | ||
| 63 | +} | ||
| 64 | +.dark .button svg.embeddedIcon .glyph, | ||
| 65 | +.dark .toggleButton.selected svg.embeddedIcon .glyph { | ||
| 66 | + fill: #B2B2B2; | ||
| 67 | +} | ||
| 68 | + | ||
| 69 | +/* Unselected button color */ | ||
| 70 | +.light .toggleButton svg.embeddedIcon { | ||
| 71 | + fill: #eee; | ||
| 72 | +} | ||
| 73 | +.light .toggleButton svg.embeddedIcon .glyph { | ||
| 74 | + fill: #bbb; | ||
| 75 | +} | ||
| 76 | +.dark .toggleButton svg.embeddedIcon { | ||
| 77 | + fill: #303030; | ||
| 78 | +} | ||
| 79 | +.dark .toggleButton svg.embeddedIcon .glyph { | ||
| 80 | + fill: #565656; | ||
| 81 | +} | ... | ... |
| ... | @@ -38,7 +38,7 @@ | ... | @@ -38,7 +38,7 @@ |
| 38 | return null; | 38 | return null; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | - var btnDiv = createDiv(div, 'btn', id), | 41 | + var btnDiv = createDiv(div, 'button', id), |
| 42 | cbFnc = fs.isF(cb) || noop; | 42 | cbFnc = fs.isF(cb) || noop; |
| 43 | 43 | ||
| 44 | is.loadIcon(btnDiv, gid, btnSize, true); | 44 | is.loadIcon(btnDiv, gid, btnSize, true); |
| ... | @@ -59,10 +59,11 @@ | ... | @@ -59,10 +59,11 @@ |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | var sel = !!initState, | 61 | var sel = !!initState, |
| 62 | - togDiv = createDiv(div, 'tog', id), | 62 | + togDiv = createDiv(div, 'toggleButton', id), |
| 63 | cbFnc = fs.isF(cb) || noop; | 63 | cbFnc = fs.isF(cb) || noop; |
| 64 | 64 | ||
| 65 | is.loadIcon(togDiv, gid, btnSize, true); | 65 | is.loadIcon(togDiv, gid, btnSize, true); |
| 66 | + togDiv.classed('selected', sel); | ||
| 66 | 67 | ||
| 67 | function _toggle(b) { | 68 | function _toggle(b) { |
| 68 | if (b === undefined) { | 69 | if (b === undefined) { |
| ... | @@ -71,6 +72,7 @@ | ... | @@ -71,6 +72,7 @@ |
| 71 | sel = !!b; | 72 | sel = !!b; |
| 72 | } | 73 | } |
| 73 | cbFnc(sel); | 74 | cbFnc(sel); |
| 75 | + togDiv.classed('selected', sel); | ||
| 74 | } | 76 | } |
| 75 | 77 | ||
| 76 | togDiv.on('click', _toggle); | 78 | togDiv.on('click', _toggle); |
| ... | @@ -83,6 +85,7 @@ | ... | @@ -83,6 +85,7 @@ |
| 83 | } | 85 | } |
| 84 | } | 86 | } |
| 85 | 87 | ||
| 88 | + // TODO: fix radio button on click selecting functionality | ||
| 86 | function radioSet(div, id, rset) { | 89 | function radioSet(div, id, rset) { |
| 87 | if (!div) { | 90 | if (!div) { |
| 88 | $log.warn('Radio buttons cannot append to div'); | 91 | $log.warn('Radio buttons cannot append to div'); |
| ... | @@ -96,7 +99,7 @@ | ... | @@ -96,7 +99,7 @@ |
| 96 | $log.warn('Cannot create radio button set from empty array'); | 99 | $log.warn('Cannot create radio button set from empty array'); |
| 97 | return null; | 100 | return null; |
| 98 | } | 101 | } |
| 99 | - var rDiv = div.append('div').classed('rset', true), | 102 | + var rDiv = div.append('div').classed('radioSet', true), |
| 100 | sel = 0, | 103 | sel = 0, |
| 101 | rads = []; | 104 | rads = []; |
| 102 | 105 | ||
| ... | @@ -107,7 +110,7 @@ | ... | @@ -107,7 +110,7 @@ |
| 107 | rtog = toggle(rDiv, rbtn.id, rbtn.gid, istate, | 110 | rtog = toggle(rDiv, rbtn.id, rbtn.gid, istate, |
| 108 | rbtn.cb, rbtn.tooltip); | 111 | rbtn.cb, rbtn.tooltip); |
| 109 | 112 | ||
| 110 | - rtog.el = (rtog.el).classed('tog', false).classed('rad', true); | 113 | + rtog.el.classed('radioButton', true); |
| 111 | rads.push(rtog); | 114 | rads.push(rtog); |
| 112 | }); | 115 | }); |
| 113 | 116 | ... | ... |
| ... | @@ -18,16 +18,15 @@ | ... | @@ -18,16 +18,15 @@ |
| 18 | ONOS GUI -- Toolbar Service -- CSS file | 18 | ONOS GUI -- Toolbar Service -- CSS file |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | -.floatpanel.toolbar { | 21 | +.separator { |
| 22 | - position: absolute; | 22 | + border: 1px solid; |
| 23 | - z-index: 100; | 23 | + margin: 0 4px 0 4px; |
| 24 | - display: block; | 24 | +} |
| 25 | - width: 200px; | 25 | +.light .separator { |
| 26 | - opacity: 0; | 26 | + border-color: #ddd; |
| 27 | +} | ||
| 27 | 28 | ||
| 28 | - padding: 10px; | 29 | +.dark .separator { |
| 29 | - font-size: 10pt; | 30 | + border-color: #1A1A1A; |
| 30 | 31 | ||
| 31 | - -moz-border-radius: 6px; | 32 | +} |
| 32 | - border-radius: 6px; | ||
| 33 | -} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -28,6 +28,7 @@ | ... | @@ -28,6 +28,7 @@ |
| 28 | width: 400, | 28 | width: 400, |
| 29 | margin: 0, | 29 | margin: 0, |
| 30 | hideMargin: -20, | 30 | hideMargin: -20, |
| 31 | + top: '80%', | ||
| 31 | fade: false | 32 | fade: false |
| 32 | }, | 33 | }, |
| 33 | settings, | 34 | settings, |
| ... | @@ -73,7 +74,6 @@ | ... | @@ -73,7 +74,6 @@ |
| 73 | 'transform': 'translate(-50%, -50%)', | 74 | 'transform': 'translate(-50%, -50%)', |
| 74 | 'cursor': 'pointer'}); | 75 | 'cursor': 'pointer'}); |
| 75 | is.loadEmbeddedIcon(tbarArrowDiv, 'tableColSortAsc', arrowSize); | 76 | is.loadEmbeddedIcon(tbarArrowDiv, 'tableColSortAsc', arrowSize); |
| 76 | - rotateArrowLeft(); | ||
| 77 | 77 | ||
| 78 | tbarArrowDiv.on('click', toggleTools); | 78 | tbarArrowDiv.on('click', toggleTools); |
| 79 | } | 79 | } |
| ... | @@ -107,8 +107,8 @@ | ... | @@ -107,8 +107,8 @@ |
| 107 | return null; | 107 | return null; |
| 108 | } | 108 | } |
| 109 | return tbarDiv.append('div') | 109 | return tbarDiv.append('div') |
| 110 | - .classed('sep', true) | 110 | + .classed('separator', true) |
| 111 | - .style('width', '2px'); | 111 | + .style('height', '23px'); |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | // === Main toolbar API functions ---------------------------- | 114 | // === Main toolbar API functions ---------------------------- |
| ... | @@ -126,7 +126,7 @@ | ... | @@ -126,7 +126,7 @@ |
| 126 | 126 | ||
| 127 | tbarPanel = ps.createPanel(tbarId, settings); | 127 | tbarPanel = ps.createPanel(tbarId, settings); |
| 128 | tbarDiv = tbarPanel.classed('toolbar', true) | 128 | tbarDiv = tbarPanel.classed('toolbar', true) |
| 129 | - .style('position', 'relative'); | 129 | + .style('top', settings.top); |
| 130 | 130 | ||
| 131 | createArrow(); | 131 | createArrow(); |
| 132 | 132 | ... | ... |
| ... | @@ -31,8 +31,13 @@ | ... | @@ -31,8 +31,13 @@ |
| 31 | 31 | ||
| 32 | self.message = 'Hey there folks!'; | 32 | self.message = 'Hey there folks!'; |
| 33 | 33 | ||
| 34 | - var toolbar = tbs.createToolbar('sample'); | 34 | + var toolbar = tbs.createToolbar('sample'), |
| 35 | + rset = [{ gid: 'switch', cb: function () {}}, | ||
| 36 | + { gid: 'bird', cb: function () {}}]; | ||
| 35 | toolbar.addButton('some-btn', 'crown', function () {}); | 37 | toolbar.addButton('some-btn', 'crown', function () {}); |
| 38 | + toolbar.addToggle('some-tog', 'chain', function () {}); | ||
| 39 | + toolbar.addSeparator(); | ||
| 40 | + toolbar.addRadioSet('some-rad', rset); | ||
| 36 | toolbar.show(); | 41 | toolbar.show(); |
| 37 | 42 | ||
| 38 | $log.log('OvSampleCtrl has been created'); | 43 | $log.log('OvSampleCtrl has been created'); | ... | ... |
-
Please register or login to post a comment