Java 类javafx.scene.control.OverrunStyle 实例源码

项目:gemoc-studio-modeldebugging    文件:TimelineDiffViewerRenderer.java   
private void addState(State<?,?> state, HBox line, Color color, int stateIndex, String stateDescription) {
    final Rectangle rectangle = new Rectangle(WIDTH, WIDTH, color);
    rectangle.setArcHeight(WIDTH);
    rectangle.setArcWidth(WIDTH);
    rectangle.setUserData(state);
    Label text = new Label(computeStateLabel(stateIndex));
    text.setTextOverrun(OverrunStyle.ELLIPSIS);
    text.setAlignment(Pos.CENTER);
    text.setMouseTransparent(true);
    text.setTextFill(Color.WHITE);
    text.setFont(STATE_FONT);
    text.setMaxWidth(WIDTH);
    final Tooltip tooltip = new Tooltip(stateDescription);
    Tooltip.install(rectangle, tooltip);
    StackPane layout = new StackPane();
    StackPane.setMargin(rectangle, MARGIN_INSETS);
    layout.getChildren().addAll(rectangle, text);
    line.getChildren().add(layout);
}
项目:shuffleboard    文件:ListLayout.java   
private Pane paneFor(Component component) {
  if (panes.containsKey(component)) {
    return panes.get(component);
  }

  BorderPane pane = new BorderPane(component.getView());
  ActionList.registerSupplier(pane, () -> actionsForComponent(component));
  pane.getStyleClass().add("layout-stack");
  EditableLabel label = new EditableLabel(component.titleProperty());
  label.getStyleClass().add("layout-label");
  ((Label) label.lookup(".label")).setTextOverrun(OverrunStyle.LEADING_ELLIPSIS);
  BorderPane.setAlignment(label, Pos.TOP_LEFT);
  pane.setBottom(label);

  panes.put(component, pane);
  return pane;
}
项目:tilesfx    文件:DateTileSkin.java   
@Override protected void initGraphics() {
    super.initGraphics();

    final ZonedDateTime TIME = tile.getTime();

    titleText = new Text(DAY_FORMATTER.format(TIME));
    titleText.setFill(tile.getTitleColor());

    description = new Label(Integer.toString(TIME.getDayOfMonth()));
    description.setAlignment(Pos.CENTER);
    description.setTextAlignment(TextAlignment.CENTER);
    description.setWrapText(true);
    description.setTextOverrun(OverrunStyle.WORD_ELLIPSIS);
    description.setTextFill(tile.getTextColor());
    description.setPrefSize(PREFERRED_WIDTH * 0.9, PREFERRED_HEIGHT * 0.72);
    description.setFont(Fonts.latoLight(PREFERRED_HEIGHT * 0.65));

    text = new Text(MONTH_YEAR_FORMATTER.format(TIME));
    text.setFill(tile.getTextColor());

    getPane().getChildren().addAll(titleText, text, description);
}
项目:tilesfx    文件:TextTileSkin.java   
@Override protected void initGraphics() {
    super.initGraphics();

    titleText = new Text();
    titleText.setFill(tile.getTitleColor());
    Helper.enableNode(titleText, !tile.getTitle().isEmpty());

    description = new Label(tile.getDescription());
    description.setAlignment(tile.getDescriptionAlignment());
    description.setTextAlignment(TextAlignment.RIGHT);
    description.setWrapText(true);
    description.setTextOverrun(OverrunStyle.WORD_ELLIPSIS);
    description.setTextFill(tile.getTextColor());
    description.setPrefSize(PREFERRED_WIDTH * 0.9, PREFERRED_HEIGHT * 0.795);
    Helper.enableNode(description, tile.isTextVisible());

    text = new Text(tile.getText());
    text.setFill(tile.getUnitColor());
    Helper.enableNode(text, tile.isTextVisible());

    getPane().getChildren().addAll(titleText, text, description);
}
项目:tilesfx    文件:CharacterTileSkin.java   
@Override protected void initGraphics() {
    super.initGraphics();

    titleText = new Text();
    titleText.setFill(tile.getTitleColor());
    Helper.enableNode(titleText, !tile.getTitle().isEmpty());

    description = new Label(tile.getDescription());
    description.setAlignment(Pos.CENTER);
    description.setTextAlignment(TextAlignment.CENTER);
    description.setWrapText(true);
    description.setTextOverrun(OverrunStyle.WORD_ELLIPSIS);
    description.setTextFill(tile.getTextColor());
    description.setPrefSize(PREFERRED_WIDTH * 0.9, PREFERRED_HEIGHT * 0.795);
    Helper.enableNode(description, tile.isTextVisible());

    text = new Text(tile.getText());
    text.setFill(tile.getUnitColor());
    Helper.enableNode(text, tile.isTextVisible());

    getPane().getChildren().addAll(titleText, text, description);
}
项目:FxEditor    文件:CssTools.java   
public static String toValue(OverrunStyle s)
{
    switch(s)
    {
    case CENTER_ELLIPSIS:
        return "center-ellipsis";
    case CENTER_WORD_ELLIPSIS:
        return "center-word-ellipsis";
    case CLIP:
        return "clip";
    case ELLIPSIS:
        return "ellipsis";
    case LEADING_ELLIPSIS:
        return "leading-ellipsis";
    case LEADING_WORD_ELLIPSIS:
        return "leading-word-ellipsis";
    case WORD_ELLIPSIS:
        return "word-ellipsis";
    }
    throw new Error("?" + s);
}
项目:ModelDebugging    文件:TimelineDiffViewerRenderer.java   
private void addState(State<?,?> state, HBox line, Color color, int stateIndex, String stateDescription) {
    final Rectangle rectangle = new Rectangle(WIDTH, WIDTH, color);
    rectangle.setArcHeight(WIDTH);
    rectangle.setArcWidth(WIDTH);
    rectangle.setUserData(state);
    Label text = new Label(computeStateLabel(stateIndex));
    text.setTextOverrun(OverrunStyle.ELLIPSIS);
    text.setAlignment(Pos.CENTER);
    text.setMouseTransparent(true);
    text.setTextFill(Color.WHITE);
    text.setFont(STATE_FONT);
    text.setMaxWidth(WIDTH);
    final Tooltip tooltip = new Tooltip(stateDescription);
    Tooltip.install(rectangle, tooltip);
    StackPane layout = new StackPane();
    StackPane.setMargin(rectangle, MARGIN_INSETS);
    layout.getChildren().addAll(rectangle, text);
    line.getChildren().add(layout);
}
项目:gemoc-studio-modeldebugging    文件:TraceSectionsDialog.java   
private Pane createTraceWidget(ITraceExtractor<Step<?>, State<?,?>, TracedObject<?>, Dimension<?>, Value<?>> extractor, String label, ReadOnlyDoubleProperty width) {
    final Pane pane = new Pane();
    pane.setBackground(TRANSPARENT_BACKGROUND);
    final Rectangle rectangle = new Rectangle(0, 0, 0, 12);
    rectangle.setFill(Color.LIGHTGRAY);
    rectangle.widthProperty().bind(width.subtract(10));
    rectangle.setArcHeight(12);
    rectangle.setArcWidth(12);
    Label text = new Label(label);
    text.setTextOverrun(OverrunStyle.ELLIPSIS);
    text.setAlignment(Pos.CENTER);
    text.setMouseTransparent(true);
    text.setTextFill(Color.WHITE);
    text.setFont(FONT);
    text.setMaxWidth(0);
    text.maxWidthProperty().bind(rectangle.widthProperty());
    StackPane layout = new StackPane();
    layout.getChildren().addAll(rectangle, text);
    pane.getChildren().add(layout);
    layout.setTranslateY(13);
    layout.setTranslateX(5);
    pane.setPrefHeight(25);
    pane.setMinHeight(25);
    pane.setMaxHeight(25);

    final Shape arrow1 = createCursor();
    final Shape arrow2 = createCursor();
    arrow1.setTranslateX(5);
    arrow1.setTranslateY(4);
    arrow2.translateXProperty().bind(rectangle.widthProperty().add(5));
    arrow2.setTranslateY(4);
    pane.getChildren().add(arrow1);
    pane.getChildren().add(arrow2);

    return pane;
}
项目:SnapDup    文件:MainDisplay.java   
@FXML
private void btnOverRunAction()
{
    overrunStyleDeque.add(overrunStyle); // Recycle the last overrunStyle.
    overrunStyle = overrunStyleDeque.pop(); // 

    propertyList.forEach(prop -> prop.setValue(overrunStyle));

    if(overrunStyle == OverrunStyle.ELLIPSIS)
        btnOverRun.setText("...<<");
    else if(overrunStyle == OverrunStyle.CENTER_ELLIPSIS)
        btnOverRun.setText(">>...");
    else
        btnOverRun.setText(">...<");
}
项目:shuffleboard    文件:Tile.java   
/**
 * Creates an empty tile. The content and size must be set with {@link #setContent(T)} and
 * {@link #setSize(TileSize)}.
 */
protected Tile() {
  try {
    FXMLLoader loader = new FXMLLoader(Tile.class.getResource("Tile.fxml"));
    loader.setRoot(this);
    loader.load();
  } catch (IOException e) {
    throw new RuntimeException("Could not load the widget tile FXML", e);
  }

  getStyleClass().addAll("tile", "card");
  PropertyUtils.bindWithConverter(idProperty(), contentProperty(), w -> "tile[" + w + "]");
  EditableLabel editableLabel = (EditableLabel) lookup("#titleLabel");
  editableLabel.textProperty().bindBidirectional(contentTitle);
  ((Label) lookup("#titleLabel").lookup(".label")).setTextOverrun(OverrunStyle.LEADING_ELLIPSIS);
  contentView.addListener((__, oldContent, newContent) -> {
    getContentPane()
        .map(Pane::getChildren)
        .ifPresent(c -> {
          if (newContent == null) {
            c.clear();
          } else {
            c.setAll(newContent);
          }
        });
  });
  contentTitle.addListener((__, prev, cur) -> editableLabel.setText(cur));
}
项目:CalendarFX    文件:TimeScaleViewSkin.java   
public TimeScaleViewSkin(T view) {
    super(view);

    LocalTime time = LocalTime.of(1, 0);

    for (int i = 1; i < 24; i++) {
        Label label = new Label(time.format(formatter));
        label.setManaged(false);
        label.setMaxWidth(Double.MAX_VALUE);
        label.setAlignment(Pos.CENTER_RIGHT);
        label.getStyleClass().add("time-label"); //$NON-NLS-1$
        label.setTextOverrun(OverrunStyle.CLIP);
        labels.add(label);
        getChildren().add(label);
        time = time.plusHours(1);
    }

    currentTimeLabel = new Label();
    currentTimeLabel.getStyleClass().add("current-time-label"); //$NON-NLS-1$
    currentTimeLabel.setManaged(false);
    currentTimeLabel.setMaxWidth(Double.MAX_VALUE);
    currentTimeLabel.setAlignment(Pos.CENTER_RIGHT);
    currentTimeLabel.setOpacity(0);
    currentTimeLabel.setTextOverrun(OverrunStyle.CLIP);
    currentTimeLabel.visibleProperty().bind(view.enableCurrentTimeMarkerProperty());

    getChildren().add(currentTimeLabel);

    updateCurrentTimeMarkerVisibility();
    view.showCurrentTimeMarkerProperty().addListener(
            it -> updateCurrentTimeMarkerVisibility());
    setupCurrentTimeMarkerSupport();
    updateShowMarkers();
}
项目:CalendarFX    文件:DayPageSkin.java   
protected Node createLeftHandSide() {
    DayPage dayPage = getSkinnable();

    // today label
    todayLabel = new Label();
    todayLabel.getStyleClass().add("today-label"); //$NON-NLS-1$
    todayLabel.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    todayLabel.setAlignment(Pos.TOP_LEFT);
    todayLabel.setTextOverrun(OverrunStyle.CLIP);
    todayLabel.setMinWidth(Region.USE_PREF_SIZE);
    HBox.setHgrow(todayLabel, Priority.ALWAYS);

    // year month view
    yearMonthView = dayPage.getYearMonthView();
    yearMonthView.setSelectionMode(SelectionMode.SINGLE);
    yearMonthView.setShowMonth(false);
    yearMonthView.setShowYear(false);
    yearMonthView.setShowTodayButton(false);
    HBox.setHgrow(yearMonthView, Priority.NEVER);
    getSkinnable().bind(yearMonthView, true);

    HBox header = new HBox(10);
    header.setFillHeight(true);
    header.getChildren().addAll(todayLabel, yearMonthView);
    header.getStyleClass().add("header");

    AgendaView agendaView = dayPage.getAgendaView();
    getSkinnable().bind(agendaView, true);
    HBox.setMargin(agendaView, new Insets(10, 0, 0, 0));

    BorderPane leftHandSide = new BorderPane();
    leftHandSide.getStyleClass().add("left-side");
    leftHandSide.setTop(header);
    leftHandSide.setCenter(agendaView);
    HBox.setHgrow(leftHandSide, Priority.ALWAYS);
    return leftHandSide;
}
项目:openjfx-8u-dev-tests    文件:LabeledsAbstactApp.java   
protected void addTextAlignment(List<Change<Labeled>> list, final Utils.LayoutSize layout, final boolean wrapped, final String text) {
    for (final OverrunStyle overrun : OverrunStyle.values()) {
        list.add(new Change<Labeled>(overrun.toString()) {
            public void apply(Labeled labeled) {
                layout.apply(labeled);
                labeled.setText(text);
                labeled.setTextOverrun(overrun);
                labeled.setWrapText(wrapped);
                if (labeled.getTextOverrun() != overrun) {
                    reportGetterFailure("labeled.overrun()");
                }
            }
        });
    }
}
项目:openjfx-8u-dev-tests    文件:TooltipTest.java   
@ScreenshotCheck
@Test(timeout=300000)
public void textOverrun() throws Throwable {
    for (OverrunStyle display : OverrunStyle.values()) {
        textOverrun.as(Selectable.class).selector().select(display);
        show.mouse().move();
        checkScreenshot("Tooltip-text-overrun-" + display, testPane);
    }
    throwScreenshotError();
}
项目:WhoWhatWhere    文件:WatchdogController.java   
private void setColumnCellFactories()
{
    columnMsgText.setCellValueFactory(new PropertyValueFactory<PacketTypeToMatch, String>("messageText"));
    columnMsgOutputMethod.setCellValueFactory(new PropertyValueFactory<PacketTypeToMatch, String>("messageOutputMethod"));
    columnPacketDirection.setCellValueFactory(new PropertyValueFactory<PacketTypeToMatch, String>("packetDirection"));
    columnIP.setCellValueFactory(new PropertyValueFactory<PacketTypeToMatch, String>("ipAddress"));
    columnProtocol.setCellValueFactory(new PropertyValueFactory<>("protocol"));
    columnSrcPort.setCellValueFactory(new PropertyValueFactory<PacketTypeToMatch, String>("srcPort"));
    columnDstPort.setCellValueFactory(new PropertyValueFactory<PacketTypeToMatch, String>("dstPort"));
    columnPacketSize.setCellValueFactory(new PropertyValueFactory<PacketTypeToMatch, String>("packetSize"));

    columnIP.setCellFactory(new Callback<TableColumn<PacketTypeToMatch, String>, TableCell<PacketTypeToMatch, String>>()
    {
        @Override
        public TableCell<PacketTypeToMatch, String> call(TableColumn<PacketTypeToMatch, String> param)
        {
            return new TableCell<PacketTypeToMatch, String>()
            {
                @Override
                protected void updateItem(String item, boolean empty)
                {
                    super.updateItem(item, empty);

                    setText(item);
                    setTextOverrun(OverrunStyle.CENTER_ELLIPSIS);
                }
            };
        }
    });
}
项目:Cachoeira    文件:TaskBar.java   
protected void setLabel(ITask task, Rectangle backgroundRectangle) {
    // Вешаем лэйбл с наименованием задачи
    Label taskLabel = new Label(task.getName());
    taskLabel.setTextOverrun(OverrunStyle.CLIP);
    taskLabel.setTextFill(Color.WHITE);
    taskLabel.setLayoutY(6);
    taskLabel.prefWidthProperty().bind(backgroundRectangle.widthProperty());
    taskLabel.onMousePressedProperty().bind(backgroundRectangle.onMousePressedProperty());
    taskLabel.onMouseDraggedProperty().bind(backgroundRectangle.onMouseDraggedProperty());
    this.getChildren().add(taskLabel);
}
项目:Cachoeira    文件:DateLine.java   
/**
 * Этот метод создает лейбл с заданными параметрами
 *
 * @param multiplier    Множитель для ширины "столбца"
 * @param dateFormatter Формат даты
 * @return Лейбл
 **/
private Label createDateLabel(int multiplier,
                              String dateFormatter) {
    Label dateLabel = new Label(dateFormatter); //фигачим лейбл с датой на борту
    dateLabel.setTextOverrun(OverrunStyle.CLIP);
    dateLabel.setPrefWidth(controller.getZoomMultiplier() * multiplier);
    dateLabel.setMinHeight(24);
    dateLabel.getStylesheets().add(this.getClass().getResource("/css/header.css").toExternalForm()); // делаем красиво
    dateLabel.setAlignment(Pos.CENTER);
    return dateLabel;
}
项目:ModelDebugging    文件:TraceSectionsDialog.java   
private Pane createTraceWidget(ITraceExtractor extractor, String label, ReadOnlyDoubleProperty width) {
    final Pane pane = new Pane();
    pane.setBackground(TRANSPARENT_BACKGROUND);
    final Rectangle rectangle = new Rectangle(0, 0, 0, 12);
    rectangle.setFill(Color.LIGHTGRAY);
    rectangle.widthProperty().bind(width.subtract(10));
    rectangle.setArcHeight(12);
    rectangle.setArcWidth(12);
    Label text = new Label(label);
    text.setTextOverrun(OverrunStyle.ELLIPSIS);
    text.setAlignment(Pos.CENTER);
    text.setMouseTransparent(true);
    text.setTextFill(Color.WHITE);
    text.setFont(FONT);
    text.setMaxWidth(0);
    text.maxWidthProperty().bind(rectangle.widthProperty());
    StackPane layout = new StackPane();
    layout.getChildren().addAll(rectangle, text);
    pane.getChildren().add(layout);
    layout.setTranslateY(13);
    layout.setTranslateX(5);
    pane.setPrefHeight(25);
    pane.setMinHeight(25);
    pane.setMaxHeight(25);

    final Group group1 = new Group();
    final Label label1 = new Label();
    final Shape arrow1 = createCursor();
    final Group group2 = new Group();
    final Shape arrow2 = createCursor();
    arrow1.setTranslateX(5);
    arrow1.setTranslateY(4);
    arrow2.translateXProperty().bind(rectangle.widthProperty().add(5));
    arrow2.setTranslateY(4);
    pane.getChildren().add(arrow1);
    pane.getChildren().add(arrow2);

    return pane;
}
项目:superD    文件:BaselineLeftCenterOverrunTableCell.java   
public BaselineLeftCenterOverrunTableCell(String ellipsisString) {
    super();
    setTextOverrun(OverrunStyle.CENTER_ELLIPSIS);
    if (ellipsisString != null && !"".equals(ellipsisString)) {
        setEllipsisString(ellipsisString);
    }  
}
项目:superD_legacy    文件:ApplicationWindow.java   
public CenteredOverrunTableCell(String ellipsisString) {
    super();
    setTextOverrun(OverrunStyle.CENTER_WORD_ELLIPSIS);
    if (ellipsisString != null) {
        setEllipsisString(ellipsisString);
    }  
}
项目:lttng-scope    文件:TimeGraphStateLayer.java   
private Node prepareTimeGrahLabelsContents(Collection<StateRectangle> stateRectangles,
        TimeRange windowRange) {
    double minX = getWidget().timestampToPaneXPos(windowRange.getStartTime());

    final String ellipsisStr = DebugOptions.ELLIPSIS_STRING;
    final double ellipsisWidth = getWidget().getDebugOptions().getEllipsisWidth();
    final Font textFont = getWidget().getDebugOptions().stateLabelFont.get();
    final OverrunStyle overrunStyle = OverrunStyle.ELLIPSIS;
    final Color textColor = Color.WHITE;

    /* Requires a ~2 pixels adjustment to be centered on the states */
    final double yOffset = TimeGraphWidget.ENTRY_HEIGHT / 2.0 + 2.0;
    Collection<Node> texts = stateRectangles.stream()
            /* Only try to annotate rectangles that are large enough */
            .filter(stateRect -> stateRect.getWidth() > ellipsisWidth)
            .filter(stateRect -> stateRect.getStateInterval().getLabel() != null)
            .map(stateRect -> {
                String labelText = requireNonNull(stateRect.getStateInterval().getLabel());
                /* A small offset looks better here */
                double textX = Math.max(minX, stateRect.getX()) + 4.0;
                double textY = stateRect.getY() + yOffset;

                double rectEndX = stateRect.getX() + stateRect.getWidth();
                double minWidth = rectEndX - textX;

                String ellipsedText = JfxUtils.computeClippedText(textFont,
                        labelText,
                        minWidth,
                        overrunStyle,
                        ellipsisStr);

                if (ellipsedText.equals(ellipsisStr)) {
                    return null;
                }

                Text text = new Text(textX, textY, ellipsedText);
                text.setFont(textFont);
                text.setFill(textColor);
                return text;
            })
            .filter(Objects::nonNull)
            .collect(Collectors.toList());

    return new Group(texts);
}
项目:gemoc-studio-modeldebugging    文件:VertexView.java   
public VertexView(final int stateIndex, StateVertex vertex) {
    circle = new Circle(RADIUS);
    circle.setFill(Color.SLATEBLUE);

    this.stateIndex = stateIndex;

    final String s = vertex.getTooltip();
    final Tooltip t = new Tooltip(s);
    Tooltip.install(this, t);
    vertex.setOnTooltipUpdateCommand(text -> Platform.runLater(() -> t.setText(text)));

    label = new Label(computeStateLabel(this.stateIndex));
    label.setTextOverrun(OverrunStyle.ELLIPSIS);
    label.setAlignment(Pos.CENTER);
    label.setMouseTransparent(true);
    label.setTextFill(Color.WHITE);
    label.setFont(STATE_INDEX_FONT);
    label.setMaxWidth(RADIUS * 2);
    StackPane layout = new StackPane();
    layout.getChildren().addAll(circle, label);
    layout.setTranslateX(-RADIUS);
    layout.setTranslateY(-RADIUS);

    getChildren().add(layout);

    setOnMousePressed(event -> {
        circle.setCursor(Cursor.MOVE);
        mouseX = event.getX();
        mouseY = event.getY();
        event.consume();
    });

    setOnMouseReleased(event -> {
        setCursor(Cursor.DEFAULT);
    });

    setOnMouseDragged(event -> {
        double deltaX = event.getX() - mouseX;
        double deltaY = event.getY() - mouseY;
        setTranslateX(getTranslateX() + deltaX);
        setTranslateY(getTranslateY() + deltaY);
        event.consume();
    });

    setOnMouseEntered(event -> circle.setEffect(GLOW));
    setOnMouseExited(event -> circle.setEffect(null));
}
项目:SnapDup    文件:MainDisplay.java   
public MainDisplay()
{
    overrunStyleDeque.add(OverrunStyle.LEADING_ELLIPSIS);
    overrunStyleDeque.add(OverrunStyle.CENTER_ELLIPSIS);
}
项目:SnapDup    文件:FileTableCellFactory.java   
public FileTableCellFactory(Callback<Pair<ObservableList<Integer>, Boolean>, Void> callback, List<ObjectProperty<OverrunStyle>> list)
{
    this.callback = callback;
    this.propertyList = list;
}
项目:Gargoyle    文件:StepPane.java   
public StepPane(RaxDrawingController controller, Step step) {
    this.controller = controller;
    this.step = step;

    translateXProperty().addListener((oba, o, n) -> {
        centerX.set(n.doubleValue() + (this.getPrefWidth() / 2));
    });

    translateYProperty().addListener((oba, o, n) -> {
        centerY.set(n.doubleValue() + (this.getPrefHeight() / 2));
    });

    setMouseTransparent(false);
    setPickOnBounds(true);

    setBackground(new Background(new BackgroundFill(Color.web("31AA6B"), CornerRadii.EMPTY, Insets.EMPTY)));

    // BorderStroke borderStroke = new BorderStroke(Color.web("29AA6B"),
    // Color.web("29AA6B"), Color.web("29AA6B"), Color.web("29AA6B"),
    // BorderStrokeStyle.DASHED, BorderStrokeStyle.DASHED,
    // BorderStrokeStyle.DASHED, BorderStrokeStyle.DASHED,
    // new CornerRadii(10d), new BorderWidths(5d), new Insets(10d));

    Rectangle rectangle = new Rectangle();
    rectangle.setStrokeWidth(1d);
    rectangle.setStroke(Color.web("29AA6B"));

    setPrefSize(Double.parseDouble(this.step.getRectangleW()), Double.parseDouble(this.step.getRectangleH()));

    setMaxSize(Double.parseDouble(this.step.getRectangleW()), Double.parseDouble(this.step.getRectangleH()));

    // rectangle.setBorder(new Border(borderStroke));
    getChildren().add(rectangle);

    label = new Label();

    /* set Text */
    if (ViewType.ID == controller.getViewType())
        onChangeViewTypeName();
    else if (ViewType.DESC == controller.getViewType())
        onChangeViewTypeDesc();

    label.setTextOverrun(OverrunStyle.LEADING_WORD_ELLIPSIS);
    label.setWrapText(true);
    getChildren().add(label);

    // AnchorPane anchorPane = new AnchorPane();
    // anchorPane.setMouseTransparent(true);
    // anchorPane.setPickOnBounds(false);
    // getChildren().add(anchorPane);

    // Label lblDesc = new Label(this.step.getDescription());
    // lblDesc.setFont(Font.font(9d));
    // lblDesc.setMouseTransparent(true);
    // lblDesc.setPickOnBounds(false);
    // lblDesc.setBackground(new Background(new
    // BackgroundFill(Color.web("31AA6B"), CornerRadii.EMPTY,
    // Insets.EMPTY)));
    // anchorPane.getChildren().add(lblDesc);
    //
    // Platform.runLater(() -> {
    // AnchorPane.setRightAnchor(lblDesc, lblDesc.getLayoutX() -
    // lblDesc.getWidth() - 50d);
    // });
    setTranslateX(Double.parseDouble(this.step.getRectangleX()));
    setTranslateY(Double.parseDouble(this.step.getRectangleY()));
    // setLayoutX(Double.parseDouble(this.step.getRectangleX()));
    // setLayoutY(Double.parseDouble(this.step.getRectangleY()));
}
项目:ReqTraq    文件:FX.java   
/** creates a label */
public static Label label(Object ... attrs)
{
    Label n = new Label();

    for(Object a: attrs)
    {
        if(a == null)
        {
            // ignore
        }
        else if(a instanceof CssStyle)
        {
            n.getStyleClass().add(((CssStyle)a).getName());
        }
        else if(a instanceof CssID)
        {
            n.setId(((CssID)a).getID());
        }
        else if(a instanceof FxCtl)
        {
            switch((FxCtl)a)
            {
            case BOLD:
                n.getStyleClass().add(CssTools.BOLD.getName());
                break;
            case FOCUSABLE:
                n.setFocusTraversable(true);
                break;
            case FORCE_MAX_WIDTH:
                n.setMaxWidth(Double.MAX_VALUE);
                break;
            case FORCE_MIN_HEIGHT:
                n.setMinHeight(Control.USE_PREF_SIZE);
                break;
            case FORCE_MIN_WIDTH:
                n.setMinWidth(Control.USE_PREF_SIZE);
                break;
            case NON_FOCUSABLE:
                n.setFocusTraversable(false);
                break;
            case WRAP_TEXT:
                n.setWrapText(true);
                break;
            default:
                throw new Error("?" + a);
            }
        }
        else if(a instanceof Insets)
        {
            n.setPadding((Insets)a);
        }
        else if(a instanceof OverrunStyle)
        {
            n.setTextOverrun((OverrunStyle)a);
        }
        else if(a instanceof Pos)
        {
            n.setAlignment((Pos)a);
        }
        else if(a instanceof String)
        {
            n.setText((String)a);
        }
        else if(a instanceof TextAlignment)
        {
            n.setTextAlignment((TextAlignment)a);
        }
        else if(a instanceof Color)
        {
            n.setTextFill((Color)a);
        }
        else
        {
            throw new Error("?" + a);
        }           
    }

    return n;
}
项目:FxDock    文件:FX.java   
/** creates a label */
public static Label label(Object ... attrs)
{
    Label n = new Label();

    for(Object a: attrs)
    {
        if(a == null)
        {
            // ignore
        }
        else if(a instanceof CssStyle)
        {
            n.getStyleClass().add(((CssStyle)a).getName());
        }
        else if(a instanceof CssID)
        {
            n.setId(((CssID)a).getID());
        }
        else if(a instanceof FxCtl)
        {
            switch((FxCtl)a)
            {
            case BOLD:
                n.getStyleClass().add(CssTools.BOLD.getName());
                break;
            case FOCUSABLE:
                n.setFocusTraversable(true);
                break;
            case FORCE_MIN_HEIGHT:
                n.setMinHeight(Control.USE_PREF_SIZE);
                break;
            case FORCE_MIN_WIDTH:
                n.setMinWidth(Control.USE_PREF_SIZE);
                break;
            case NON_FOCUSABLE:
                n.setFocusTraversable(false);
                break;
            case WRAP_TEXT:
                n.setWrapText(true);
                break;
            default:
                throw new Error("?" + a);
            }
        }
        else if(a instanceof Insets)
        {
            n.setPadding((Insets)a);
        }
        else if(a instanceof OverrunStyle)
        {
            n.setTextOverrun((OverrunStyle)a);
        }
        else if(a instanceof Pos)
        {
            n.setAlignment((Pos)a);
        }
        else if(a instanceof String)
        {
            n.setText((String)a);
        }
        else if(a instanceof TextAlignment)
        {
            n.setTextAlignment((TextAlignment)a);
        }
        else if(a instanceof Color)
        {
            n.setTextFill((Color)a);
        }
        else
        {
            throw new Error("?" + a);
        }           
    }

    return n;
}
项目:StreamSis    文件:FileNameCell.java   
/**
 * Instantiates a new FileNameCell Cell. Sets the default values.
 */
public FileNameCell() {
    setMaxHeight(getHeight());
    setGraphicTextGap(6.0);
    setTextOverrun(OverrunStyle.LEADING_ELLIPSIS);
}
项目:ModelDebugging    文件:VertexView.java   
public VertexView(final int stateIndex, StateVertex vertex) {
    circle = new Circle(RADIUS);
    circle.setFill(Color.SLATEBLUE);

    this.stateIndex = stateIndex;

    final String s = vertex.getTooltip();
    final Tooltip t = new Tooltip(s);
    Tooltip.install(this, t);
    vertex.setOnTooltipUpdateCommand(text -> Platform.runLater(() -> t.setText(text)));

    label = new Label(computeStateLabel(this.stateIndex));
    label.setTextOverrun(OverrunStyle.ELLIPSIS);
    label.setAlignment(Pos.CENTER);
    label.setMouseTransparent(true);
    label.setTextFill(Color.WHITE);
    label.setFont(STATE_INDEX_FONT);
    label.setMaxWidth(RADIUS * 2);
    StackPane layout = new StackPane();
    layout.getChildren().addAll(circle, label);
    layout.setTranslateX(-RADIUS);
    layout.setTranslateY(-RADIUS);

    getChildren().add(layout);

    setOnMousePressed(event -> {
        circle.setCursor(Cursor.MOVE);
        mouseX = event.getX();
        mouseY = event.getY();
        event.consume();
    });

    setOnMouseReleased(event -> {
        setCursor(Cursor.DEFAULT);
    });

    setOnMouseDragged(event -> {
        double deltaX = event.getX() - mouseX;
        double deltaY = event.getY() - mouseY;
        setTranslateX(getTranslateX() + deltaX);
        setTranslateY(getTranslateY() + deltaY);
        event.consume();
    });

    setOnMouseEntered(event -> circle.setEffect(GLOW));
    setOnMouseExited(event -> circle.setEffect(null));
}
项目:exchange    文件:InfoDisplay.java   
public InfoDisplay() {
    icon.setId("non-clickable-icon");
    icon.visibleProperty().bind(visibleProperty());

    GridPane.setValignment(icon, VPos.TOP);
    GridPane.setMargin(icon, new Insets(-2, 0, 0, 0));
    GridPane.setRowSpan(icon, 2);

    label = new AutoTooltipLabel();
    label.textProperty().bind(text);
    label.setTextOverrun(OverrunStyle.WORD_ELLIPSIS);
    // width is set a frame later so we hide it first
    label.setVisible(false);

    link = new Hyperlink(Res.get("shared.readMore"));
    link.setPadding(new Insets(0, 0, 0, -2));

    // We need that to know if we have a wrapping or not.
    // Did not find a way to get that from the API.
    Label testLabel = new AutoTooltipLabel();
    testLabel.textProperty().bind(text);

    textFlow = new TextFlow();
    textFlow.visibleProperty().bind(visibleProperty());
    textFlow.getChildren().addAll(testLabel);

    testLabel.widthProperty().addListener((ov, o, n) -> {
        useReadMore = (double) n > textFlow.getWidth();
        link.setText(Res.get(useReadMore ? "shared.readMore" : "shared.openHelp"));
        UserThread.execute(() -> textFlow.getChildren().setAll(label, link));
    });

    // update the width when the window gets resized
    ChangeListener<Number> listener = (ov2, oldValue2, windowWidth) -> {
        if (label.prefWidthProperty().isBound())
            label.prefWidthProperty().unbind();
        label.setPrefWidth((double) windowWidth - localToScene(0, 0).getX() - 35);
    };


    // when clicking "Read more..." we expand and change the link to the Help
    link.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent actionEvent) {
            if (useReadMore) {

                label.setWrapText(true);
                link.setText(Res.get("shared.openHelp"));
                getScene().getWindow().widthProperty().removeListener(listener);
                if (label.prefWidthProperty().isBound())
                    label.prefWidthProperty().unbind();
                label.prefWidthProperty().bind(textFlow.widthProperty());
                link.setVisited(false);
                // focus border is a bit confusing here so we remove it
                link.getStyleClass().add("hide-focus");
                link.setOnAction(onAction.get());
                getParent().layout();
            } else {
                onAction.get().handle(actionEvent);
            }
        }
    });

    sceneProperty().addListener((ov, oldValue, newValue) -> {
        if (oldValue == null && newValue != null && newValue.getWindow() != null) {
            newValue.getWindow().widthProperty().addListener(listener);
            // localToScene does deliver 0 instead of the correct x position when scene property gets set,
            // so we delay for 1 render cycle
            UserThread.execute(() -> {
                label.setVisible(true);
                label.prefWidthProperty().unbind();
                label.setPrefWidth(newValue.getWindow().getWidth() - localToScene(0, 0).getX() - 35);
            });
        }
    });
}
项目:netentionj-desktop    文件:StatusDisplay.java   
public StatusDisplay(StringExpression statusProperty) {
    Label statusText = new Label();
    statusText.setTextOverrun(OverrunStyle.ELLIPSIS);

    statusText.textProperty().bind(statusProperty);


    getStyleClass().add("status-background");

    setVisible(true);

    //statusText.textProperty().addListener((observableValue, oldValue, newValue) ->
            //setVisible(newValue != null && !newValue.equals(""))
    //);


    getChildren().addAll(statusText, progressHolder);
}
项目:netentionj-desktop    文件:OperatorTagPane.java   
public OperatorTagPane(Core core, String tag, final WikiBrowser outer) {
    super();
    this.outer = outer;
    autosize();

    setPadding(new Insets(4,4,4,4));

    Label label = new Label(tag);
    label.setFont(label.getFont().font( Font.getDefault().getSize() * 1.4f ));
    label.setTextOverrun(OverrunStyle.CLIP);
    setTop(label);

    final ToggleGroup gk = new ToggleGroup();

    ToggleButton k1 = new ToggleButton("Learn");
    k1.setToggleGroup(gk);
    ToggleButton k2 = new ToggleButton("Do");
    k2.setToggleGroup(gk);
    ToggleButton k3 = new ToggleButton("Teach");
    k3.setToggleGroup(gk);

    TilePane k = new TilePane(k1,k2,k3);

    final ToggleGroup gn = new ToggleGroup();

    ToggleButton n1 = new ToggleButton("Can");
    n1.setToggleGroup(gn);
    ToggleButton n2 = new ToggleButton("Need");
    n2.setToggleGroup(gn);
    ToggleButton n3 = new ToggleButton("Not");
    n3.setToggleGroup(gn);

    TilePane n = new TilePane(n1,n2,n3);


    VBox c = new VBox(k, n);
    c.setAlignment(Pos.CENTER);
    c.setPadding(new Insets(4,4,8,4));
    setCenter(c);


    setBottom(new SaveObjectPane(core) {

        @Override
        public void onCancel() {
            onFinished(false, null, null);
        }

        @Override
        public void onSave(Scope scope, NObject subject) {
            List<String> tags = new ArrayList();

            ToggleButton selectedK = (ToggleButton)gk.getSelectedToggle();
            ToggleButton selectedN = (ToggleButton)gn.getSelectedToggle();
            if (selectedK!=null)
                tags.add(selectedK.getText());
            if (selectedN!=null)
                tags.add(selectedN.getText());

            onFinished(true, subject, tags);
        }

    });
}
项目:lttng-scope    文件:JfxUtils.java   
/**
 * Accessor for the
 * com.sun.javafx.scene.control.skin.Utils.computeClippedText() method.
 *
 * This method implements the logic to clip Label strings. It can be useful
 * for other types, like Text. Unfortunately it is not public, but this
 * accessor allows calling it through reflection. It makes use of
 * {@link MethodHandle#invokeExact}, which should be close to just as fast
 * as a standard compiled method call.
 *
 * @param font
 *            The font of the text that will be used
 * @param text
 *            The string to clip
 * @param width
 *            The maximum width we want to limit the string to
 * @param type
 *            The {@link OverrunStyle}
 * @param ellipsisString
 *            The string to use as ellipsis
 * @return The clipped string, or "ERROR" if an error happened.
 *         Unfortunately we lose the exception typing due to the reflection
 *         call, so we do not want to throw "Throwable" here.
 */
public static String computeClippedText(Font font, String text, double width,
        OverrunStyle type, String ellipsisString) {
    try {
        String str = (String) COMPUTE_CLIPPED_TEXT_HANDLE.invokeExact(font, text, width, type, ellipsisString);
        return requireNonNull(str);
    } catch (Throwable e) {
        return "ERROR"; //$NON-NLS-1$
    }
}
项目:IIITB-LMS-Client-OLD    文件:customCard.java   
public void init(int card_length, int card_breadth, String label, String icon_path) {

    super.setPrefSize(card_length, card_breadth);
    super.getStyleClass().addAll("custom_card");


    card_label = new Label( label );
    card_image = new Image( icon_path );

    card_label.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS);

    card_image_veiw = new ImageView();
    card_image_veiw.setImage( card_image );

    set_image_dim(90, 90);
    show_image(true);

    card_image_veiw.setPreserveRatio(true);
    card_image_veiw.setSmooth(true); // what does this actually do?

    /* Add custom classes for CSS */
    card_image_veiw.getStyleClass().addAll("custom_card_image");
    card_label.getStyleClass().addAll("custom_card_label");

    /* Set alignment */
    StackPane.setAlignment(card_image_veiw, Pos.TOP_CENTER);
    StackPane.setAlignment(card_label, Pos.BOTTOM_CENTER);

    /* Adding to card */
    super.getChildren().addAll(card_image_veiw);
    super.getChildren().addAll(card_label);




}
项目:FxEditor    文件:StandardFxProperties.java   
public static FxCssProp textOverrun(OverrunStyle x) { return new FxCssProp("-fx-text-overrun", CssTools.toColor(x)); }