Spec-Zone .ru
спецификации, руководства, описания, API
001/*
002 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation.  Oracle designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Oracle in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
022 * or visit www.oracle.com if you need additional information or have any
023 * questions.
024 */
025
026package javafx.geometry;
027
028import static javafx.geometry.HPos.LEFT;
029import static javafx.geometry.HPos.RIGHT;
030import static javafx.geometry.VPos.BASELINE;
031import static javafx.geometry.VPos.BOTTOM;
032import static javafx.geometry.VPos.TOP;
033
034/**
035 * A set of values for describing vertical and horizontal positioning and
036 * alignment.
037 * 
038 */
039public enum Pos {
040
041    /**
042     * Represents positioning on the top vertically and on the left horizontally.
043     */
044    TOP_LEFT(TOP, LEFT),
045    
046    /**
047     * Represents positioning on the top vertically and on the center horizontally.
048     */
049    TOP_CENTER(TOP, HPos.CENTER),
050    
051    /**
052     * Represents positioning on the top vertically and on the right horizontally.
053     */
054    TOP_RIGHT(TOP, RIGHT),
055    
056    /**
057     * Represents positioning on the center vertically and on the left horizontally.
058     */
059    CENTER_LEFT(VPos.CENTER, LEFT),
060    
061    /**
062     * Represents positioning on the center both vertically and horizontally.
063     */
064    CENTER(VPos.CENTER, HPos.CENTER),
065    
066    /**
067     * Represents positioning on the center vertically and on the right horizontally.
068     */
069    CENTER_RIGHT(VPos.CENTER, RIGHT),
070    
071    /**
072     * Represents positioning on the bottom vertically and on the left horizontally.
073     */
074    BOTTOM_LEFT(BOTTOM, LEFT),
075    
076    /**
077     * Represents positioning on the bottom vertically and on the center horizontally.
078     */
079    BOTTOM_CENTER(BOTTOM, HPos.CENTER),
080    
081    /**
082     * Represents positioning on the bottom vertically and on the right horizontally.
083     */
084    BOTTOM_RIGHT(BOTTOM, RIGHT),
085    
086    /**
087     * Represents positioning on the baseline vertically and on the left horizontally.
088     */
089    BASELINE_LEFT(BASELINE, LEFT),
090    
091    /**
092     * Represents positioning on the baseline vertically and on the center horizontally.
093     */
094    BASELINE_CENTER(BASELINE, HPos.CENTER),
095    
096    /**
097     * Represents positioning on the baseline vertically and on the right horizontally.
098     */
099    BASELINE_RIGHT(BASELINE, RIGHT);
100    
101    private final VPos vpos;
102    private final HPos hpos;
103
104    private Pos(VPos vpos, HPos hpos) {
105        this.vpos = vpos;
106        this.hpos = hpos;
107    }
108
109    /**
110     * Returns the vertical positioning/alignment.
111     * @return the vertical positioning/alignment.
112     */
113    public VPos getVpos() {
114        return vpos;
115    }
116
117    /**
118     * Returns the horizontal positioning/alignment.
119     * @return the horizontal positioning/alignment.
120     */
121    public HPos getHpos() {
122        return hpos;
123    }
124}