Spec-Zone .ru
спецификации, руководства, описания, API
|
001/* 002 * Copyright (c) 2011, 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.scene.layout; 027 028/** 029 * Enumeration used to determine the grow (or shrink) priority of a given node's 030 * layout area when its region has more (or less) space available and 031 * multiple nodes are competing for that space. 032 * 033 */ 034public enum Priority { 035 /** 036 * Layout area will always try to grow (or shrink), sharing the increase 037 * (or decrease) in space with other layout areas that have a grow 038 * (or shrink) of ALWAYS. 039 */ 040 ALWAYS, 041 042 /** 043 * If there are no other layout areas with grow (or shrink) set to ALWAYS 044 * or those layout areas didn't absorb all of the increased (or decreased) space, 045 * then will share the increase (or decrease) in space with other 046 * layout area's of SOMETIMES. 047 */ 048 SOMETIMES, 049 050 /** 051 * Layout area will never grow (or shrink) when there is an increase (or 052 * decrease) in space available in the region. 053 */ 054 NEVER; 055 056 /** 057 * Convenience method for returning the higher of two priorities. 058 * @param a first priority 059 * @param b second priority 060 * @return the highest of the two priorities 061 */ 062 public static Priority max(Priority a, Priority b) { 063 if (a == ALWAYS || b == ALWAYS) { 064 return ALWAYS; 065 } else if (a == SOMETIMES || b == SOMETIMES) { 066 return SOMETIMES; 067 } else { 068 return NEVER; 069 } 070 } 071 072 /** 073 * Convenience method for returning the lower of two priorities. 074 * @param a first priority 075 * @param b second priority 076 * @return the lower of the two priorities 077 */ 078 public static Priority min(Priority a, Priority b) { 079 if (a == NEVER || b == NEVER) { 080 return NEVER; 081 } else if (a == SOMETIMES || b == SOMETIMES) { 082 return SOMETIMES; 083 } else { 084 return ALWAYS; 085 } 086 } 087}