Skip to content

Commit a580a43

Browse files
authored
Merge branch 'master' into markdown-properties-docs
2 parents 65b36cb + f4730be commit a580a43

File tree

56 files changed

+5361
-159
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+5361
-159
lines changed

app/display/editor/src/main/java/org/csstudio/display/builder/editor/actions/ActionDescription.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ public void run(final DisplayEditor editor, final boolean selected)
506506
.mapToInt(w -> w.propWidth().getValue())
507507
.sum();
508508

509-
final int offset = ( max - min - totalWidth ) / ( N - 1 );
509+
final double offset = (double) (max - min - totalWidth) / (double) (N - 1);
510510
final List<Widget> sortedWidgets = widgets.stream()
511511
.sorted(( w1, w2 ) ->
512512
{
@@ -550,15 +550,15 @@ else if ( w1x >= w2x && w1x + w1w >= w2x + w2w )
550550
// Equal gap distribution...
551551
// ------------------------------------------------------------
552552
Widget widget = sortedWidgets.get(0);
553-
int location = widget.propX().getValue();
553+
double location = (double) widget.propX().getValue();
554554
int width = widget.propWidth().getValue();
555555

556556
for ( int i = 1; i < N - 1; i++ )
557557
{
558558
widget = sortedWidgets.get(i);
559559
location += width + offset;
560560

561-
undo.execute(new SetWidgetPropertyAction<>(widget.propX(), location));
561+
undo.execute(new SetWidgetPropertyAction<>(widget.propX(), (int) Math.round(location)));
562562

563563
width = widget.propWidth().getValue();
564564
}
@@ -575,20 +575,20 @@ else if ( offset < 0 )
575575
int location = widget.propX().getValue();
576576
int width = widget.propWidth().getValue();
577577

578-
final int rightCenter = location + width / 2;
578+
final double rightCenter = (double) location + (double) width / 2.0;
579579

580580
widget = sortedWidgets.get(0);
581581
location = widget.propX().getValue();
582582
width = widget.propWidth().getValue();
583583

584584
final int leftCenter = location + width / 2;
585-
final int coffset = ( rightCenter - leftCenter ) / ( N - 1 );
585+
final double coffset = (rightCenter - (double) leftCenter) / (double) (N - 1);
586586

587587
for ( int i = 1; i < N - 1; i++ )
588588
{
589589
widget = sortedWidgets.get(i);
590590
width = widget.propWidth().getValue();
591-
undo.execute(new SetWidgetPropertyAction<>(widget.propX(), ( leftCenter + i * coffset ) - width / 2));
591+
undo.execute(new SetWidgetPropertyAction<>(widget.propX(), (int) Math.round((leftCenter + (double) i * coffset - (double) width / 2.0))));
592592
}
593593
}
594594
}
@@ -620,7 +620,7 @@ public void run(final DisplayEditor editor, final boolean selected)
620620
.mapToInt(w -> w.propHeight().getValue())
621621
.sum();
622622

623-
final int offset = ( max - min - totalHeight ) / ( N - 1 );
623+
final double offset = (double) (max - min - totalHeight ) / (double) (N - 1);
624624
final List<Widget> sortedWidgets = widgets.stream()
625625
.sorted(( w1, w2 ) ->
626626
{
@@ -680,14 +680,14 @@ else if ( w1y >= w2y && w1y + w1h >= w2y + w2h )
680680
// Equal gap distribution...
681681
// ------------------------------------------------------------
682682
Widget widget = sortedWidgets.get(0);
683-
int location = widget.propY().getValue();
683+
double location = widget.propY().getValue();
684684
int height = widget.propHeight().getValue();
685685

686686
for ( int i = 1; i < N - 1; i++ )
687687
{
688688
widget = sortedWidgets.get(i);
689689
location += height + offset;
690-
undo.execute(new SetWidgetPropertyAction<>(widget.propY(), location));
690+
undo.execute(new SetWidgetPropertyAction<>(widget.propY(), (int) Math.round(location)));
691691
height = widget.propHeight().getValue();
692692
}
693693
}
@@ -703,19 +703,19 @@ else if ( offset < 0 )
703703
int location = widget.propY().getValue();
704704
int height = widget.propHeight().getValue();
705705

706-
final int bottomCenter = location + height / 2;
706+
final double bottomCenter = (double) location + (double) height / 2.0;
707707

708708
widget = sortedWidgets.get(0);
709709
location = widget.propY().getValue();
710710
height = widget.propHeight().getValue();
711711

712-
final int topCenter = location + height / 2;
713-
final int coffset = ( bottomCenter - topCenter ) / ( N - 1 );
712+
final double topCenter = (double) location + (double) height / 2.0;
713+
final double coffset = (bottomCenter - topCenter) / (double) (N - 1);
714714
for ( int i = 1; i < N - 1; i++ )
715715
{
716716
widget = sortedWidgets.get(i);
717717
height = widget.propHeight().getValue();
718-
undo.execute(new SetWidgetPropertyAction<>(widget.propY(), ( topCenter + i * coffset ) - height / 2));
718+
undo.execute(new SetWidgetPropertyAction<>(widget.propY(), (int) Math.round((topCenter + (double) i * coffset - (double) height / 2.0))));
719719
}
720720
}
721721
}

app/display/model/src/main/resources/display_model_preferences.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,4 @@ enable_saved_on_comments=false
107107
# increase in memory consumption. E.g., by setting the SVG rendering resolution factor to 2.0, an
108108
# SVG can be rendered at twice the width and twice the height, but the memory required to
109109
# represent the image grows by a factor of four.
110-
org.csstudio.display.builder.model/enable_svg_rendering_resolution_factor=false
110+
enable_svg_rendering_resolution_factor=false

app/display/model/src/main/resources/org/csstudio/display/builder/model/messages.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ GroupWidget_Description=Group of widgets
4141
GroupWidget_Name=Group
4242
HighlightActiveRegion=Highlight Active Region
4343
InformativeTooltipActions=Actions to execute when the widget is clicked on.
44-
InformativeTooltopAlarmBorder=Should an alarm border be shown around the widget when the displayed PV signals an alarm?
44+
InformativeTooltipAlarmBorder=Should an alarm border be shown around the widget when the displayed PV signals an alarm?
4545
InformativeTooltipHeight=The height of the widget in pixels.
4646
InformativeTooltipName=The name of the widget.
47-
InformativTooltipPVName=The name of the PV to connect to and to display in the widget.
47+
InformativeTooltipPVName=The name of the PV to connect to and to display in the widget.
4848
InformativeTooltipRules=Rules associated with the widget.
4949
InformativeTooltipScripts=Scripts associated with the widget.
5050
InformativeTooltipTooltip=Text to display in the tooltip of the widget when hovering with the mouse over the widget.

app/display/representation-javafx/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@
2020
<version>1.3</version>
2121
<scope>test</scope>
2222
</dependency>
23-
<dependency>
24-
<groupId>org.apache.commons</groupId>
25-
<artifactId>commons-lang3</artifactId>
26-
<version>3.5</version>
27-
</dependency>
2823
<dependency>
2924
<groupId>org.controlsfx</groupId>
3025
<artifactId>controlsfx</artifactId>

app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXRepresentation.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ else if (scrollBar.isVisible() && scrollBar.getOrientation() == Orientation.VERT
516516
// correct width/height properties.
517517
final double zoomXWithoutScrollbars, zoomYWithoutScrollbars;
518518
final double zoomXWithScrollbars, zoomYWithScrollbars;
519-
if (outline.getWidth() > layoutBoundsWithScrollbars.getWidth()) {
519+
if (outline.getWidth() > layoutBoundsWithoutScrollbars.getWidth()) {
520520
zoomXWithoutScrollbars = layoutBoundsWithoutScrollbars.getWidth() / outline.getWidth();
521521
zoomXWithScrollbars = layoutBoundsWithScrollbars.getWidth() / outline.getWidth();
522522
}
@@ -529,7 +529,7 @@ else if (model.propWidth().getValue() > 0) {
529529
zoomXWithScrollbars = 1.0;
530530
}
531531

532-
if (outline.getHeight() > layoutBoundsWithScrollbars.getHeight()) {
532+
if (outline.getHeight() > layoutBoundsWithoutScrollbars.getHeight()) {
533533
zoomYWithoutScrollbars = layoutBoundsWithoutScrollbars.getHeight() / outline.getHeight();
534534
zoomYWithScrollbars = layoutBoundsWithScrollbars.getHeight() / outline.getHeight();
535535
}

app/logbook/olog/client-es/src/main/java/org/phoebus/olog/es/api/OlogHttpClient.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,14 @@ private SearchResult findLogs(MultivaluedMap<String, String> searchParams) throw
260260
.build();
261261
try {
262262
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
263-
OlogSearchResult searchResult = OlogObjectMappers.logEntryDeserializer.readValue(response.body(), OlogSearchResult.class);
264-
return SearchResult.of(new ArrayList<>(searchResult.getLogs()),
265-
searchResult.getHitCount());
263+
if(response.statusCode() == 200) {
264+
OlogSearchResult searchResult = OlogObjectMappers.logEntryDeserializer.readValue(response.body(), OlogSearchResult.class);
265+
return SearchResult.of(new ArrayList<>(searchResult.getLogs()),
266+
searchResult.getHitCount());
267+
}
268+
else{
269+
throw new RuntimeException(response.body());
270+
}
266271
} catch (Exception e) {
267272
LOGGER.log(Level.WARNING, "failed to retrieve log entries", e);
268273
throw new RuntimeException(e);

app/logbook/olog/ui/doc/index.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ Features
2222

2323
- Log entry viewers offer search capabilities based on meta data and content.
2424

25+
Missing features
26+
----------------
27+
In contrast to other markup implementations, HTML tags are **not** supported. Any such tags entered by user will
28+
be rendered as plain text.
29+
30+
2531
Launching the log entry editor
2632
------------------------------
2733

app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/HtmlAwareController.java

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,38 @@
2929

3030
public class HtmlAwareController {
3131

32-
private Parser parser;
33-
private HtmlRenderer htmlRenderer;
32+
private final Parser parser;
33+
private final HtmlRenderer htmlRenderer;
3434

35+
/**
36+
* Constructor to generate html code for HTML preview feature in LogEntryEditor or detailed log entry view.
37+
* @param serviceUrl Olog service url
38+
*/
3539
public HtmlAwareController(String serviceUrl){
36-
List<Extension> extensions =
37-
Arrays.asList(TablesExtension.create(), ImageAttributesExtension.create());
38-
this.parser = Parser.builder().extensions(extensions).build();
39-
htmlRenderer = HtmlRenderer.builder()
40-
.attributeProviderFactory(context -> new OlogAttributeProvider(serviceUrl))
41-
.extensions(extensions).build();
40+
this(new OlogAttributeProvider(serviceUrl));
4241
}
4342

4443
/**
45-
* To create HtmlAwareController object to generate html code for HTML preview feature in LogEntryEditor.
44+
* Constructor to generate html code for HTML preview feature in LogEntryEditor or detailed log entry view.
4645
* @param serviceUrl Olog service url.
4746
* @param preview Set true when preview button is clicked.
4847
* @param attachments The current attachments list from AttachmentsEditorController.
4948
*/
5049
public HtmlAwareController(String serviceUrl, boolean preview, List<Attachment> attachments){
50+
this(new OlogAttributeProvider(serviceUrl, preview, attachments));
51+
}
52+
53+
/**
54+
* Private constructor to avoid code duplication.
55+
* @param ologAttributeProvider The {@link OlogAttributeProvider} particular to the use case.
56+
*/
57+
private HtmlAwareController(OlogAttributeProvider ologAttributeProvider){
5158
List<Extension> extensions =
5259
Arrays.asList(TablesExtension.create(), ImageAttributesExtension.create());
5360
this.parser = Parser.builder().extensions(extensions).build();
5461
htmlRenderer = HtmlRenderer.builder()
55-
.attributeProviderFactory(context -> new OlogAttributeProvider(serviceUrl, preview, attachments))
62+
.escapeHtml(true)
63+
.attributeProviderFactory(context -> ologAttributeProvider)
5664
.extensions(extensions).build();
5765
}
5866

app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/LogEntryCalenderViewController.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.phoebus.logbook.SearchResult;
3535
import org.phoebus.logbook.olog.ui.query.OlogQuery;
3636
import org.phoebus.logbook.olog.ui.query.OlogQueryManager;
37+
import org.phoebus.ui.dialog.ExceptionDetailsErrorDialog;
3738

3839
import java.net.URL;
3940
import java.time.LocalDateTime;
@@ -262,7 +263,8 @@ public void search() {
262263
},
263264
(msg, ex) -> {
264265
searchInProgress.set(false);
265-
});
266+
ExceptionDetailsErrorDialog.openError(agenda, Messages.SearchFailed, "", ex);
267+
});
266268
}
267269

268270
public String getQuery() {

app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/LogEntryTableViewController.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import javafx.scene.control.Pagination;
2626
import javafx.scene.control.ProgressIndicator;
2727
import javafx.scene.control.SelectionMode;
28+
import javafx.scene.control.SplitPane;
2829
import javafx.scene.control.TableCell;
2930
import javafx.scene.control.TableColumn;
3031
import javafx.scene.control.TableView;
@@ -60,6 +61,7 @@
6061
import org.phoebus.security.store.SecureStore;
6162
import org.phoebus.security.tokens.ScopedAuthenticationToken;
6263
import org.phoebus.ui.dialog.DialogHelper;
64+
import org.phoebus.ui.dialog.ExceptionDetailsErrorDialog;
6365

6466
import java.io.IOException;
6567
import java.util.ArrayList;
@@ -88,6 +90,10 @@ public class LogEntryTableViewController extends LogbookSearchController impleme
8890
@SuppressWarnings("unused")
8991
private GridPane viewSearchPane;
9092

93+
@SuppressWarnings("unused")
94+
@FXML
95+
private SplitPane splitPane;
96+
9197
// elements related to the table view of the log entries
9298
@FXML
9399
@SuppressWarnings("unused")
@@ -420,6 +426,7 @@ public void search() {
420426
},
421427
(msg, ex) -> {
422428
searchInProgress.set(false);
429+
ExceptionDetailsErrorDialog.openError(splitPane, Messages.SearchFailed, "", ex);
423430
});
424431
}
425432

0 commit comments

Comments
 (0)