Skip to content

Commit 39f0fd1

Browse files
committed
fix bug
1 parent a197a32 commit 39f0fd1

File tree

9 files changed

+68
-60
lines changed

9 files changed

+68
-60
lines changed

src/main/resources/styles/_panel.scss

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,11 @@ div.statusBar {
141141
-ms-user-select: none;
142142
user-select: none;
143143
text-overflow: clip;
144+
word-break: keep-all;
145+
white-space: nowrap;
144146
text-align: center;
145-
color: red;
146-
font-size: 28px;
147+
color: #777;
148+
font-size: 18px;
147149
font-weight: bold;
148150
font-family: Impact, Haettenschweiler, 'Arial Narrow', sans-serif;
149151
padding: 10px 10px 10px 10px;
@@ -226,4 +228,4 @@ div.statusBar {
226228
color: $dark-color;
227229
}
228230
}
229-
}
231+
}

src/main/typescript/app/relfinder.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { BaseApp } from './app';
1616
import {RelListCtrl} from "../control/RelListCtrl";
1717
import {StatusBarCtrl} from "../control/StatusBarCtrl";
1818
import {Theme} from "../theme";
19+
import {SearchBoxCtrl} from "../control/SearchBoxCtrl";
1920

2021
export class RelFinder extends BaseApp {
2122
private _relfinder: RelFinderCtrl;
@@ -69,9 +70,11 @@ export class RelFinder extends BaseApp {
6970
click: (checked: boolean) => { connect.loadRemoteServer(); }
7071
});
7172

72-
this._relfinderDlg = frame.getRequiredControlLike(new RelFinderDialogCtrl());
73-
this._rellist = frame.getRequiredControlLike(new RelListCtrl());
73+
// this._relfinderDlg = frame.getRequiredControlLike(new RelFinderDialogCtrl());
74+
this._relfinderDlg = frame.addControl(new RelFinderDialogCtrl());
75+
this._rellist = frame.addControl(new RelListCtrl());
7476
this._relfinder = frame.addControl( new RelFinderCtrl());
77+
frame.getRequiredControlLike(new SearchBoxCtrl()).hide();
7578

7679
frame.updateNetworkOptions(function (options: NETWORK_OPTIONS) {
7780
options.edges.physics = false;

src/main/typescript/control/RelFinderDialogCtrl.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,27 @@ import { MainFrame } from '../mainframe';
66
export class RelFinderDialogCtrl extends UIControl {
77

88
private _searchBoxes: JQuery[];
9+
protected _content = `
10+
<div class="line"><span class="fa relfinder-icon fa-flag"></span>
11+
<div class="relfinder-searchbox-container">
12+
<input class="igraph-searchbox" type="text" placeholder="input keyword">
13+
</div>
14+
</div>
15+
<div class="line"><span class="fa relfinder-icon fa-flag-checkered"></span>
16+
<div class="relfinder-searchbox-container">
17+
<input class="igraph-searchbox" type="text" placeholder="input keyword">
18+
</div>
19+
</div>
20+
<div class="line"><label>maxdepth: </label>
21+
<input size="10" autocomplete="off" readonly class="ui-spinner-input relfinder-depth-spinner">
22+
</div>
23+
<p align="center">
24+
<button type="button" class="btn relfinder-btn relfinder-btn-start">find relations</button>
25+
<button type="button" class="btn relfinder-btn relfinder-btn-stop" disabled="disabled">stop</button>
26+
</p>`;
27+
protected _classname = 'relfinder-dlg';
28+
protected _dockable = true;
29+
protected _positionStr = "B:-6,45";
930

1031
public getTypeName(): string {
1132
return "RelFinderDialogCtrl";

src/main/typescript/control/RelListCtrl.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ export class RelListCtrl extends UIControl{
1414

1515
private _frame: MainFrame;
1616

17-
protected _classname = 'ResultListPanel';
17+
protected _content = `<p class="rellist-title">Relation Paths (<span class="relnum">11</span>):</p>
18+
<ul class="rellist"></ul>`
19+
protected _classname = 'rellistPanel';
1820
protected _dockable = true;
1921
protected _draggable = true;
20-
protected _positionStr = "A:10,70";
22+
protected _positionStr = "B:-6,220";
2123

2224
//colors of selected paths
2325
private _pathColors = [

src/main/typescript/control/StatusBarCtrl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class StatusBarCtrl extends UIControl {
88
protected _classname = 'statusBar';
99
protected _dockable = true;
1010
protected _draggable = false;
11-
protected _positionStr = "C:-100,0";
11+
protected _positionStr = "C:-250,-10";
1212

1313
public getTypeName(): string {
1414
return "StatusBarCtrl";

src/main/typescript/mainframe.ts

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ export abstract class MainFrame {
6868
private _showGraphOptions: FRAME_OPTIONS = {};
6969
private _theme: Theme;
7070

71+
private clickFlag = null;
72+
7173
public constructor(htmlFrame: HTMLElement, showGraphOptions: FRAME_OPTIONS, theme?: Theme) {
7274
this._htmlFrame = htmlFrame;
7375

@@ -498,6 +500,29 @@ export abstract class MainFrame {
498500
this.updateNodes(updates);
499501
}
500502

503+
private _bindNetworkClick(){
504+
let browser: MainFrame = this;
505+
this._network.on('click', function (args) {
506+
if(browser.clickFlag) {//取消上次延时未执行的方法
507+
browser.clickFlag = clearTimeout(browser.clickFlag);
508+
}
509+
510+
browser.clickFlag = setTimeout(function() {
511+
// click 事件的处理
512+
browser.fire(FrameEventName.NETWORK_CLICK,
513+
args instanceof CanvasRenderingContext2D ? { context2d: args } : args);
514+
}, 300);//延时300毫秒执行
515+
});
516+
517+
this._network.on('doubleClick', function (args) {
518+
if(browser.clickFlag) {//取消上次延时未执行的方法
519+
browser.clickFlag = clearTimeout(browser.clickFlag);
520+
}
521+
browser.fire(FrameEventName.NETWORK_DBLCLICK,
522+
args instanceof CanvasRenderingContext2D ? { context2d: args } : args);
523+
});
524+
}
525+
501526
private _bindNetworkEvent(networkEventName, frameEventName) {
502527
var browser: MainFrame = this;
503528
this._network.on(networkEventName, function (args) {
@@ -508,8 +533,8 @@ export abstract class MainFrame {
508533

509534
private _bindNetworkEvents() {
510535
var eventsMap = Utils.toMap({
511-
"click": FrameEventName.NETWORK_CLICK,
512-
"doubleClick": FrameEventName.NETWORK_DBLCLICK,
536+
// "click": FrameEventName.NETWORK_CLICK,
537+
// "doubleClick": FrameEventName.NETWORK_DBLCLICK,
513538
"oncontext": FrameEventName.NETWORK_ONCONTEXT,
514539
"beforeDrawing": FrameEventName.NETWORK_BEFORE_DRAWING,
515540
"afterDrawing": FrameEventName.NETWORK_AFTER_DRAWING,
@@ -523,6 +548,8 @@ export abstract class MainFrame {
523548
eventsMap.forEach((v, k, map) => {
524549
this._bindNetworkEvent(k, v);
525550
});
551+
552+
this._bindNetworkClick()
526553
}
527554

528555
private _createEventArgs(): EVENT_ARGS_FRAME {

src/test/webapp/example1.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
return description;
4949
}
5050
}, function () {});
51-
// app.connect("http://localhost:9999/graphserver/connector-bolt");
5251
</script>
5352
</body>
5453

src/test/webapp/example2.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
<div style="height:100%">
2828
<div id="graphArea"></div>
2929
</div>
30-
<!--all UI controls-->
31-
<div>
32-
</div>
3330
<script type="text/javascript">
3431
igraph.i18n.setLanguage("chs");
3532
var app = new igraph.GraphExplorer(document.getElementById('graphArea'),'LIGHT');

src/test/webapp/example3.html

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -27,51 +27,7 @@
2727
<div style="height:100%">
2828
<div id="graphArea"></div>
2929
</div>
30-
<!--all UI controls-->
31-
<div>
32-
<!--toolbar-->
33-
<div class="toolbarPanel igraph-dockable igraph-draggable" igraph-control-role="ToolbarCtrl" igraph-dock-position="B:-6,0">
34-
<div class="toolbar"></div>
35-
</div>
36-
<!--info box-->
37-
<div class="infoPanel igraph-dockable igraph-draggable" igraph-control-role="InfoBoxCtrl" igraph-dock-position="A:10,80">
38-
<div>
39-
<div class="infoPanel1"></div>
40-
<div class="infoPanel2"><span align="center" class="fa fa-close fa-lg btnCloseInfoPanel"></span></div>
41-
</div>
42-
<div class="infoBox"></div>
43-
</div>
44-
<!--relfinder-->
45-
<div class="relfinder-dlg igraph-dockable igraph-draggable" igraph-control-role="RelFinderDialogCtrl" igraph-dock-position="B:-6,45">
46-
<div class="line"><span class="fa relfinder-icon fa-flag"></span>
47-
<div class="relfinder-searchbox-container">
48-
<input class="igraph-searchbox" type="text" placeholder="input keyword">
49-
</div>
50-
</div>
51-
<div class="line"><span class="fa relfinder-icon fa-flag-checkered"></span>
52-
<div class="relfinder-searchbox-container">
53-
<input class="igraph-searchbox" type="text" placeholder="input keyword">
54-
</div>
55-
</div>
56-
<div class="line"><label>maxdepth: </label>
57-
<input size="10" autocomplete="off" readonly class="ui-spinner-input relfinder-depth-spinner">
58-
</div>
59-
<p align="center">
60-
<button type="button" class="btn relfinder-btn relfinder-btn-start">find relations</button>
61-
<button type="button" class="btn relfinder-btn relfinder-btn-stop" disabled="disabled">stop</button>
62-
</p>
63-
</div>
64-
<!--rel list-->
65-
<div class="rellistPanel igraph-dockable igraph-draggable" igraph-control-role="RelListCtrl"
66-
igraph-dock-position="B:-6,220">
67-
<p class="rellist-title">Relation Paths (<span class="relnum">11</span>):</p>
68-
<ul class="rellist"></ul>
69-
</div>
70-
<!--status bar-->
71-
<div class="statusPanel igraph-dockable" igraph-control-role="StatusBarCtrl" igraph-dock-position="C:-100,0">
72-
<div class="statusBar"></div>
73-
</div>
74-
</div>
30+
7531
<script type="text/javascript">
7632
igraph.i18n.setLanguage("chs");
7733
var app = new igraph.RelFinder(document.getElementById('graphArea'),'LIGHT');
@@ -82,7 +38,8 @@
8238
label: "薛蟠"
8339
}]);
8440
});
41+
8542
</script>
8643
</body>
8744

88-
</html>
45+
</html>

0 commit comments

Comments
 (0)