Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hpc-workflow-manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FIJI
hpc-workflow-manager
Merge requests
!10
Jfxrefactoring
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Jfxrefactoring
jfxrefactoring
into
master
Overview
12
Commits
10
Pipelines
0
Changes
22
All threads resolved!
Show all comments
Merged
Jan Kožusznik
requested to merge
jfxrefactoring
into
master
7 years ago
Overview
12
Commits
10
Pipelines
0
Changes
22
All threads resolved!
Show all comments
Expand
I have done some refactoring in UI
0
0
Merge request reports
Compare
master
version 2
2746adde
7 years ago
version 1
4e62addf
7 years ago
master (base)
and
version 2
latest version
f4d87fa5
10 commits,
7 years ago
version 2
2746adde
8 commits,
7 years ago
version 1
4e62addf
7 commits,
7 years ago
22 files
+
783
−
236
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
22
Search (e.g. *.vue) (Ctrl+P)
haas-imagej-client/src/main/java/cz/it4i/fiji/haas/ui/CloseableControl.java
0 → 100644
+
83
−
0
Options
package
cz.it4i.fiji.haas.ui
;
import
java.io.Closeable
;
import
java.io.IOException
;
import
java.util.concurrent.Callable
;
import
java.util.concurrent.Executor
;
import
java.util.function.Consumer
;
import
java.util.function.Function
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
javafx.application.Platform
;
import
javafx.beans.value.ObservableValue
;
import
javafx.fxml.FXMLLoader
;
import
javafx.scene.Parent
;
import
javafx.scene.control.TableColumn
;
import
javafx.scene.control.TableView
;
public
interface
CloseableControl
extends
Closeable
{
public
static
Logger
log
=
LoggerFactory
.
getLogger
(
cz
.
it4i
.
fiji
.
haas
.
ui
.
CloseableControl
.
class
);
@Override
void
close
();
static
void
initRootAndController
(
String
string
,
Parent
parent
)
{
FXMLLoader
fxmlLoader
=
new
FXMLLoader
(
parent
.
getClass
().
getResource
(
string
));
fxmlLoader
.
setControllerFactory
(
c
->
{
try
{
if
(
c
.
equals
(
parent
.
getClass
()))
{
return
parent
;
}
else
{
return
c
.
newInstance
();
}
}
catch
(
InstantiationException
|
IllegalAccessException
e
)
{
throw
new
RuntimeException
(
e
);
}
});
fxmlLoader
.
setRoot
(
parent
);
Object
explicitController
=
null
;
do
{
fxmlLoader
.
setController
(
explicitController
);
try
{
fxmlLoader
.
load
();
}
catch
(
IOException
exception
)
{
throw
new
RuntimeException
(
exception
);
}
if
(
fxmlLoader
.
getController
()
==
null
)
{
explicitController
=
parent
;
}
}
while
(
fxmlLoader
.
getController
()
==
null
);
}
static
public
<
V
>
void
executeAsync
(
Executor
executor
,
Callable
<
V
>
action
,
Consumer
<
V
>
postAction
)
{
executor
.
execute
(()
->
{
V
result
;
try
{
result
=
action
.
call
();
postAction
.
accept
(
result
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
});
}
static
public
void
runOnFxThread
(
Runnable
runnable
)
{
if
(
Platform
.
isFxApplicationThread
())
{
runnable
.
run
();
}
else
{
Platform
.
runLater
(
runnable
);
}
}
@SuppressWarnings
(
"unchecked"
)
static
public
<
U
,
T
extends
ObservableValue
<
U
>,
V
>
void
setCellValueFactory
(
TableView
<
T
>
tableView
,
int
index
,
Function
<
U
,
V
>
mapper
)
{
((
TableColumn
<
T
,
V
>)
tableView
.
getColumns
().
get
(
index
))
.
setCellValueFactory
(
f
->
new
ObservableValueAdapter
<
U
,
V
>(
f
.
getValue
(),
mapper
));
}
}
Loading