-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4750 from gchq/gh-4626_sorting
#4626 Add error messages to dashboard tables when sorting limited res…
- Loading branch information
Showing
15 changed files
with
180 additions
and
71 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
stroom-core-client-widget/src/main/java/stroom/data/grid/client/MessagePanel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package stroom.data.grid.client; | ||
|
||
import com.google.gwt.safehtml.shared.SafeHtml; | ||
|
||
import java.util.List; | ||
|
||
public interface MessagePanel { | ||
|
||
void showMessage(List<String> errors); | ||
|
||
void showMessage(SafeHtml message); | ||
|
||
void showMessage(String message); | ||
|
||
void hideMessage(); | ||
} |
64 changes: 64 additions & 0 deletions
64
stroom-core-client-widget/src/main/java/stroom/data/grid/client/MessagePanelImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package stroom.data.grid.client; | ||
|
||
import stroom.widget.util.client.SafeHtmlUtil; | ||
|
||
import com.google.gwt.safehtml.shared.SafeHtml; | ||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; | ||
import com.google.gwt.user.client.ui.Label; | ||
import com.google.gwt.user.client.ui.SimplePanel; | ||
|
||
import java.util.List; | ||
|
||
public class MessagePanelImpl extends SimplePanel implements MessagePanel { | ||
|
||
private Label message; | ||
private boolean visible; | ||
|
||
public MessagePanelImpl() { | ||
setStyleName("dashboardVis-messageOuter"); | ||
setVisible(false); | ||
} | ||
|
||
@Override | ||
public void showMessage(final List<String> errors) { | ||
if (errors != null && errors.size() > 0) { | ||
final SafeHtmlBuilder sb = new SafeHtmlBuilder(); | ||
for (final String error : errors) { | ||
final String[] lines = error.split("\n"); | ||
for (final String line : lines) { | ||
sb.appendEscaped(line); | ||
sb.appendHtmlConstant("<br />"); | ||
} | ||
} | ||
showMessage(sb.toSafeHtml()); | ||
} | ||
} | ||
|
||
@Override | ||
public void showMessage(final String message) { | ||
showMessage(SafeHtmlUtil.from(message)); | ||
} | ||
|
||
@Override | ||
public void showMessage(final SafeHtml msg) { | ||
if (!visible) { | ||
if (message == null) { | ||
message = new Label("", false); | ||
message.setStyleName("dashboardVis-messageInner"); | ||
add(message); | ||
} | ||
|
||
message.getElement().setInnerSafeHtml(msg); | ||
setVisible(true); | ||
visible = true; | ||
} | ||
} | ||
|
||
@Override | ||
public void hideMessage() { | ||
if (visible) { | ||
setVisible(false); | ||
visible = false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.