Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
todomvc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sven Franck
todomvc
Commits
e8f8532b
Commit
e8f8532b
authored
Mar 20, 2014
by
Pascal Hartig
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #881 from dprotti/gwtusesetdisplay
gwt - improvement: use setDisplay()
parents
938e3b56
4cc496fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
architecture-examples/gwt/src/com/todo/client/ToDoView.java
architecture-examples/gwt/src/com/todo/client/ToDoView.java
+7
-6
No files found.
architecture-examples/gwt/src/com/todo/client/ToDoView.java
View file @
e8f8532b
...
...
@@ -4,6 +4,7 @@ import com.google.gwt.core.client.GWT;
import
com.google.gwt.dom.client.Element
;
import
com.google.gwt.dom.client.InputElement
;
import
com.google.gwt.dom.client.SpanElement
;
import
com.google.gwt.dom.client.Style.Display
;
import
com.google.gwt.event.dom.client.ClickEvent
;
import
com.google.gwt.event.dom.client.ClickHandler
;
import
com.google.gwt.event.dom.client.KeyCodes
;
...
...
@@ -142,9 +143,9 @@ public class ToDoView extends Composite implements ToDoPresenter.View {
public
void
setTaskStatistics
(
int
totalTasks
,
int
completedTasks
)
{
int
remainingTasks
=
totalTasks
-
completedTasks
;
hideElement
(
mainSection
,
totalTasks
==
0
);
hideElement
(
todoStatsContainer
,
totalTasks
==
0
);
hideElement
(
clearCompleted
.
getElement
(),
completedTasks
==
0
);
displayOrHide
(
mainSection
,
totalTasks
==
0
);
displayOrHide
(
todoStatsContainer
,
totalTasks
==
0
);
displayOrHide
(
clearCompleted
.
getElement
(),
completedTasks
==
0
);
remainingTasksCount
.
setInnerText
(
Integer
.
toString
(
remainingTasks
));
remainingTasksLabel
.
setInnerText
(
remainingTasks
>
1
||
remainingTasks
==
0
?
"items"
:
"item"
);
...
...
@@ -169,11 +170,11 @@ public class ToDoView extends Composite implements ToDoPresenter.View {
}
}
private
void
hideElement
(
Element
element
,
boolean
hide
)
{
private
void
displayOrHide
(
Element
element
,
boolean
hide
)
{
if
(
hide
)
{
element
.
setAttribute
(
"style"
,
"display:none;"
);
element
.
getStyle
().
setDisplay
(
Display
.
NONE
);
}
else
{
element
.
setAttribute
(
"style"
,
"display:block;"
);
element
.
getStyle
().
setDisplay
(
Display
.
BLOCK
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment