Skip to content

Commit a9affe1

Browse files
author
Open Lowcode SAS
committed
Close #189
1 parent f789a70 commit a9affe1

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

src/org/openlowcode/client/runtime/ClientDisplay.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ public void changed(
376376
ObservableValue<? extends Number> observable,
377377
Number oldvalue,
378378
Number newvalue) {
379-
if (contentholderverticalscrollbar.isVisible()) {
379+
if (contentholderverticalscrollbar!=null) if (contentholderverticalscrollbar.isVisible()) {
380380
backgroundpane.setPrefWidth(
381381
newvalue.doubleValue() - 2 - contentholderverticalscrollbar.getWidth());
382382
} else {
@@ -394,7 +394,7 @@ public void changed(
394394
ObservableValue<? extends Number> observable,
395395
Number oldvalue,
396396
Number newvalue) {
397-
if (contentholderhorizontalscrollbar.isVisible()) {
397+
if (contentholderhorizontalscrollbar!=null) if (contentholderhorizontalscrollbar.isVisible()) {
398398
backgroundpane.setPrefHeight(
399399
newvalue.doubleValue() - 2 - contentholderhorizontalscrollbar.getHeight());
400400

src/org/openlowcode/client/runtime/ClientSession.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
import javafx.beans.value.ChangeListener;
3333
import javafx.beans.value.ObservableValue;
34+
import javafx.collections.ListChangeListener;
3435
import javafx.collections.ObservableList;
3536
import javafx.event.EventHandler;
3637
import javafx.event.Event;
@@ -115,7 +116,7 @@ public void setTitle(String newtitle, String otpstatus) {
115116
logger.warning(" --- ---- Starting setting title ");
116117
Tab tab = this.tabpane.getTabs().get(activedisplayindex);
117118
if (otpstatus.equals("NONE")) {
118-
tab.setText((newtitle.length() > 20 ? newtitle.substring(0, 20) + "..." : newtitle));
119+
tab.setText(newtitle);
119120
tab.setTooltip(new Tooltip(newtitle));
120121
return;
121122
}
@@ -148,6 +149,7 @@ public void handle(MouseEvent event) {
148149
BorderPane.setAlignment(dot, Pos.CENTER);
149150
tab.setText("");
150151
tab.setGraphic(borderpane);
152+
tab.setTooltip(new Tooltip(newtitle));
151153
}
152154

153155
/**
@@ -202,6 +204,24 @@ private void setupDisplay(ClientDisplay clientdisplay) {
202204
// initiates the tabpane if called for the first time
203205
if (this.tabpane == null) {
204206
this.tabpane = new TabPane();
207+
this.tabpane.getTabs().addListener(new ListChangeListener<Tab>() {
208+
209+
@Override
210+
public void onChanged(@SuppressWarnings("rawtypes") Change change) {
211+
TabPane localtabpane = tabpane;
212+
double tabpanewidth = localtabpane.getWidth()*0.9f;
213+
if (tabpanewidth<10) tabpanewidth=1000;
214+
int tabnumber = localtabpane.getTabs().size();
215+
if (tabnumber==0) tabnumber=1;
216+
double maxtabwidth = tabpanewidth/tabnumber;
217+
if (maxtabwidth<90) maxtabwidth=90;
218+
localtabpane.setTabMaxWidth(maxtabwidth);
219+
220+
221+
}
222+
223+
224+
});
205225
this.tabpane.setBackground(new Background(new BackgroundFill(Color.WHITE, null, null)));
206226
this.tabpane.setTabClosingPolicy(TabPane.TabClosingPolicy.ALL_TABS);
207227
this.tabpane.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {

0 commit comments

Comments
 (0)