-
Bug
-
Resolution: Incomplete
-
P3
-
None
-
8u66
-
x86_64
-
windows_7
FULL PRODUCT VERSION :
ADDITIONAL OS VERSION INFORMATION :
Windows
A DESCRIPTION OF THE PROBLEM :
I have create ListView. This LIst view is customized , and it has HBox for rendering the Buttons. We have set tooltip for buttons and it was working when we use JDK7. But when we use JDK 1.8 tooltip does not get displayed.
REGRESSION. Last worked in version 7u80
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
customize List view. I have added my Code in code
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class MyListView
{
private static double STATUS_WIDTH = 60.0;
private static double ACTION_WIDTH = 90.0;
public static ListView<FileXfrStatus> generateList( ObservableList<FileXfrStatus> transactionList )
{
final ListView<FileXfrStatus> fileList = new ListView<FileXfrStatus>( transactionList );
final SafeResourceBundle rb = MyUI.getInstance().getBundle();
final Tooltip fileTooltip =
new Tooltip( rb.getString( "OPen File name" ) );
final Tooltip folderTooltip =
new Tooltip( rb.getString( "Open folder containing file name" ) );
fileList.setCellFactory( new Callback<ListView<FileXfrStatus>,
ListCell<FileXfrStatus>> ()
{
@Override public ListCell<FileXfrStatus> call( ListView<FileXfrStatus> list )
{
// An entry is an HBox with 3 elements:
// - The Status icon (a graphic);
// - The Text area (a VBox); and
// - The Action buttons (another HBox).
// The Text area VBox has three lines:
// - The File Name;
// - The statistics; and
// - The File Path.
// The statistics are yet another HBox,
// as opposed to a simple Text string,
// so they can be separately enabled.
// The Nodes are declared and configured at this level
// (instead of within updateItem) so it only happens once per list item.
final DMUIProperties props = DMUIProperties.getInstance();
final Text fileSize = new Text();
fileSize.setId( "file-size-field" );
final Text percentComplete = new Text();
percentComplete.setId( "file-size-field" );
final Text transferRate = new Text();
transferRate.setId( "file-size-field" );
final Text timeRemaining = new Text();
timeRemaining.setId( "file-size-field" );
final Button fileName = new Button();
final Button filePath = new Button();
final HBox statBox = new HBox( 15 );
{
statBox.setAlignment( Pos.TOP_LEFT );
statBox.setPrefHeight( 20 );
statBox.setPadding( new Insets( 0, 10, 0, 10 ) );
}
final VBox textBox = new VBox( 0 );
{
textBox.setAlignment( Pos.TOP_LEFT );
textBox.prefWidthProperty().bind( fileList.widthProperty().subtract( STATUS_WIDTH + ACTION_WIDTH ) );
textBox.setPrefHeight( 60 );
}
final ActionButtons buttonBox = new ActionButtons();
buttonBox.setPrefWidth( ACTION_WIDTH );
final HBox listBox = new HBox( 10 );
{
listBox.setAlignment( Pos.CENTER_LEFT );
listBox.prefWidthProperty().bind( fileList.widthProperty().multiply( 0.702 ) );
listBox.setPrefHeight( 60 );
listBox.setPadding( new Insets( 10, 10, 10, 10 ) );
}
final FileXfrIcon statusIcon = new FileXfrIcon( true );
statusIcon.setPrefWidth( STATUS_WIDTH );
// Ensure underscore characters are rendered
fileName.setMnemonicParsing( false );
boolean needsSeparator = false;
if( props.getShowFileSize() )
{
statBox.getChildren().add( fileSize );
needsSeparator = true;
}
if( props.getShowPercentComplete() )
{
if( needsSeparator )
{
statBox.getChildren().add( new Separator( Orientation.VERTICAL ) );
}
statBox.getChildren().add( percentComplete );
needsSeparator = true;
}
if( props.getShowTransferRate() )
{
if( needsSeparator )
{
statBox.getChildren().add( new Separator( Orientation.VERTICAL ) );
}
statBox.getChildren().add( transferRate );
needsSeparator = true;
}
if( props.getShowTimeRemaining() )
{
if( needsSeparator )
{
statBox.getChildren().add( new Separator( Orientation.VERTICAL ) );
}
statBox.getChildren().add( timeRemaining );
}
filePath.setId( "pathfield" );
// Ensure underscore characters are rendered
filePath.setMnemonicParsing( false );
filePath.setTooltip( folderTooltip );
filePath.setOnAction(new EventHandler<ActionEvent>()
{
@Override public void handle( ActionEvent actionEvent )
{
buttonBox.handleOpenFolder( filePath );
}
});
if( props.getShowFileName() )
{
textBox.getChildren().add( fileName );
}
if( !statBox.getChildren().isEmpty() )
{
textBox.getChildren().add( statBox );
}
if( props.getShowFilePath() )
{
textBox.getChildren().add( filePath );
}
// And finally the overall HBox:
listBox.getChildren().addAll( statusIcon, textBox, buttonBox );
final ListCell<FileXfrStatus> cell = new ListCell<FileXfrStatus>()
{
@Override protected void updateItem( FileXfrStatus item, boolean empty )
{
super.updateItem( item, empty );
if( item != null )
{
fileSize.setText( item.fileSizeProperty().get().toString() );
percentComplete.setText( item.percentCompleteProperty().get().toString() );
transferRate.setText( item.transferRateProperty().get().toString() );
timeRemaining.setText( item.timeRemainingProperty().get().toString() );
fileName.setText( item.getFileName() );
fileName.setTooltip( item.getFileName() );
if( item.getState() == XfrState.COMPLETE )
{
// For complete transactions, clicking on the name opens the file
fileName.setId( "filefielddone" );
fileName.setOnAction( new EventHandler<ActionEvent>()
{
@Override public void handle( ActionEvent actionEvent )
{
buttonBox.handleOpenFile( fileName );
}
});
}
else
{
fileName.setId( "file-name-field" );
}
filePath.setText( item.getFilePath() );
statusIcon.populate( item.getTransferStatus() );
buttonBox.setState( item.getTransferStatus(),
item.getTransactionId() );
setGraphic( listBox );
}
else
{
setGraphic( null );
}
}
};
return cell;
};
}
);
fileList.setEditable( false );
fileList.setPrefWidth( DMUIProperties.getInstance().getViewWidth() );
fileList.setPrefHeight( DMUIProperties.getInstance().getViewHeight() );
fileList.getSelectionModel().setSelectionMode( SelectionMode.MULTIPLE );
return fileList;
}
}
---------- END SOURCE ----------
ADDITIONAL OS VERSION INFORMATION :
Windows
A DESCRIPTION OF THE PROBLEM :
I have create ListView. This LIst view is customized , and it has HBox for rendering the Buttons. We have set tooltip for buttons and it was working when we use JDK7. But when we use JDK 1.8 tooltip does not get displayed.
REGRESSION. Last worked in version 7u80
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
customize List view. I have added my Code in code
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class MyListView
{
private static double STATUS_WIDTH = 60.0;
private static double ACTION_WIDTH = 90.0;
public static ListView<FileXfrStatus> generateList( ObservableList<FileXfrStatus> transactionList )
{
final ListView<FileXfrStatus> fileList = new ListView<FileXfrStatus>( transactionList );
final SafeResourceBundle rb = MyUI.getInstance().getBundle();
final Tooltip fileTooltip =
new Tooltip( rb.getString( "OPen File name" ) );
final Tooltip folderTooltip =
new Tooltip( rb.getString( "Open folder containing file name" ) );
fileList.setCellFactory( new Callback<ListView<FileXfrStatus>,
ListCell<FileXfrStatus>> ()
{
@Override public ListCell<FileXfrStatus> call( ListView<FileXfrStatus> list )
{
// An entry is an HBox with 3 elements:
// - The Status icon (a graphic);
// - The Text area (a VBox); and
// - The Action buttons (another HBox).
// The Text area VBox has three lines:
// - The File Name;
// - The statistics; and
// - The File Path.
// The statistics are yet another HBox,
// as opposed to a simple Text string,
// so they can be separately enabled.
// The Nodes are declared and configured at this level
// (instead of within updateItem) so it only happens once per list item.
final DMUIProperties props = DMUIProperties.getInstance();
final Text fileSize = new Text();
fileSize.setId( "file-size-field" );
final Text percentComplete = new Text();
percentComplete.setId( "file-size-field" );
final Text transferRate = new Text();
transferRate.setId( "file-size-field" );
final Text timeRemaining = new Text();
timeRemaining.setId( "file-size-field" );
final Button fileName = new Button();
final Button filePath = new Button();
final HBox statBox = new HBox( 15 );
{
statBox.setAlignment( Pos.TOP_LEFT );
statBox.setPrefHeight( 20 );
statBox.setPadding( new Insets( 0, 10, 0, 10 ) );
}
final VBox textBox = new VBox( 0 );
{
textBox.setAlignment( Pos.TOP_LEFT );
textBox.prefWidthProperty().bind( fileList.widthProperty().subtract( STATUS_WIDTH + ACTION_WIDTH ) );
textBox.setPrefHeight( 60 );
}
final ActionButtons buttonBox = new ActionButtons();
buttonBox.setPrefWidth( ACTION_WIDTH );
final HBox listBox = new HBox( 10 );
{
listBox.setAlignment( Pos.CENTER_LEFT );
listBox.prefWidthProperty().bind( fileList.widthProperty().multiply( 0.702 ) );
listBox.setPrefHeight( 60 );
listBox.setPadding( new Insets( 10, 10, 10, 10 ) );
}
final FileXfrIcon statusIcon = new FileXfrIcon( true );
statusIcon.setPrefWidth( STATUS_WIDTH );
// Ensure underscore characters are rendered
fileName.setMnemonicParsing( false );
boolean needsSeparator = false;
if( props.getShowFileSize() )
{
statBox.getChildren().add( fileSize );
needsSeparator = true;
}
if( props.getShowPercentComplete() )
{
if( needsSeparator )
{
statBox.getChildren().add( new Separator( Orientation.VERTICAL ) );
}
statBox.getChildren().add( percentComplete );
needsSeparator = true;
}
if( props.getShowTransferRate() )
{
if( needsSeparator )
{
statBox.getChildren().add( new Separator( Orientation.VERTICAL ) );
}
statBox.getChildren().add( transferRate );
needsSeparator = true;
}
if( props.getShowTimeRemaining() )
{
if( needsSeparator )
{
statBox.getChildren().add( new Separator( Orientation.VERTICAL ) );
}
statBox.getChildren().add( timeRemaining );
}
filePath.setId( "pathfield" );
// Ensure underscore characters are rendered
filePath.setMnemonicParsing( false );
filePath.setTooltip( folderTooltip );
filePath.setOnAction(new EventHandler<ActionEvent>()
{
@Override public void handle( ActionEvent actionEvent )
{
buttonBox.handleOpenFolder( filePath );
}
});
if( props.getShowFileName() )
{
textBox.getChildren().add( fileName );
}
if( !statBox.getChildren().isEmpty() )
{
textBox.getChildren().add( statBox );
}
if( props.getShowFilePath() )
{
textBox.getChildren().add( filePath );
}
// And finally the overall HBox:
listBox.getChildren().addAll( statusIcon, textBox, buttonBox );
final ListCell<FileXfrStatus> cell = new ListCell<FileXfrStatus>()
{
@Override protected void updateItem( FileXfrStatus item, boolean empty )
{
super.updateItem( item, empty );
if( item != null )
{
fileSize.setText( item.fileSizeProperty().get().toString() );
percentComplete.setText( item.percentCompleteProperty().get().toString() );
transferRate.setText( item.transferRateProperty().get().toString() );
timeRemaining.setText( item.timeRemainingProperty().get().toString() );
fileName.setText( item.getFileName() );
fileName.setTooltip( item.getFileName() );
if( item.getState() == XfrState.COMPLETE )
{
// For complete transactions, clicking on the name opens the file
fileName.setId( "filefielddone" );
fileName.setOnAction( new EventHandler<ActionEvent>()
{
@Override public void handle( ActionEvent actionEvent )
{
buttonBox.handleOpenFile( fileName );
}
});
}
else
{
fileName.setId( "file-name-field" );
}
filePath.setText( item.getFilePath() );
statusIcon.populate( item.getTransferStatus() );
buttonBox.setState( item.getTransferStatus(),
item.getTransactionId() );
setGraphic( listBox );
}
else
{
setGraphic( null );
}
}
};
return cell;
};
}
);
fileList.setEditable( false );
fileList.setPrefWidth( DMUIProperties.getInstance().getViewWidth() );
fileList.setPrefHeight( DMUIProperties.getInstance().getViewHeight() );
fileList.getSelectionModel().setSelectionMode( SelectionMode.MULTIPLE );
return fileList;
}
}
---------- END SOURCE ----------
- relates to
-
JDK-8169116 Tooltip does get displayed in list view for JDK 1.8
- Closed