| | import javafx.beans.property.StringProperty; |
| | import javafx.collections.ObservableList; |
| | -import javafx.scene.control.Alert; |
| | -import javafx.scene.control.TableColumn; |
| | -import javafx.scene.control.TableView; |
| | +import javafx.scene.control.*; |
| | import javafx.scene.input.ClipboardContent; |
| | import javafx.scene.input.KeyCodeCombination; |
 |
| | import static java.util.Arrays.stream; |
| | import static javafx.collections.FXCollections.observableArrayList; |
| | +import static javafx.event.ActionEvent.ACTION; |
| | import static javafx.scene.control.Alert.AlertType.INFORMATION; |
| | +import static javafx.scene.control.ButtonType.OK; |
| | import static javafx.scene.control.SelectionMode.MULTIPLE; |
| | import static javafx.scene.input.Clipboard.getSystemClipboard; |
 |
| | initTableView(); |
| | setResizable( true ); |
| | + initButtons(); |
| | + initIcon(); |
| | + initActions(); |
| | } |
| | |
 |
| | final var pane = getDialogPane(); |
| | pane.setContent( mTable ); |
| | + } |
| | + |
| | + private void initButtons() { |
| | + final var pane = getDialogPane(); |
| | + final var CLEAR = new ButtonType( "CLEAR" ); |
| | + pane.getButtonTypes().add( CLEAR ); |
| | + |
| | + final var buttonOk = (Button) pane.lookupButton( OK ); |
| | + final var buttonClear = (Button) pane.lookupButton( CLEAR ); |
| | + |
| | + buttonOk.setDefaultButton( true ); |
| | + buttonClear.addEventFilter( ACTION, event -> { |
| | + clear(); |
| | + event.consume(); |
| | + } ); |
| | + |
| | + pane.setOnKeyReleased( t -> { |
| | + switch( t.getCode() ) { |
| | + case ENTER, ESCAPE -> buttonOk.fire(); |
| | + } |
| | + } ); |
| | + } |
| | |
| | + private void initIcon() { |
| | final var stage = getStage(); |
| | stage.getIcons().add( ICON_DIALOG ); |
| | + } |
| | + |
| | + private void initActions() { |
| | + final var stage = getStage(); |
| | + stage.setOnCloseRequest( event -> stage.hide() ); |
| | } |
| | |
 |
| | } |
| | |
| | - private StringProperty messageProperty() {return mMessage;} |
| | + private StringProperty messageProperty() { |
| | + return mMessage; |
| | + } |
| | |
| | - private StringProperty dateProperty() { return mDate;} |
| | + private StringProperty dateProperty() { |
| | + return mDate; |
| | + } |
| | |
| | - private StringProperty traceProperty() { return mTrace;} |
| | + private StringProperty traceProperty() { |
| | + return mTrace; |
| | + } |
| | |
| | private String toString( final LocalDateTime date ) { |
| | return date.format( ofPattern( "d MMM u HH:mm:ss" ) ); |
| | } |
| | |
| | private String toString( final Throwable trace ) { |
| | - final var sb = new StringBuilder(256); |
| | + final var sb = new StringBuilder( 256 ); |
| | |
| | if( trace != null ) { |
| | - sb.append( trace.getMessage() ); |
| | + sb.append( trace.getMessage().trim() ).append( NEWLINE ); |
| | stream( trace.getStackTrace() ) |
| | .takeWhile( LogView::filter ) |