001 /*
002 * Copyright 2006 Google Inc.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005 * use this file except in compliance with the License. You may obtain a copy of
006 * the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013 * License for the specific language governing permissions and limitations under
014 * the License.
015 */
016 package com.google.gwt.user.client.ui;
017
018 /**
019 * Characteristic interface which indicates that a widget can be aligned
020 * horizontally.
021 */
022 public interface HasHorizontalAlignment {
023
024 /**
025 * Horizontal alignment constant.
026 */
027 public static class HorizontalAlignmentConstant {
028 private String textAlignString;
029
030 private HorizontalAlignmentConstant(String textAlignString) {
031 this.textAlignString = textAlignString;
032 }
033
034 /**
035 * Gets the CSS 'text-align' string associated with this constant.
036 *
037 * @return the CSS 'text-align' value
038 */
039 public String getTextAlignString() {
040 return textAlignString;
041 }
042 }
043
044 /**
045 * Specifies that the widget's contents should be aligned in the center.
046 */
047 public static final HorizontalAlignmentConstant ALIGN_CENTER = new HorizontalAlignmentConstant(
048 "center");
049
050 /**
051 * Specifies that the widget's contents should be aligned to the left.
052 */
053 public static final HorizontalAlignmentConstant ALIGN_LEFT = new HorizontalAlignmentConstant(
054 "left");
055
056 /**
057 * Specifies that the widget's contents should be aligned to the right.
058 */
059 public static final HorizontalAlignmentConstant ALIGN_RIGHT = new HorizontalAlignmentConstant(
060 "right");
061
062 /**
063 * Gets the horizontal alignment.
064 *
065 * @return the current horizontal alignment.
066 */
067 public HorizontalAlignmentConstant getHorizontalAlignment();
068
069 /**
070 * Sets the horizontal alignment.
071 *
072 * @param align the horizontal alignment (
073 * {@link HasHorizontalAlignment#ALIGN_LEFT},
074 * {@link HasHorizontalAlignment#ALIGN_CENTER}, or
075 * {@link HasHorizontalAlignment#ALIGN_RIGHT}).
076 */
077 public void setHorizontalAlignment(HorizontalAlignmentConstant align);
078 }