Skip to content

Commit

Permalink
ricardo hates jupiter ascending
Browse files Browse the repository at this point in the history
  • Loading branch information
stevewirts committed Feb 11, 2015
1 parent 96d7a89 commit 7949438
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 41 deletions.
16 changes: 14 additions & 2 deletions behaviors/fin-hypergrid-behavior-default.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<link rel="import" href="../fin-hypergrid-constants.html">
<link rel="import" href="../fin-hypergrid-cell-provider.html">
<link rel="import" href="../features/fin-hypergrid-feature-cell-selection.html">
<link rel="import" href="../features/fin-hypergrid-feature-column-picker.html">
<link rel="import" href="../features/fin-hypergrid-feature-overlay.html">
<link rel="import" href="../features/fin-hypergrid-feature-thumbwheel-scrolling.html">
<link rel="import" href="../features/fin-hypergrid-feature-cell-editing.html">
<link rel="import" href="../features/fin-hypergrid-feature-column-sorting.html">
Expand Down Expand Up @@ -103,7 +103,7 @@
},

initializeFeatureChain: function(grid) {
this.setNextFeature(document.createElement('fin-hypergrid-feature-column-picker'));
this.setNextFeature(document.createElement('fin-hypergrid-feature-overlay'));
this.setNextFeature(document.createElement('fin-hypergrid-feature-column-resizing'));
this.setNextFeature(document.createElement('fin-hypergrid-feature-row-resizing'));
this.setNextFeature(document.createElement('fin-hypergrid-feature-cell-selection'));
Expand Down Expand Up @@ -462,6 +462,18 @@
code += String.fromCharCode('A'.charCodeAt(0) + rem);
return code;
},
openEditor: function(div) {
//enhance the editor to suit your needs
//also
//return false to keep the editor from opening
//anything else will leave the editor open
return false;
},
closeEditor: function(div) {
//return true to close the editor
//anything else will leave the editor open
return true;
}

});

Expand Down
69 changes: 46 additions & 23 deletions behaviors/fin-hypergrid-behavior-qtree.html
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,52 @@
};
this.ws.send(JSON.stringify(nodeClick));
},
openEditor: function(div) {
var container = document.createElement('div');
//container.style.display = 'inline-flex';

var groupsList = this.createList('hierarchy', this.block.G);
container.appendChild(groupsList);

var visibleList = this.createList('visible columns', this.block.H);
container.appendChild(visibleList);

var hiddenList = this.createList('hidden columns', this.block.H_);
container.appendChild(hiddenList);

div.appendChild(container);
return true;
},
createList: function(title, data) {
var span = document.createElement('span');
span.style.margin = '10px';

var titleNode = document.createElement('span');
titleNode.innerText = title;
titleNode.style.verticalAlign = 'top';

var select = document.createElement('select');
select.style.width = '150px';
select.style.height = '400px';
select.setAttribute('size', 10);
select.setAttribute('multiple', true);
for (var i = 0; i < data.length; i++) {
var o = document.createElement('option');
o.setAttribute('value', data[i]);
o.text = data[i];
select.appendChild(o);
};
span.appendChild(titleNode);
span.appendChild(select);
return span;
},
closeEditor: function(div) {
//this is the main "big" editor for the table,
//not an individual cell editor
//return true to close the editor
//anything else will leave the editor open
return true;
},
//websocket connection to Q. try and do a reconnect after 2 seconds if we fail
connect: function() {
var d = {};
Expand Down Expand Up @@ -450,6 +495,7 @@
self.initColumnIndexes();
}
self.changed();
//console.dir(self.block);
};
this.ws.onerror = function(e) {
self.clearData();
Expand All @@ -467,28 +513,5 @@

})(); /* jslint ignore:line */

// h_ is the text of the hierarchy column.
// l_ is the level of the row of the table.
// e_ tells you whether the row is a leaf or a node.
// o_ tells you whether the row is open, if it's a node
// n_ is a list of nodes
// so:
// indent h_[i] l_[i] spaces.
// if e_[i]=1 then row i is a leaf. otherwise it's a node.
// if row i is a node, then if o_[i]=0 then row i is closed (prefix with a +) else it's open (prefix with a -)

// Z = data table (first record;rest of the records)
// Z_ = ctl table (ditto)
// G = groups
// G_ = rest of the groupable cols
// H = rolled up cols
// H_ = columns not in table
// Q = type map
// S = sort map
// R = rows map (block of table i'm sending you)
// N = count of treetable



</script>
</polymer-element>
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<!--
The `fin-hypergrid-column-picker` element is a custom Polymer web component that serves as the base "class" or API for the grid features (controllers).
The `fin-hypergrid-overlay` element is a custom Polymer web component that can open and close an overlay surface.
@group OpenFin hypergrid
@element fin-hypergrid-column-picker
@element fin-hypergrid-overlay
@homepage http://github.com/openfin/fin-hypergrid
-->

<polymer-element name="fin-hypergrid-feature-column-picker" extends="fin-hypergrid-feature-base">
<polymer-element name="fin-hypergrid-feature-overlay" extends="fin-hypergrid-feature-base">
<template></template>
<script>


(function() {

'use strict';
var animationTime = 300;
var animationTime = 200;
Polymer({ /* jshint ignore:line */
handleKeyUp: function(grid, event) {
var key = event.detail.char;
Expand All @@ -34,27 +34,63 @@
return this.overlay.style.display !== 'none';
},
openColumnPicker: function(grid) {
if (this.isColumnPickerOpen()) {
return;
}
if (grid.getBehavior().openEditor(this.overlay) === false) {
return;
}

var self = this;
var bounds = grid.getBoundingClientRect();
this.overlay.style.backgroundColor = grid.resolveProperty('backgroundColor2');
this.overlay.style.top = (bounds.top + 8) + 'px';
this.overlay.style.left = (bounds.left + 8) + 'px';
this.overlay.style.width = (bounds.width - 35) + 'px';
this.overlay.style.height = (bounds.height - 35)+ 'px';
this.overlay.style.backgroundColor = grid.resolveProperty('backgroundColor');

this.overlay.style.top = '0%';
this.overlay.style.right = '0%';
this.overlay.style.bottom = '0%';
this.overlay.style.left = '0%';

this.overlay.style.marginTop = '15px';
this.overlay.style.marginRight = '35px';
this.overlay.style.marginBottom = '35px';
this.overlay.style.marginLeft = '15px';

self.overlay.style.display = '';

if (!this._closer) {
this._closer = function(e) {
if (!e.altKey) {
return;
}
e.preventDefault();
self.closeColumnPicker(grid);
}
}

requestAnimationFrame(function(){
self.overlay.style.opacity = 0.85;
self.overlay.style.opacity = 0.95;
document.addEventListener('keydown', self._closer, false);
});
},
closeColumnPicker: function(grid) {
if (!this.isColumnPickerOpen()) {
return;
}
if (grid.getBehavior().closeEditor(this.overlay) === false) {
return;
}

document.removeEventListener('keydown', this._closer, false);

var self = this;

requestAnimationFrame(function(){
self.overlay.style.opacity = 0;
});

setTimeout(function(){
self.overlay.innerHTML = '';
self.overlay.style.display = 'none';
grid.takeFocus();
}, animationTime);
},
initializeOn: function(grid) {
Expand All @@ -70,7 +106,8 @@
this.overlay.style.display = 'none';
this.overlay.style.transition = 'opacity ' + animationTime + 'ms ease-in';
this.overlay.style.opacity = 0;
document.body.appendChild(this.overlay);
grid.shadowRoot.appendChild(this.overlay);
//document.body.appendChild(this.overlay);
},

});
Expand Down
1 change: 0 additions & 1 deletion fin-hypergrid.html
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@
*/

renderOverridesCache: {},

domReady: function() {
var self = this;
this.themeListener = document.createElement('html');
Expand Down
1 change: 0 additions & 1 deletion fin-hypergrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@
*/

renderOverridesCache: {},

domReady: function() {
var self = this;
this.themeListener = document.createElement('html');
Expand Down
2 changes: 1 addition & 1 deletion fin-hypergrid.min.html

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions q/d.q
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ T:([tradeId:til n]
time:09:30:00.0+n?23000000)

G:`sector`trader`strategy
H:`tradeId`price`quantity
A[`price]:(avg;`price)
A[`tradeId]:(.tt.nul;`tradeId)
2 changes: 1 addition & 1 deletion q/t.q
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
\d .tt

/ construct treetable
cons:{[t;p;a;s;g;h]cons_[csub[t]g,h;p;a;s]. ungrp[t;g]h}
cons:{[t;p;a;s;g;h]cons_[csub[t]g,h;p;(h inter key a)#a;s]. ungrp[t;g]h}

cons_:{[t;p;a;s;g;h]
d:dat[t;p;rollups[t;g]a;g]h,`s_;
Expand Down

0 comments on commit 7949438

Please sign in to comment.