## modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableColumnHeader.java

Print this page

    rev 4839 : RT-2529: Locale specific runtime errors (Turkish)

      37 import javafx.event.EventHandler;
      38 import javafx.geometry.HPos;
      39 import javafx.geometry.Insets;
      40 import javafx.geometry.Pos;
      41 import javafx.geometry.VPos;
      42 import javafx.scene.Node;
      43 import javafx.scene.control.ContextMenu;
      44 import javafx.scene.control.Label;
      45 import javafx.scene.control.TableColumn;
      46 import javafx.scene.control.TableColumnBase;
      47 import javafx.scene.input.ContextMenuEvent;
      48 import javafx.scene.input.MouseEvent;
      49 import javafx.scene.layout.GridPane;
      50 import javafx.scene.layout.HBox;
      51 import javafx.scene.layout.Priority;
      52 import javafx.scene.layout.Region;
      53 import javafx.util.Callback;
      54 import java.util.ArrayList;
      55 import java.util.Collections;
      56 import java.util.List;

      57 import com.sun.javafx.css.converters.SizeConverter;
      58 import com.sun.javafx.scene.control.MultiplePropertyChangeListenerHandler;
      59 import static com.sun.javafx.scene.control.TableColumnSortTypeWrapper.getSortTypeName;
      60 import static com.sun.javafx.scene.control.TableColumnSortTypeWrapper.getSortTypeProperty;
      61 import static com.sun.javafx.scene.control.TableColumnSortTypeWrapper.isAscending;
      62 import static com.sun.javafx.scene.control.TableColumnSortTypeWrapper.isDescending;
      63 import static com.sun.javafx.scene.control.TableColumnSortTypeWrapper.setSortType;
      64
      65
      66 /**
      67  * Region responsible for painting a single column header.
      68  */
      69 public class TableColumnHeader extends Region {
      70
      71     /***************************************************************************
      72      *                                                                         *
      73      * Static Fields                                                           *
      74      *                                                                         *
      75      **************************************************************************/
      76
     620     }
     621
     622     private void updateSortOrderDots(int sortPos) {
     623         double arrowWidth = arrow.prefWidth(-1);
     624
     625         // This is a bit of a hack - we're forcing the arrow to have its CSS
     626         // processed so that it has its bounds calculated
     627         if (arrowWidth == 0.0) {
     628             arrow.impl_processCSS(true);
     629             arrowWidth = arrow.prefWidth(-1);
     630         }
     631
     632         sortOrderDots.getChildren().clear();
     633
     634         for (int i = 0; i <= sortPos; i++) {
     635             Region r = new Region();
     636             r.getStyleClass().add("sort-order-dot");
     637
     638             String sortTypeName = getSortTypeName(column);
     639             if (sortTypeName != null && ! sortTypeName.isEmpty()) {
     640                 r.getStyleClass().add(sortTypeName.toLowerCase());
     641             }
     642
     643             sortOrderDots.getChildren().add(r);
     644         }
     645
     646         sortOrderDots.setAlignment(Pos.TOP_CENTER);
     647         sortOrderDots.setMaxWidth(arrowWidth);
     648     }
     649
     650     private void moveColumn(TableColumnBase column, int newColumnPos) {
     651         if (column == null || newColumnPos < 0) return;
     652
     653         ObservableList<TableColumnBase> columns = column.getParentColumn() == null ?
     654             getTableViewSkin().getColumns() :
     655             column.getParentColumn().getColumns();
     656
     657         int currentPos = columns.indexOf(column);
     658         if (newColumnPos == currentPos) return;
     659
     660         if (newColumnPos >= columns.size()) {
      37 import javafx.event.EventHandler;
      38 import javafx.geometry.HPos;
      39 import javafx.geometry.Insets;
      40 import javafx.geometry.Pos;
      41 import javafx.geometry.VPos;
      42 import javafx.scene.Node;
      43 import javafx.scene.control.ContextMenu;
      44 import javafx.scene.control.Label;
      45 import javafx.scene.control.TableColumn;
      46 import javafx.scene.control.TableColumnBase;
      47 import javafx.scene.input.ContextMenuEvent;
      48 import javafx.scene.input.MouseEvent;
      49 import javafx.scene.layout.GridPane;
      50 import javafx.scene.layout.HBox;
      51 import javafx.scene.layout.Priority;
      52 import javafx.scene.layout.Region;
      53 import javafx.util.Callback;
      54 import java.util.ArrayList;
      55 import java.util.Collections;
      56 import java.util.List;
      57 import java.util.Locale;
      58 import com.sun.javafx.css.converters.SizeConverter;
      59 import com.sun.javafx.scene.control.MultiplePropertyChangeListenerHandler;
      60 import static com.sun.javafx.scene.control.TableColumnSortTypeWrapper.getSortTypeName;
      61 import static com.sun.javafx.scene.control.TableColumnSortTypeWrapper.getSortTypeProperty;
      62 import static com.sun.javafx.scene.control.TableColumnSortTypeWrapper.isAscending;
      63 import static com.sun.javafx.scene.control.TableColumnSortTypeWrapper.isDescending;
      64 import static com.sun.javafx.scene.control.TableColumnSortTypeWrapper.setSortType;
      65
      66
      67 /**
      68  * Region responsible for painting a single column header.
      69  */
      70 public class TableColumnHeader extends Region {
      71
      72     /***************************************************************************
      73      *                                                                         *
      74      * Static Fields                                                           *
      75      *                                                                         *
      76      **************************************************************************/
      77
     621     }
     622
     623     private void updateSortOrderDots(int sortPos) {
     624         double arrowWidth = arrow.prefWidth(-1);
     625
     626         // This is a bit of a hack - we're forcing the arrow to have its CSS
     627         // processed so that it has its bounds calculated
     628         if (arrowWidth == 0.0) {
     629             arrow.impl_processCSS(true);
     630             arrowWidth = arrow.prefWidth(-1);
     631         }
     632
     633         sortOrderDots.getChildren().clear();
     634
     635         for (int i = 0; i <= sortPos; i++) {
     636             Region r = new Region();
     637             r.getStyleClass().add("sort-order-dot");
     638
     639             String sortTypeName = getSortTypeName(column);
     640             if (sortTypeName != null && ! sortTypeName.isEmpty()) {
     641                 r.getStyleClass().add(sortTypeName.toLowerCase(Locale.ROOT));
     642             }
     643
     644             sortOrderDots.getChildren().add(r);
     645         }
     646
     647         sortOrderDots.setAlignment(Pos.TOP_CENTER);
     648         sortOrderDots.setMaxWidth(arrowWidth);
     649     }
     650
     651     private void moveColumn(TableColumnBase column, int newColumnPos) {
     652         if (column == null || newColumnPos < 0) return;
     653
     654         ObservableList<TableColumnBase> columns = column.getParentColumn() == null ?
     655             getTableViewSkin().getColumns() :
     656             column.getParentColumn().getColumns();
     657
     658         int currentPos = columns.indexOf(column);
     659         if (newColumnPos == currentPos) return;
     660
     661         if (newColumnPos >= columns.size()) {