Skip to content

Commit

Permalink
#3657 Fix expander col width
Browse files Browse the repository at this point in the history
  • Loading branch information
stroomdev66 committed Aug 1, 2023
1 parent 27ce780 commit ee45656
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public ExpanderCell(final int initialOffset) {
* Get the maximum column width required to fit expander icons for all levels
*/
public static int getColumnWidth(final int maxDepth) {
if (maxDepth > 0) {
if (maxDepth >= 0) {
return (maxDepth * ICON_WIDTH) + ICON_WIDTH + PADDING;
} else {
return 0;
Expand Down Expand Up @@ -106,8 +106,7 @@ public void render(final Context context, final Expander value, final SafeHtmlBu
final int depth = value.getDepth();
final int padding = (depth * ICON_WIDTH) + initialOffset;
final SafeStyles style = SafeStylesUtils.fromTrustedString("padding-left:" + padding + "px;");
String className = "expanderCell expanderIcon";

String className = "";
final SvgImage expanderIcon;
if (value.isLeaf()) {
expanderIcon = SvgImage.DOT;
Expand All @@ -119,13 +118,13 @@ public void render(final Context context, final Expander value, final SafeHtmlBu
className += " active";
}

final SafeHtml expanderIconSafeHtml = SafeHtmlUtils.fromTrustedString(
expanderIcon.getSvg());
className += " " + expanderIcon.getClassName();
final SafeHtml iconSafeHtml = SvgImageUtil.toSafeHtml(
expanderIcon,
"expanderIcon" + className);
sb.append(template.expander(
className,
"expanderCell",
style,
expanderIconSafeHtml));
iconSafeHtml));

} else {
sb.append(SafeHtmlUtils.fromSafeConstant("<br/>"));
Expand Down
24 changes: 24 additions & 0 deletions unreleased_changes/20230801_105138_716__3657.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
* Issue **#3657** : Fix expander col width.


```sh
# ********************************************************************************
# Issue title: Expanders dissapparing when parent closed
# Issue link: https://github.com/gchq/stroom/issues/3657
# ********************************************************************************

# ONLY the top line will be included as a change entry in the CHANGELOG.
# The entry should be in GitHub flavour markdown and should be written on a SINGLE
# line with no hard breaks. You can have multiple change files for a single GitHub issue.
# The entry should be written in the imperative mood, i.e. 'Fix nasty bug' rather than
# 'Fixed nasty bug'.
#
# Examples of acceptable entries are:
#
#
# * Issue **123** : Fix bug with an associated GitHub issue in this repository
#
# * Issue **namespace/other-repo#456** : Fix bug with an associated GitHub issue in another repository
#
# * Fix bug with no associated GitHub issue.
```

0 comments on commit ee45656

Please sign in to comment.