Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8169116

Tooltip does get displayed in list view for JDK 1.8

XMLWordPrintable

    • x86_64
    • windows_7

      FULL PRODUCT VERSION :


      ADDITIONAL OS VERSION INFORMATION :
      Windows

      A DESCRIPTION OF THE PROBLEM :
      I have customized my List view to display the content.
      I have buttons , images and label in cell. I had set tooltip for buttons , images and links.
      When i used JDK 1.7 , List view correctly shows the tooltip but when i shifted to Jdk1.8 > it does not shows the tooptip.

      When i add tootip for Cell it shows the tooltip for cell using jdk1.8 but for individual element in the cell.

      Please let me know what is going wrong with JDK 1.8

      REGRESSION. Last worked in version 8u91

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      I have customized my List view to display the content.
      I have buttons , images and label in cell. I had set tooltip for buttons , images and links.
      When i used JDK 1.7 , List view correctly shows the tooltip but when i shifted to Jdk1.8 > it does not shows the tooptip.

      When i add tootip for Cell it shows the tooltip for cell using jdk1.8 but for individual element in the cell.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class MyListView
      {
       

          public static ListView<MyStatus> generateList( ObservableList<MyStatus> transactionList )
          {
              final ListView<MyStatus> fileList = new ListView<MyStatus>( transactionList );
              final SafeResourceBundle rb = MyBundleClass.getInstance().getBundle();
              final Tooltip fileTooltip =
                  new Tooltip( rb.getString( "File OPen" ) );
              final Tooltip folderTooltip =
                  new Tooltip( rb.getString( "open Folder " ) );
              final Tooltip tp = new Tooltip();
              final String str = null;

              fileList.setCellFactory( new Callback<ListView<MyStatus>,
                 ListCell<MyStatus>> ()
                 {
                      @Override public ListCell<MyStatus> call( ListView<MyStatus> list )
                      {
                          final UIProperties props = UIProperties.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 ActionIcon statusIcon = new ActionIcon( 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( "file-path-field" );
                          // Ensure underscore characters are rendered
                          filePath.setMnemonicParsing( false );
                          filePath.setTooltip( folderTooltip );
                          fileName.setTooltip( fileTooltip );
                          
                          filePath.setOnAction(new EventHandler<ActionEvent>()
                          {
                              @Override public void handle( ActionEvent actionEvent )
                              {
                                  // perform action
                              }
                          });
                          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<MyStatus> cell = new ListCell<MyStatus>()
                          {
                              @Override protected void updateItem( MyStatus 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() );
                                     
                                      if( item.getState() == FileState.COMPLETE )
                                      {
                                          // For complete transactions, clicking on the name opens the file
                                          fileName.setId( "file-name-field-done" );
                                          
                                          fileName.setOnAction( new EventHandler<ActionEvent>()
                                          {
                                              @Override public void handle( ActionEvent actionEvent )
                                              {
                                                  // perform action
                                              }
                                          });
                                      }
                                      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( UIProperties.getInstance().getViewWidth() );
              fileList.setPrefHeight( UIProperties.getInstance().getViewHeight() );
              
              fileList.getSelectionModel().setSelectionMode( SelectionMode.MULTIPLE );
              
              
              return fileList;
          }
          
          
      }

      ---------- END SOURCE ----------

            scfitch Stephen Fitch
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: