1 |
|
package org.kuali.student.lum.common.client.lo; |
2 |
|
|
3 |
|
import com.google.gwt.event.dom.client.ClickEvent; |
4 |
|
import com.google.gwt.event.dom.client.ClickHandler; |
5 |
|
import com.google.gwt.user.client.Event; |
6 |
|
import com.google.gwt.user.client.ui.Button; |
7 |
|
import com.google.gwt.user.client.ui.HorizontalPanel; |
8 |
|
|
9 |
|
|
10 |
|
@author |
11 |
|
|
|
|
| 0% |
Uncovered Elements: 94 (94) |
Complexity: 15 |
Complexity Density: 0.2 |
|
12 |
|
class OutlineManagerToolbar extends HorizontalPanel { |
13 |
|
Button moveUpButton = new Button(); |
14 |
|
|
15 |
|
Button moveDownButton = new Button(); |
16 |
|
|
17 |
|
Button indentButton = new Button(); |
18 |
|
|
19 |
|
Button outdentButton = new Button(); |
20 |
|
|
21 |
|
Button deleteButton = new Button(); |
22 |
|
|
23 |
|
|
24 |
|
Button addPeerButton = new Button(); |
25 |
|
|
26 |
|
Button addChildButton = new Button(); |
27 |
|
|
28 |
|
OutlineNodeModel outlineModel; |
29 |
|
|
|
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 1 |
Complexity Density: 0.03 |
|
30 |
0
|
OutlineManagerToolbar() {... |
31 |
|
|
32 |
0
|
HorizontalPanel buttonPanel = new HorizontalPanel(); |
33 |
|
|
34 |
0
|
this.setStyleName("KS-LOOutlineManagerToolbar"); |
35 |
0
|
super.add(buttonPanel); |
36 |
0
|
buttonPanel.add(moveUpButton); |
37 |
0
|
buttonPanel.add(moveDownButton); |
38 |
0
|
buttonPanel.add(indentButton); |
39 |
0
|
buttonPanel.add(outdentButton); |
40 |
0
|
buttonPanel.add(deleteButton); |
41 |
0
|
buttonPanel.addStyleName("KS-LOButtonPanel"); |
42 |
|
|
43 |
0
|
sinkEvents(Event.ONMOUSEMOVE); |
44 |
0
|
sinkEvents(Event.ONMOUSEOUT); |
45 |
|
|
46 |
0
|
moveUpButton.sinkEvents(Event.ONMOUSEMOVE); |
47 |
0
|
moveUpButton.sinkEvents(Event.ONMOUSEOUT); |
48 |
0
|
moveUpButton.setTitle("Move learning objective up"); |
49 |
0
|
moveUpButton.addStyleName("KS-LOMoveUpButton"); |
50 |
0
|
moveDownButton.addStyleName("KS-LOMoveDownButton"); |
51 |
0
|
moveDownButton.setTitle("Move learning objective down"); |
52 |
0
|
deleteButton.setText("Delete"); |
53 |
0
|
deleteButton.setTitle("Delete"); |
54 |
0
|
deleteButton.addStyleName("KS-LODeleteButton"); |
55 |
0
|
indentButton.addStyleName("KS-LOIndentButton"); |
56 |
0
|
indentButton.setTitle("Indent learning objective"); |
57 |
0
|
outdentButton.addStyleName("KS-LOOutdentButton"); |
58 |
0
|
outdentButton.setTitle("Outdent learning objective"); |
59 |
|
|
60 |
0
|
moveUpButton.addClickHandler(new ClickHandler() { |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
61 |
0
|
public void onClick(ClickEvent event) {... |
62 |
0
|
outlineModel.moveUpCurrent(); |
63 |
|
|
64 |
|
} |
65 |
|
}); |
66 |
0
|
moveDownButton.addClickHandler(new ClickHandler() { |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
67 |
0
|
public void onClick(ClickEvent event) {... |
68 |
0
|
outlineModel.moveDownCurrent(); |
69 |
|
} |
70 |
|
}); |
71 |
0
|
indentButton.addClickHandler(new ClickHandler() { |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
72 |
0
|
public void onClick(ClickEvent event) {... |
73 |
0
|
outlineModel.indentCurrent(); |
74 |
|
} |
75 |
|
}); |
76 |
0
|
outdentButton.addClickHandler(new ClickHandler() { |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
77 |
0
|
public void onClick(ClickEvent event) {... |
78 |
0
|
outlineModel.outdentCurrent(); |
79 |
|
} |
80 |
|
}); |
81 |
0
|
deleteButton.addClickHandler(new ClickHandler() { |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
82 |
0
|
public void onClick(ClickEvent event) {... |
83 |
0
|
outlineModel.deleteCurrent(); |
84 |
|
} |
85 |
|
}); |
86 |
0
|
addPeerButton.addClickHandler(new ClickHandler() { |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
87 |
0
|
public void onClick(ClickEvent event) {... |
88 |
0
|
outlineModel.addPeer(); |
89 |
|
} |
90 |
|
}); |
91 |
0
|
addChildButton.addClickHandler(new ClickHandler() { |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
92 |
0
|
public void onClick(ClickEvent event) {... |
93 |
0
|
outlineModel.addChild(); |
94 |
|
} |
95 |
|
}); |
96 |
|
} |
97 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
98 |
0
|
public void setModel(OutlineNodeModel model) {... |
99 |
0
|
outlineModel = model; |
100 |
|
} |
101 |
|
|
|
|
| 0% |
Uncovered Elements: 45 (45) |
Complexity: 6 |
Complexity Density: 0.17 |
|
102 |
0
|
public void updateButtonStates() {... |
103 |
0
|
if( this.outlineModel.isMoveUpable()){ |
104 |
0
|
moveUpButton.setEnabled(true); |
105 |
0
|
moveUpButton.removeStyleName("KS-LOMoveUpButtonDisabled"); |
106 |
0
|
moveUpButton.addStyleName("KS-LOMoveUpButton"); |
107 |
|
}else{ |
108 |
0
|
moveUpButton.setEnabled(false); |
109 |
0
|
moveUpButton.removeStyleName("KS-LOMoveUpButton"); |
110 |
0
|
moveUpButton.addStyleName("KS-LOMoveUpButtonDisabled"); |
111 |
|
} |
112 |
0
|
if(this.outlineModel.isDeletable()){ |
113 |
0
|
deleteButton.setEnabled(true); |
114 |
0
|
deleteButton.removeStyleName("KS-LODeleteButtonDisabled"); |
115 |
0
|
deleteButton.addStyleName("KS-LODeleteButton"); |
116 |
|
} else{ |
117 |
0
|
deleteButton.setEnabled(false); |
118 |
0
|
deleteButton.removeStyleName("KS-LODeleteButton"); |
119 |
0
|
deleteButton.addStyleName("KS-LODeleteButtonDisabled"); |
120 |
|
} |
121 |
0
|
if(this.outlineModel.isIndentable()){ |
122 |
0
|
indentButton.setEnabled(true); |
123 |
0
|
indentButton.removeStyleName("KS-LOIndentButtonDisabled"); |
124 |
0
|
indentButton.addStyleName("KS-LOIndentButton"); |
125 |
|
}else{ |
126 |
0
|
indentButton.setEnabled(false); |
127 |
0
|
indentButton.removeStyleName("KS-LOIndentButton"); |
128 |
0
|
indentButton.addStyleName("KS-LOIndentButtonDisabled"); |
129 |
|
} |
130 |
0
|
if(this.outlineModel.isMoveDownable()){ |
131 |
0
|
moveDownButton.setEnabled(true); |
132 |
0
|
moveDownButton.removeStyleName("KS-LOMoveDownButtonDisabled"); |
133 |
0
|
moveDownButton.addStyleName("KS-LOMoveDownButton"); |
134 |
|
}else{ |
135 |
0
|
moveDownButton.setEnabled(false); |
136 |
0
|
moveDownButton.removeStyleName("KS-LOMoveDownButton"); |
137 |
0
|
moveDownButton.addStyleName("KS-LOMoveDownButtonDisabled"); |
138 |
|
} |
139 |
0
|
if(this.outlineModel.isOutdentable()){ |
140 |
0
|
outdentButton.setEnabled(true); |
141 |
0
|
outdentButton.removeStyleName("KS-LOOutdentButtonDisabled"); |
142 |
0
|
outdentButton.addStyleName("KS-LOOutdentButton"); |
143 |
|
}else{ |
144 |
0
|
outdentButton.setEnabled(false); |
145 |
0
|
outdentButton.removeStyleName("KS-LOOutdentButton"); |
146 |
0
|
outdentButton.addStyleName("KS-LOOutdentButtonDisabled"); |
147 |
|
} |
148 |
|
} |
149 |
|
} |