AI2 Component  (Version nb184)
Component.java
Go to the documentation of this file.
1 // -*- mode: java; c-basic-offset: 2; -*-
2 // Copyright 2009-2011 Google, All Rights reserved
3 // Copyright 2011-2012 MIT, All rights reserved
4 // Released under the Apache License, Version 2.0
5 // http://www.apache.org/licenses/LICENSE-2.0
6 
7 package com.google.appinventor.components.runtime;
8 
11 
16 @SimpleObject
17 public interface Component {
23 
24  /*
25  * Components asset directory.
26  */
27  public static final String ASSET_DIRECTORY = "component";
28 
29  /*
30  * Text alignment constants.
31  */
32  static final int ALIGNMENT_NORMAL = 0;
33  static final int ALIGNMENT_CENTER = 1;
34  static final int ALIGNMENT_OPPOSITE = 2;
35 
36  /*
37  * Accelerometer sensitivity.
38  */
39  static final int ACCELEROMETER_SENSITIVITY_WEAK = 1;
40  static final int ACCELEROMETER_SENSITIVITY_MODERATE = 2;
41  static final int ACCELEROMETER_SENSITIVITY_STRONG = 3;
42 
43  /*
44  * Button Styles.
45  */
46  static final int BUTTON_SHAPE_DEFAULT = 0;
47  static final int BUTTON_SHAPE_ROUNDED = 1;
48  static final int BUTTON_SHAPE_RECT = 2;
49  static final int BUTTON_SHAPE_OVAL = 3;
50 
51  /*
52  * Color constants.
53  */
54  static final int COLOR_NONE = 0x00FFFFFF;
55  static final int COLOR_BLACK = 0xFF000000;
56  static final int COLOR_BLUE = 0xFF0000FF;
57  static final int COLOR_CYAN = 0xFF00FFFF;
58  static final int COLOR_DKGRAY = 0xFF444444;
59  static final int COLOR_GRAY = 0xFF888888;
60  static final int COLOR_GREEN = 0xFF00FF00;
61  static final int COLOR_LTGRAY = 0xFFCCCCCC;
62  static final int COLOR_MAGENTA = 0xFFFF00FF;
63  static final int COLOR_ORANGE = 0xFFFFC800;
64  static final int COLOR_PINK = 0xFFFFAFAF;
65  static final int COLOR_RED = 0xFFFF0000;
66  static final int COLOR_WHITE = 0xFFFFFFFF;
67  static final int COLOR_YELLOW = 0xFFFFFF00;
68  static final int COLOR_DEFAULT = 0x00000000;
69 
70  static final String DEFAULT_VALUE_COLOR_NONE = "&H00FFFFFF";
71  static final String DEFAULT_VALUE_COLOR_BLACK = "&HFF000000";
72  static final String DEFAULT_VALUE_COLOR_BLUE = "&HFF0000FF";
73  static final String DEFAULT_VALUE_COLOR_CYAN = "&HFF00FFFF";
74  static final String DEFAULT_VALUE_COLOR_DKGRAY = "&HFF444444";
75  static final String DEFAULT_VALUE_COLOR_GRAY = "&HFF888888";
76  static final String DEFAULT_VALUE_COLOR_GREEN = "&HFF00FF00";
77  static final String DEFAULT_VALUE_COLOR_LTGRAY = "&HFFCCCCCC";
78  static final String DEFAULT_VALUE_COLOR_MAGENTA = "&HFFFF00FF";
79  static final String DEFAULT_VALUE_COLOR_ORANGE = "&HFFFFC800";
80  static final String DEFAULT_VALUE_COLOR_PINK = "&HFFFFAFAF";
81  static final String DEFAULT_VALUE_COLOR_RED = "&HFFFF0000";
82  static final String DEFAULT_VALUE_COLOR_WHITE = "&HFFFFFFFF";
83  static final String DEFAULT_VALUE_COLOR_YELLOW = "&HFFFFFF00";
84  static final String DEFAULT_VALUE_COLOR_DEFAULT = "&H00000000";
85 
86  /*
87  * Font constants.
88  */
89  static final float FONT_DEFAULT_SIZE = 14;
90 
91  /*
92  * Layout constants.
93  */
96 
97  /*
98  * Picture scaling constants.
99  */
100  static final int SCALING_SCALE_PROPORTIONALLY = 0;
101  static final int SCALING_SCALE_TO_FIT = 1;
102 
103  /*
104  * Typeface constants.
105  */
106  static final int TYPEFACE_DEFAULT = 0;
107  static final int TYPEFACE_SANSSERIF = 1;
108  static final int TYPEFACE_SERIF = 2;
109  static final int TYPEFACE_MONOSPACE = 3;
110 
111  /*
112  * Length constants (for width and height).
113  */
114 
115  // Note: the values below are duplicated in MockVisibleComponent.java
116  // If you change them here, change them there!
117 
118  static final int LENGTH_PREFERRED = -1;
119  static final int LENGTH_FILL_PARENT = -2;
120  static final int LENGTH_UNKNOWN = -3;
121  // If the length is <= -1000 then add 1000 and change the sign to
122  // get the length is percent of Screen1
123  static final int LENGTH_PERCENT_TAG = -1000;
124 
125  /*
126  * Length constants for toast.
127  */
128  static final int TOAST_LENGTH_SHORT = 0;
129  static final int TOAST_LENGTH_LONG = 1;
130 
131  /*
132  * Screen direction constants.
133  * Observe that opposite directions have the same magnitude but opposite signs.
134  */
135  static final int DIRECTION_NORTH = 1;
136  static final int DIRECTION_NORTHEAST = 2;
137  static final int DIRECTION_EAST = 3;
138  static final int DIRECTION_SOUTHEAST = 4;
139  static final int DIRECTION_SOUTH = -1;
140  static final int DIRECTION_SOUTHWEST = -2;
141  static final int DIRECTION_WEST = -3;
142  static final int DIRECTION_NORTHWEST = -4;
143  // Special values
144  static final int DIRECTION_NONE = 0;
145  static final int DIRECTION_MIN = -4;
146  static final int DIRECTION_MAX = 4;
147 
148  //Slider defaults for setting MinimumValue and MaximumValue
149  public static float SLIDER_MIN_VALUE = 10;
150  public static float SLIDER_MAX_VALUE = 50;
151  public static float SLIDER_THUMB_VALUE = (SLIDER_MIN_VALUE + SLIDER_MAX_VALUE) / 2.0f;
152 
153  static final String DEFAULT_VALUE_TEXT_TO_SPEECH_COUNTRY = "";
154  static final String DEFAULT_VALUE_TEXT_TO_SPEECH_LANGUAGE = "";
155 
156 }
com.google.appinventor.components.runtime.Component.DEFAULT_VALUE_COLOR_CYAN
static final String DEFAULT_VALUE_COLOR_CYAN
Definition: Component.java:73
com.google.appinventor.components.runtime.Component.COLOR_MAGENTA
static final int COLOR_MAGENTA
Definition: Component.java:62
com.google.appinventor.components.runtime.Component.COLOR_GREEN
static final int COLOR_GREEN
Definition: Component.java:60
com.google.appinventor.components.runtime.Component.COLOR_DEFAULT
static final int COLOR_DEFAULT
Definition: Component.java:68
com.google.appinventor.components.runtime.HandlesEventDispatching
Definition: HandlesEventDispatching.java:15
com.google.appinventor.components.runtime.Component.COLOR_BLUE
static final int COLOR_BLUE
Definition: Component.java:56
com.google.appinventor.components.runtime.Component.DEFAULT_VALUE_COLOR_YELLOW
static final String DEFAULT_VALUE_COLOR_YELLOW
Definition: Component.java:83
com.google.appinventor.components.runtime.Component.DEFAULT_VALUE_COLOR_NONE
static final String DEFAULT_VALUE_COLOR_NONE
Definition: Component.java:70
com.google.appinventor.components.runtime.Component.BUTTON_SHAPE_RECT
static final int BUTTON_SHAPE_RECT
Definition: Component.java:48
com.google.appinventor.components.runtime.Component.COLOR_DKGRAY
static final int COLOR_DKGRAY
Definition: Component.java:58
com.google.appinventor.components
com.google.appinventor.components.runtime.Component.DEFAULT_VALUE_COLOR_WHITE
static final String DEFAULT_VALUE_COLOR_WHITE
Definition: Component.java:82
com.google.appinventor.components.runtime.Component.SLIDER_MIN_VALUE
static float SLIDER_MIN_VALUE
Definition: Component.java:149
com.google.appinventor.components.runtime.Component.LENGTH_UNKNOWN
static final int LENGTH_UNKNOWN
Definition: Component.java:120
com.google.appinventor.components.runtime.Component.DEFAULT_VALUE_COLOR_DKGRAY
static final String DEFAULT_VALUE_COLOR_DKGRAY
Definition: Component.java:74
com.google.appinventor.components.runtime.Component.DIRECTION_SOUTH
static final int DIRECTION_SOUTH
Definition: Component.java:139
com.google.appinventor.components.runtime.Component.LENGTH_FILL_PARENT
static final int LENGTH_FILL_PARENT
Definition: Component.java:119
com.google.appinventor.components.runtime.Component.COLOR_LTGRAY
static final int COLOR_LTGRAY
Definition: Component.java:61
com.google.appinventor.components.runtime.Component.DIRECTION_NORTHWEST
static final int DIRECTION_NORTHWEST
Definition: Component.java:142
com.google.appinventor.components.runtime.Component.TYPEFACE_SERIF
static final int TYPEFACE_SERIF
Definition: Component.java:108
com.google.appinventor.components.runtime.Component.COLOR_YELLOW
static final int COLOR_YELLOW
Definition: Component.java:67
com.google.appinventor.components.runtime.Component.DIRECTION_WEST
static final int DIRECTION_WEST
Definition: Component.java:141
com.google.appinventor.components.runtime.Component.LENGTH_PERCENT_TAG
static final int LENGTH_PERCENT_TAG
Definition: Component.java:123
com.google.appinventor.components.runtime.Component.SCALING_SCALE_PROPORTIONALLY
static final int SCALING_SCALE_PROPORTIONALLY
Definition: Component.java:100
com.google.appinventor.components.runtime.Component.ACCELEROMETER_SENSITIVITY_WEAK
static final int ACCELEROMETER_SENSITIVITY_WEAK
Definition: Component.java:39
com.google.appinventor.components.runtime.Component.getDispatchDelegate
HandlesEventDispatching getDispatchDelegate()
com.google.appinventor.components.runtime.Component.DIRECTION_MAX
static final int DIRECTION_MAX
Definition: Component.java:146
com.google.appinventor.components.runtime.Component.LAYOUT_ORIENTATION_VERTICAL
static final int LAYOUT_ORIENTATION_VERTICAL
Definition: Component.java:95
com.google.appinventor.components.runtime.Component.ACCELEROMETER_SENSITIVITY_STRONG
static final int ACCELEROMETER_SENSITIVITY_STRONG
Definition: Component.java:41
com.google.appinventor.components.runtime.Component.DEFAULT_VALUE_COLOR_ORANGE
static final String DEFAULT_VALUE_COLOR_ORANGE
Definition: Component.java:79
com.google.appinventor.components.runtime.Component.COLOR_RED
static final int COLOR_RED
Definition: Component.java:65
com.google.appinventor.components.runtime.Component.DIRECTION_NONE
static final int DIRECTION_NONE
Definition: Component.java:144
com.google.appinventor.components.runtime.Component.DEFAULT_VALUE_COLOR_DEFAULT
static final String DEFAULT_VALUE_COLOR_DEFAULT
Definition: Component.java:84
com.google.appinventor.components.runtime.Component.BUTTON_SHAPE_ROUNDED
static final int BUTTON_SHAPE_ROUNDED
Definition: Component.java:47
com.google.appinventor.components.runtime.Component.DEFAULT_VALUE_COLOR_GRAY
static final String DEFAULT_VALUE_COLOR_GRAY
Definition: Component.java:75
com.google.appinventor.components.runtime.Component.SCALING_SCALE_TO_FIT
static final int SCALING_SCALE_TO_FIT
Definition: Component.java:101
com.google.appinventor.components.runtime.Component.COLOR_NONE
static final int COLOR_NONE
Definition: Component.java:54
com.google.appinventor.components.runtime.Component.DIRECTION_SOUTHWEST
static final int DIRECTION_SOUTHWEST
Definition: Component.java:140
com.google.appinventor.components.runtime.Component.LAYOUT_ORIENTATION_HORIZONTAL
static final int LAYOUT_ORIENTATION_HORIZONTAL
Definition: Component.java:94
com.google.appinventor.components.runtime.Component.COLOR_ORANGE
static final int COLOR_ORANGE
Definition: Component.java:63
com.google.appinventor.components.runtime.Component.BUTTON_SHAPE_DEFAULT
static final int BUTTON_SHAPE_DEFAULT
Definition: Component.java:46
com.google.appinventor.components.runtime.Component.LENGTH_PREFERRED
static final int LENGTH_PREFERRED
Definition: Component.java:118
com.google.appinventor.components.runtime.Component.DEFAULT_VALUE_COLOR_MAGENTA
static final String DEFAULT_VALUE_COLOR_MAGENTA
Definition: Component.java:78
com.google.appinventor.components.runtime.Component.DEFAULT_VALUE_COLOR_PINK
static final String DEFAULT_VALUE_COLOR_PINK
Definition: Component.java:80
com.google.appinventor.components.runtime.Component.COLOR_BLACK
static final int COLOR_BLACK
Definition: Component.java:55
com.google.appinventor.components.runtime.Component.DIRECTION_NORTH
static final int DIRECTION_NORTH
Definition: Component.java:135
com.google.appinventor.components.runtime.Component
Definition: Component.java:17
com.google.appinventor.components.runtime.Component.ALIGNMENT_NORMAL
static final int ALIGNMENT_NORMAL
Definition: Component.java:32
com.google.appinventor.components.runtime.Component.COLOR_CYAN
static final int COLOR_CYAN
Definition: Component.java:57
com.google.appinventor.components.runtime.Component.DEFAULT_VALUE_COLOR_BLUE
static final String DEFAULT_VALUE_COLOR_BLUE
Definition: Component.java:72
com.google.appinventor.components.common
Definition: ComponentCategory.java:7
com.google.appinventor.components.runtime.Component.COLOR_GRAY
static final int COLOR_GRAY
Definition: Component.java:59
com.google.appinventor.components.runtime.Component.BUTTON_SHAPE_OVAL
static final int BUTTON_SHAPE_OVAL
Definition: Component.java:49
com.google.appinventor.components.runtime.Component.TYPEFACE_DEFAULT
static final int TYPEFACE_DEFAULT
Definition: Component.java:106
com.google.appinventor.components.runtime.Component.DEFAULT_VALUE_TEXT_TO_SPEECH_LANGUAGE
static final String DEFAULT_VALUE_TEXT_TO_SPEECH_LANGUAGE
Definition: Component.java:154
com.google.appinventor.components.runtime.Component.DIRECTION_NORTHEAST
static final int DIRECTION_NORTHEAST
Definition: Component.java:136
com.google.appinventor.components.common.ComponentConstants.LAYOUT_ORIENTATION_HORIZONTAL
static final int LAYOUT_ORIENTATION_HORIZONTAL
Definition: ComponentConstants.java:26
com.google.appinventor.components.annotations.SimpleObject
Definition: SimpleObject.java:23
com.google.appinventor.components.runtime.Component.COLOR_WHITE
static final int COLOR_WHITE
Definition: Component.java:66
com.google
com
com.google.appinventor.components.runtime.Component.DEFAULT_VALUE_TEXT_TO_SPEECH_COUNTRY
static final String DEFAULT_VALUE_TEXT_TO_SPEECH_COUNTRY
Definition: Component.java:153
com.google.appinventor.components.runtime.Component.TYPEFACE_MONOSPACE
static final int TYPEFACE_MONOSPACE
Definition: Component.java:109
com.google.appinventor.components.runtime.Component.DEFAULT_VALUE_COLOR_LTGRAY
static final String DEFAULT_VALUE_COLOR_LTGRAY
Definition: Component.java:77
com.google.appinventor.components.runtime.Component.SLIDER_MAX_VALUE
static float SLIDER_MAX_VALUE
Definition: Component.java:150
com.google.appinventor.components.common.ComponentConstants
Definition: ComponentConstants.java:13
com.google.appinventor.components.runtime.Component.DIRECTION_MIN
static final int DIRECTION_MIN
Definition: Component.java:145
com.google.appinventor.components.runtime.Component.ASSET_DIRECTORY
static final String ASSET_DIRECTORY
Definition: Component.java:27
com.google.appinventor.components.runtime.Component.TOAST_LENGTH_LONG
static final int TOAST_LENGTH_LONG
Definition: Component.java:129
com.google.appinventor.components.runtime.Component.DIRECTION_EAST
static final int DIRECTION_EAST
Definition: Component.java:137
com.google.appinventor.components.common.ComponentConstants.LAYOUT_ORIENTATION_VERTICAL
static final int LAYOUT_ORIENTATION_VERTICAL
Definition: ComponentConstants.java:27
com.google.appinventor.components.runtime.Component.DIRECTION_SOUTHEAST
static final int DIRECTION_SOUTHEAST
Definition: Component.java:138
com.google.appinventor.components.runtime.Component.ACCELEROMETER_SENSITIVITY_MODERATE
static final int ACCELEROMETER_SENSITIVITY_MODERATE
Definition: Component.java:40
com.google.appinventor.components.runtime.Component.TOAST_LENGTH_SHORT
static final int TOAST_LENGTH_SHORT
Definition: Component.java:128
com.google.appinventor.components.runtime.Component.COLOR_PINK
static final int COLOR_PINK
Definition: Component.java:64
com.google.appinventor.components.runtime.Component.DEFAULT_VALUE_COLOR_GREEN
static final String DEFAULT_VALUE_COLOR_GREEN
Definition: Component.java:76
com.google.appinventor.components.runtime.Component.TYPEFACE_SANSSERIF
static final int TYPEFACE_SANSSERIF
Definition: Component.java:107
com.google.appinventor.components.runtime.Component.DEFAULT_VALUE_COLOR_RED
static final String DEFAULT_VALUE_COLOR_RED
Definition: Component.java:81
com.google.appinventor.components.runtime.Component.FONT_DEFAULT_SIZE
static final float FONT_DEFAULT_SIZE
Definition: Component.java:89
com.google.appinventor.components.annotations
com.google.appinventor.components.runtime.Component.DEFAULT_VALUE_COLOR_BLACK
static final String DEFAULT_VALUE_COLOR_BLACK
Definition: Component.java:71
com.google.appinventor.components.runtime.Component.SLIDER_THUMB_VALUE
static float SLIDER_THUMB_VALUE
Definition: Component.java:151
com.google.appinventor.components.runtime.Component.ALIGNMENT_OPPOSITE
static final int ALIGNMENT_OPPOSITE
Definition: Component.java:34
com.google.appinventor
com.google.appinventor.components.runtime.Component.ALIGNMENT_CENTER
static final int ALIGNMENT_CENTER
Definition: Component.java:33