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

Different default 'text alignment' value for labeleds between css ref and getCssMetaData

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Cannot Reproduce
    • Affects Version/s: 8
    • Fix Version/s: 8
    • Component/s: javafx
    • Labels:
    • Environment:

      jdk1.8.0 b85

      Description

      Please, change the edfault value from LEFT, as it was to CENTER as it appears to be now.


      import com.sun.javafx.runtime.VersionInfo;
      import java.util.HashMap;
      import java.util.Map;
      import java.util.concurrent.TimeUnit;
      import java.util.logging.Level;
      import java.util.logging.Logger;
      import javafx.application.Application;
      import javafx.application.Platform;
      import javafx.css.CssMetaData;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.layout.AnchorPane;
      import javafx.stage.Stage;

      public class Main extends Application {

          public static void main(String[] args) {
              launch(args);
          }

          @Override
          public void start(Stage stage) throws Exception {
              setUserAgentStylesheet(STYLESHEET_MODENA);
              stage.setTitle(VersionInfo.getRuntimeVersion());
              stage.setScene(createScene());
              
              Platform.runLater(new Runnable() {
                  @Override
                  public void run() {
                      try {
                          TimeUnit.SECONDS.sleep(1);
                      } catch (InterruptedException ex) {
                          Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                      }
                      Button b = new Button();

                      Map<String, CssMetaData> styles = new HashMap<>();
                      for (CssMetaData data : b.getCssMetaData()) {
                          styles.put(data.getProperty(), data);
                      }

                      CssMetaData data = styles.get(getTestedStyle());

                      System.out.println("Initial value " + data.getInitialValue(b));
                  }
              });
              
              stage.show();
              
          }

          private Scene createScene() {
              return new Scene(new AnchorPane());
          }

          private String getTestedStyle() {
              return "-fx-text-alignment";
          }
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dgrieve David Grieve
                Reporter:
                dzinkevi Dmitry Zinkevich (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: