Skip to content

Commit e83c7ff

Browse files
committed
Added omero server address in settings window
1 parent a6c54d8 commit e83c7ff

File tree

5 files changed

+36
-5
lines changed

5 files changed

+36
-5
lines changed

src/main/java/qupath/ext/omero/core/pixelapis/ice/IceAPI.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package qupath.ext.omero.core.pixelapis.ice;
22

33
import com.drew.lang.annotations.Nullable;
4-
import javafx.beans.property.SimpleBooleanProperty;
5-
import javafx.beans.property.SimpleStringProperty;
6-
import javafx.beans.property.StringProperty;
4+
import javafx.beans.property.*;
75
import javafx.beans.value.ObservableBooleanValue;
86
import org.slf4j.Logger;
97
import org.slf4j.LoggerFactory;
@@ -132,6 +130,14 @@ public String toString() {
132130
return String.format("Ice API of %s", apisHandler.getWebServerURI());
133131
}
134132

133+
/**
134+
* @return the address used to communicate with the OMERO server.
135+
* This property may be updated from any thread
136+
*/
137+
public ReadOnlyStringProperty getServerAddress() {
138+
return serverAddress;
139+
}
140+
135141
/**
136142
* Set the address used to communicate with the OMERO server.
137143
*

src/main/java/qupath/ext/omero/gui/browser/serverbrowser/settings/Settings.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import org.slf4j.Logger;
1010
import org.slf4j.LoggerFactory;
1111
import qupath.ext.omero.core.WebClient;
12+
import qupath.ext.omero.core.pixelapis.ice.IceAPI;
1213
import qupath.ext.omero.core.pixelapis.mspixelbuffer.MsPixelBufferAPI;
1314
import qupath.ext.omero.core.pixelapis.web.WebAPI;
1415
import qupath.ext.omero.gui.UiUtilities;
@@ -27,10 +28,13 @@ public class Settings extends Stage {
2728
private static final ResourceBundle resources = UiUtilities.getResources();
2829
private final MsPixelBufferAPI msPixelBufferAPI;
2930
private final WebAPI webAPI;
31+
private final IceAPI iceAPI;
3032
@FXML
3133
private TextField msPixelBufferAPIPort;
3234
@FXML
3335
private TextField webJpegQuality;
36+
@FXML
37+
private TextField omeroAddress;
3438

3539
/**
3640
* Creates the settings window.
@@ -42,6 +46,7 @@ public class Settings extends Stage {
4246
public Settings(Stage ownerWindow, WebClient client) throws IOException {
4347
this.msPixelBufferAPI = client.getPixelAPI(MsPixelBufferAPI.class);
4448
this.webAPI = client.getPixelAPI(WebAPI.class);
49+
this.iceAPI = client.getPixelAPI(IceAPI.class);
4550

4651
initUI(ownerWindow);
4752
setUpListeners();
@@ -67,7 +72,6 @@ private void onApplyClicked(ActionEvent ignoredEvent) {
6772
private void initUI(Stage ownerWindow) throws IOException {
6873
UiUtilities.loadFXML(this, Settings.class.getResource("settings.fxml"));
6974

70-
7175
TextFormatter<String> integerFormatter = new TextFormatter<>(change ->
7276
Pattern.matches("^\\d*$", change.getControlNewText()) ? change : null
7377
);
@@ -80,6 +84,7 @@ private void initUI(Stage ownerWindow) throws IOException {
8084

8185
msPixelBufferAPIPort.setText(String.valueOf(msPixelBufferAPI.getPort().get()));
8286
webJpegQuality.setText(String.valueOf(webAPI.getJpegQuality().get()));
87+
omeroAddress.setText(iceAPI.getServerAddress().get());
8388

8489
initOwner(ownerWindow);
8590
show();
@@ -92,16 +97,21 @@ private void setUpListeners() {
9297
webAPI.getJpegQuality().addListener((p, o, n) -> Platform.runLater(() ->
9398
webJpegQuality.setText(String.valueOf(n))
9499
));
100+
iceAPI.getServerAddress().addListener((p, o, n) -> Platform.runLater(() ->
101+
omeroAddress.setText(n)
102+
));
95103
}
96104

97105
private boolean save() {
98106
try {
99107
msPixelBufferAPI.setPort(Integer.parseInt(msPixelBufferAPIPort.getText()), false);
100108
webAPI.setJpegQuality(Float.parseFloat(webJpegQuality.getText()));
109+
iceAPI.setServerAddress(omeroAddress.getText());
101110

102111
// Reset the texts, as the user input may have had incorrect values and been ignored
103112
msPixelBufferAPIPort.setText(String.valueOf(msPixelBufferAPI.getPort().get()));
104113
webJpegQuality.setText(String.valueOf(webAPI.getJpegQuality().get()));
114+
omeroAddress.setText(iceAPI.getServerAddress().get());
105115

106116
Dialogs.showInfoNotification(
107117
resources.getString("Browser.ServerBrowser.Settings.saved"),

src/main/resources/qupath/ext/omero/gui/browser/serverbrowser/settings/settings.fxml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<rowConstraints>
2424
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
2525
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
26+
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
2627
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
2728
</rowConstraints>
2829
<padding>
@@ -48,7 +49,17 @@
4849
<Tooltip text="%Browser.ServerBrowser.Settings.webJpegQualityDescription" />
4950
</tooltip>
5051
</TextField>
51-
<HBox alignment="CENTER_RIGHT" spacing="10.0" GridPane.columnSpan="2147483647" GridPane.rowIndex="2">
52+
<Label text="%Browser.ServerBrowser.Settings.omeroServerAddress" GridPane.rowIndex="2">
53+
<tooltip>
54+
<Tooltip text="%Browser.ServerBrowser.Settings.omeroServerAddressDescription" />
55+
</tooltip>
56+
</Label>
57+
<TextField fx:id="omeroAddress" GridPane.columnIndex="1" GridPane.rowIndex="2">
58+
<tooltip>
59+
<Tooltip text="%Browser.ServerBrowser.Settings.omeroServerAddressDescription" />
60+
</tooltip>
61+
</TextField>
62+
<HBox alignment="CENTER_RIGHT" spacing="10.0" GridPane.columnSpan="2147483647" GridPane.rowIndex="3">
5263
<Button mnemonicParsing="false" onAction="#onOKClicked" text="%Browser.ServerBrowser.Settings.ok" />
5364
<Button mnemonicParsing="false" onAction="#onCancelClicked" text="%Browser.ServerBrowser.Settings.cancel" />
5465
<Button mnemonicParsing="false" onAction="#onApplyClicked" text="%Browser.ServerBrowser.Settings.apply" />

src/main/resources/qupath/ext/omero/strings.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ Browser.ServerBrowser.Settings.mxPixelBufferAPIPort = Pixel Buffer microservice
154154
Browser.ServerBrowser.Settings.mxPixelBufferAPIPortDescription = The OMERO server port used by the pixel buffer microservice (default: 8082).
155155
Browser.ServerBrowser.Settings.webJpegQuality = Web pixel API JPEG quality
156156
Browser.ServerBrowser.Settings.webJpegQualityDescription = The JPEG quality used by the Web pixel API (from 0 to 1, default: 0.9).
157+
Browser.ServerBrowser.Settings.omeroServerAddress = OMERO (ICE) server address
158+
Browser.ServerBrowser.Settings.omeroServerAddressDescription = The address of the omero.server (ICE) instance (which can be different from the omero.web instance). This parameter should only be specified if importing an image with the Ice API doesn't work.
157159
Browser.ServerBrowser.Settings.ok = OK
158160
Browser.ServerBrowser.Settings.cancel = Cancel
159161
Browser.ServerBrowser.Settings.apply = Apply

src/main/resources/qupath/ext/omero/strings_fr.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ Browser.ServerBrowser.Settings.mxPixelBufferAPIPort = Ms Pixel Buffer API port
154154
Browser.ServerBrowser.Settings.mxPixelBufferAPIPortDescription = Le port du serveur OMERO utilisé par le microservice Pixel Buffer (8082 par défaut).
155155
Browser.ServerBrowser.Settings.webJpegQuality = Qualité JPEG de la Web pixel API
156156
Browser.ServerBrowser.Settings.webJpegQualityDescription = La qualité JPEG utilisée par la Web pixel API (de 0 à 1, 0.9 par défaut).
157+
Browser.ServerBrowser.Settings.omeroServerAddress = Adresse du serveur OMERO (ICE)
158+
Browser.ServerBrowser.Settings.omeroServerAddressDescription = L'adresse de l'instance omero.server (ICE) (qui peut être différente de l'instance omero.web). Ce paramètre ne doit être spécifié que si l'importation d'une image avec l'Ice API ne fonctionne pas.
157159
Browser.ServerBrowser.Settings.ok = OK
158160
Browser.ServerBrowser.Settings.cancel = Annuler
159161
Browser.ServerBrowser.Settings.apply = Appliquer

0 commit comments

Comments
 (0)