2017-05-10 1 views
2

내가 CSS 파일별도의 CSS 규칙

.split-pane > .split-pane-divider { 
    -fx-background-insets: 0; 
    -fx-padding: 0 0 0 0; 
    -fx-background-color: red; 
} 

에서 다음 CSS 클래스를 가지고 내가 두 디바이더와 분할 구획이 있고 내가 노드 이러한 분할에 대한 참조가 (!). 나는

Node leftDivider; 
Node rightDivider; 

내가 그들에게 참조를

List<Node> nodes=getDividerNodes(splitPane); 
leftDivider=nodes.get(0); 
rightDivider=nodes.get(1); 

... 
public static List<Node> getDividerNodes(SplitPane splitPane){ 
    Map<Double,Node> sortedMap=new TreeMap<>(); 
    if (splitPane.getOrientation()==Orientation.HORIZONTAL){ 
     splitPane.lookupAll(".split-pane-divider").stream().forEach(div -> { 
      if (div.getParent()==splitPane){ 
       sortedMap.put(div.getLayoutX(), div); 
      } 
     }); 
    }else{ 
     splitPane.lookupAll(".split-pane-divider").stream().forEach(div -> { 
      if (div.getParent()==splitPane){ 
       sortedMap.put(div.getLayoutY(), div); 
      } 
     }); 
    } 
    return new ArrayList<>(sortedMap.values()); 
} 

가 지금은 leftDivider을 표시 wan't하지만 rightDivider을 표시하지 않도록이 방법을 얻을 것을 의미한다. 나는 그래야한다.

leftDivider.setStyle("-fx-padding: 0 5 0 0;"); 

그러나 왼쪽과 오른쪽의 분배 자 모두를 볼 수있다. 게다가, 내가 제대로 분배기 만보고 싶다면

rightDivider.setStyle("-fx-padding: 0 5 0 0;"); 

나는 어떤 분배 자도 보이지 않는다.

하나의 splitPane 내에서 구분선을 별도로 제어 할 수 없다고 생각됩니다. 내가 잘못하면 제발, 어떻게 두 개의 분배기 중 하나만 표시 할 수 있습니까?

+0

디바이더에 대한 참조를 얻는 방법에 대해 자세히 설명해 줄 수 있습니까? –

+0

@James_D 코드를 게시했습니다. –

+0

그래, 벌레 같아 ... –

답변

1

이것은 버그와 같습니다.

private void layoutDividersAndContent(double width, double height) { 
    final double paddingX = snappedLeftInset(); 
    final double paddingY = snappedTopInset(); 
    final double dividerWidth = contentDividers.isEmpty() ? 0 : contentDividers.get(0).prefWidth(-1); 

    for (Content c: contentRegions) { 
//  System.out.println("LAYOUT " + c.getId() + " PANELS X " + c.getX() + " Y " + c.getY() + " W " + (horizontal ? c.getArea() : width) + " H " + (horizontal ? height : c.getArea())); 
     if (horizontal) { 
      c.setClipSize(c.getArea(), height); 
      layoutInArea(c, c.getX() + paddingX, c.getY() + paddingY, c.getArea(), height, 
       0/*baseline*/,HPos.CENTER, VPos.CENTER); 
     } else { 
      c.setClipSize(width, c.getArea()); 
      layoutInArea(c, c.getX() + paddingX, c.getY() + paddingY, width, c.getArea(), 
       0/*baseline*/,HPos.CENTER, VPos.CENTER); 
     } 
    } 
    for (ContentDivider c: contentDividers) { 
//  System.out.println("LAYOUT DIVIDERS X " + c.getX() + " Y " + c.getY() + " W " + (horizontal ? dividerWidth : width) + " H " + (horizontal ? height : dividerWidth)); 
     if (horizontal) { 
      c.resize(dividerWidth, height); 
      positionInArea(c, c.getX() + paddingX, c.getY() + paddingY, dividerWidth, height, 
       /*baseline ignored*/0, HPos.CENTER, VPos.CENTER); 
     } else { 
      c.resize(width, dividerWidth);     
      positionInArea(c, c.getX() + paddingX, c.getY() + paddingY, width, dividerWidth, 
       /*baseline ignored*/0, HPos.CENTER, VPos.CENTER); 
     } 
    } 
} 

당신이 볼 수 있듯이, dividerWidth가 하나의 분할에 대해 계산하고, 같은 값이 모든 디바이더의 레이아웃에 사용됩니다 특히, SplitPaneSkin 클래스는 다음과 같은 방법이 포함되어 있습니다. 결과적으로 모든 구분선은 각각의 스타일에 관계없이 같은 크기입니다.

나는 이것이 이미보고되었는지 (나는 quick search을 수행 했으므로 아무 것도 찾지 못했음) 검색하고 그렇지 않은 경우보고하도록 권합니다.

+0

불행히도 등록 방법을 찾을 수 없습니다. 그것을하는 방법을 알고 있습니까? –

+0

@Pavel 프로젝트 역할없이 버그 [here] (http://bugs.java.com/)를 제출할 수 있습니다 (그래도 Oracle 등록이 필요합니다. 계정이 없으면 계정을 만들 수있는 링크가 표시되어야합니다.). –

+0

도움 주셔서 대단히 감사합니다. –