Java Code Examples for javafx.geometry.Pos#CENTER

The following examples show how to use javafx.geometry.Pos#CENTER . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DisplayPositionSelector.java    From Quelea with GNU General Public License v3.0 6 votes vote down vote up
public static Pos getPosFromIndex(int index) {
    switch (index) {
        case -1:
            return Pos.CENTER;
        case 0:
            return Pos.TOP_LEFT;
        case 1:
            return Pos.TOP_CENTER;
        case 2:
            return Pos.TOP_RIGHT;
        case 3:
            return Pos.CENTER_LEFT;
        case 4:
            return Pos.CENTER;
        case 5:
            return Pos.CENTER_RIGHT;
        case 6:
            return Pos.BOTTOM_LEFT;
        case 7:
            return Pos.BOTTOM_CENTER;
        case 8:
            return Pos.BOTTOM_RIGHT;
        default:
            return Pos.CENTER;
    }
}
 
Example 2
Source File: DotHTMLLabelJavaFxNode.java    From gef with Eclipse Public License 2.0 6 votes vote down vote up
private Pos getAlignPosForAttributeNameAndTag(String attributeName,
		HtmlTag tag) {
	HtmlAttr attr = DotHtmlLabelHelper.getAttributeForTag(tag,
			attributeName);
	if (attr == null) {
		return null;
	}
	switch (unquotedValueForAttr(attr).toLowerCase()) {
	case "right": //$NON-NLS-1$
		return Pos.CENTER_RIGHT;
	case "left": //$NON-NLS-1$
		return Pos.CENTER_LEFT;
	case "center": //$NON-NLS-1$
	default:
		return Pos.CENTER;
	}
}
 
Example 3
Source File: DotRecordBasedJavaFxNode.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Used to initialize this text line with the first line of a record
 * based label
 *
 * @param lines
 *            label of which this object should represent the first line
 * @return remaining string with the first line removed
 */
public String consumeFirstLineOf(String lines) {
	int indexLast = 0;
	do {
		try {
			final int indexNew = lines.indexOf('\\', indexLast);
			if (indexNew < 0)
				throw new IndexOutOfBoundsException();
			switch (lines.charAt(indexNew + 1)) {
			case 'n':
				pos = Pos.CENTER;
				break;
			case 'l':
				pos = Pos.CENTER_LEFT;
				break;
			case 'r':
				pos = Pos.CENTER_RIGHT;
				break;
			default:
				indexLast = indexNew + 1;
				continue;
			}
			line = lines.substring(0, indexNew);
			if (lines.length() > indexNew + 2)
				return lines.substring(indexNew + 2);
			break;
		} catch (IndexOutOfBoundsException e) {
			line = lines;
			break;
		}
	} while (indexLast >= 0);
	return null;
}
 
Example 4
Source File: DotHTMLLabelJavaFxNode.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
private Pos posForTd(String hAlign, String vAlign) {
	switch (hAlign != null ? hAlign.toLowerCase() : "") { //$NON-NLS-1$
	case "left": //$NON-NLS-1$
		switch (vAlign != null ? vAlign.toLowerCase() : "") { //$NON-NLS-1$
		case "top": //$NON-NLS-1$
			return Pos.TOP_LEFT;
		case "bottom": //$NON-NLS-1$
			return Pos.BOTTOM_LEFT;
		case "middle": //$NON-NLS-1$
		default:
			return Pos.CENTER_LEFT;
		}
	case "right": //$NON-NLS-1$
		switch (vAlign != null ? vAlign.toLowerCase() : "") { //$NON-NLS-1$
		case "top": //$NON-NLS-1$
			return Pos.TOP_RIGHT;
		case "bottom": //$NON-NLS-1$
			return Pos.BOTTOM_RIGHT;
		case "middle": //$NON-NLS-1$
		default:
			return Pos.CENTER_RIGHT;
		}
	case "center": //$NON-NLS-1$
	case "text": //$NON-NLS-1$
	default:
		switch (vAlign != null ? vAlign.toLowerCase() : "") { //$NON-NLS-1$
		case "top": //$NON-NLS-1$
			return Pos.TOP_CENTER;
		case "bottom": //$NON-NLS-1$
			return Pos.BOTTOM_CENTER;
		case "middle": //$NON-NLS-1$
		default:
			return Pos.CENTER;
		}
	}
}
 
Example 5
Source File: DotRecordBasedLabelFxPrettyPrinter.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
private String printAttributes(Node fxNode, String startIndent) {
	StringBuilder sb = new StringBuilder();

	String style = fxNode.getStyle();
	if (style != null && style.length() > 0) {
		sb.append(startIndent);
		sb.append("style : ");
		sb.append(fxNode.getStyle());
		sb.append(lineSeparator);
	}

	if (fxNode instanceof HBox || fxNode instanceof VBox) {
		Pos alignment = fxNode instanceof HBox
				? ((HBox) fxNode).getAlignment()
				: ((VBox) fxNode).getAlignment();
		if (alignment != Pos.CENTER) {
			sb.append(startIndent);
			sb.append("alignment : ");
			sb.append(alignment);
			sb.append(lineSeparator);
		}
	}

	if (fxNode instanceof Pane) {
		for (Node node : ((Pane) fxNode).getChildren()) {
			sb.append(prettyPrint(node, startIndent));
		}
	}

	if (fxNode instanceof Text) {
		sb.append(startIndent);
		sb.append("text : ");
		sb.append(((Text) fxNode).getText());
		sb.append(lineSeparator);
	}

	return sb.toString();
}
 
Example 6
Source File: DotHTMLLabelJavaFxNode.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
public FormattedLine(Pos bAlign) {
	defaultAlignment = bAlign != null ? bAlign : Pos.CENTER;
}