01: /*
02: * Copyright 2006 Google Inc.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
05: * use this file except in compliance with the License. You may obtain a copy of
06: * the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13: * License for the specific language governing permissions and limitations under
14: * the License.
15: */
16: package com.google.gwt.user.client.ui;
17:
18: /**
19: * Characteristic interface which indicates that a widget can be aligned
20: * horizontally.
21: */
22: public interface HasHorizontalAlignment {
23:
24: /**
25: * Horizontal alignment constant.
26: */
27: public static class HorizontalAlignmentConstant {
28: private String textAlignString;
29:
30: private HorizontalAlignmentConstant(String textAlignString) {
31: this .textAlignString = textAlignString;
32: }
33:
34: /**
35: * Gets the CSS 'text-align' string associated with this constant.
36: *
37: * @return the CSS 'text-align' value
38: */
39: public String getTextAlignString() {
40: return textAlignString;
41: }
42: }
43:
44: /**
45: * Specifies that the widget's contents should be aligned in the center.
46: */
47: public static final HorizontalAlignmentConstant ALIGN_CENTER = new HorizontalAlignmentConstant(
48: "center");
49:
50: /**
51: * Specifies that the widget's contents should be aligned to the left.
52: */
53: public static final HorizontalAlignmentConstant ALIGN_LEFT = new HorizontalAlignmentConstant(
54: "left");
55:
56: /**
57: * Specifies that the widget's contents should be aligned to the right.
58: */
59: public static final HorizontalAlignmentConstant ALIGN_RIGHT = new HorizontalAlignmentConstant(
60: "right");
61:
62: /**
63: * Gets the horizontal alignment.
64: *
65: * @return the current horizontal alignment.
66: */
67: public HorizontalAlignmentConstant getHorizontalAlignment();
68:
69: /**
70: * Sets the horizontal alignment.
71: *
72: * @param align the horizontal alignment (
73: * {@link HasHorizontalAlignment#ALIGN_LEFT},
74: * {@link HasHorizontalAlignment#ALIGN_CENTER}, or
75: * {@link HasHorizontalAlignment#ALIGN_RIGHT}).
76: */
77: public void setHorizontalAlignment(HorizontalAlignmentConstant align);
78: }
|