Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appinventor-sources
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
appinventor-sources
Commits
54fb1a33
Commit
54fb1a33
authored
Aug 14, 2012
by
halatmit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change visibility property editor from a chackbox to a dropdown
parent
c157e77e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
11 deletions
+50
-11
appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/palette/YoungAndroidPalettePanel.java
...editor/youngandroid/palette/YoungAndroidPalettePanel.java
+7
-5
appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/properties/YoungAndroidVisibilityChoicePropertyEditor.java
...roperties/YoungAndroidVisibilityChoicePropertyEditor.java
+28
-0
appinventor/components/src/com/google/appinventor/components/common/PropertyTypeConstants.java
.../appinventor/components/common/PropertyTypeConstants.java
+6
-0
appinventor/components/src/com/google/appinventor/components/runtime/AndroidViewComponent.java
.../appinventor/components/runtime/AndroidViewComponent.java
+9
-6
No files found.
appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/palette/YoungAndroidPalettePanel.java
View file @
54fb1a33
...
...
@@ -2,7 +2,10 @@
package
com.google.appinventor.client.editor.youngandroid.palette
;
import
com.google.appinventor.client.Ode
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.Map
;
import
com.google.appinventor.client.editor.simple.SimpleComponentDatabase
;
import
com.google.appinventor.client.editor.simple.components.MockComponent
;
import
com.google.appinventor.client.editor.simple.palette.DropTargetProvider
;
...
...
@@ -21,6 +24,7 @@ import com.google.appinventor.client.editor.youngandroid.properties.YoungAndroid
import
com.google.appinventor.client.editor.youngandroid.properties.YoungAndroidScreenOrientationChoicePropertyEditor
;
import
com.google.appinventor.client.editor.youngandroid.properties.YoungAndroidSensorDistIntervalChoicePropertyEditor
;
import
com.google.appinventor.client.editor.youngandroid.properties.YoungAndroidSensorTimeIntervalChoicePropertyEditor
;
import
com.google.appinventor.client.editor.youngandroid.properties.YoungAndroidVisibilityChoicePropertyEditor
;
import
com.google.appinventor.client.widgets.properties.FloatPropertyEditor
;
import
com.google.appinventor.client.widgets.properties.IntegerPropertyEditor
;
import
com.google.appinventor.client.widgets.properties.NonNegativeFloatPropertyEditor
;
...
...
@@ -36,10 +40,6 @@ import com.google.gwt.user.client.ui.Composite;
import
com.google.gwt.user.client.ui.StackPanel
;
import
com.google.gwt.user.client.ui.VerticalPanel
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* Panel showing Simple components which can be dropped onto the Young Android
* visual designer panel.
...
...
@@ -180,6 +180,8 @@ public class YoungAndroidPalettePanel extends Composite implements SimplePalette
return
new
YoungAndroidAlignmentChoicePropertyEditor
();
}
else
if
(
editorType
.
equals
(
PropertyTypeConstants
.
PROPERTY_TYPE_TYPEFACE
))
{
return
new
YoungAndroidFontTypefaceChoicePropertyEditor
();
}
else
if
(
editorType
.
equals
(
PropertyTypeConstants
.
PROPERTY_TYPE_VISIBILITY
))
{
return
new
YoungAndroidVisibilityChoicePropertyEditor
();
}
else
{
return
new
TextPropertyEditor
();
}
...
...
appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/properties/YoungAndroidVisibilityChoicePropertyEditor.java
0 → 100644
View file @
54fb1a33
// Copyright 2012 MIT. All Rights Reserved.
package
com.google.appinventor.client.editor.youngandroid.properties
;
import
com.google.appinventor.client.widgets.properties.ChoicePropertyEditor
;
/**
* Property editor for visibility: selects showing or hidden
*
* @author hal@mit.edu (Hal Abelson)
*/
public
class
YoungAndroidVisibilityChoicePropertyEditor
extends
ChoicePropertyEditor
{
//TODO(hal): The values must be True and False. Losercase true and fale do not work here:
// they are not transformed from strings to booleans when passed to the property.
// Figure out why not.
private
static
final
Choice
[]
visibility
=
new
Choice
[]
{
new
Choice
(
"showing"
,
"True"
),
new
Choice
(
"hidden"
,
"False"
),
};
public
YoungAndroidVisibilityChoicePropertyEditor
()
{
super
(
visibility
);
}
}
appinventor/components/src/com/google/appinventor/components/common/PropertyTypeConstants.java
View file @
54fb1a33
...
...
@@ -131,4 +131,10 @@ public class PropertyTypeConstants {
* com.google.appinventor.client.editor.youngandroid.properties.YoungAndroidFontTypefaceChoicePropertyEditor}.
*/
public
static
final
String
PROPERTY_TYPE_TYPEFACE
=
"typeface"
;
/**
* Choices of visibility for view components offered by {@link
* com.google.appinventor.client.editor.youngandroid.properties.YoungAndroidVisibilityChoicePropertyEditor}.
*/
public
static
final
String
PROPERTY_TYPE_VISIBILITY
=
"visibility"
;
}
appinventor/components/src/com/google/appinventor/components/runtime/AndroidViewComponent.java
View file @
54fb1a33
...
...
@@ -47,22 +47,25 @@ public abstract class AndroidViewComponent extends VisibleComponent {
* Returns true iff the component is visible.
* @return true iff the component is visible
*/
@SimpleProperty
(
description
=
"Whether the component is visible"
,
@SimpleProperty
(
category
=
PropertyCategory
.
APPEARANCE
)
public
boolean
Visible
()
{
return
getView
().
getVisibility
()
==
View
.
VISIBLE
;
}
/**
* Specifies whether the component should be visible
* Specifies whether the component should be visible on the screen. Value is true if the
* component is showing and false if hidden.
* @param visible desired state
*/
@DesignerProperty
(
editorType
=
PropertyTypeConstants
.
PROPERTY_TYPE_BOOLEAN
,
defaultValue
=
"True"
)
@SimpleProperty
public
void
Visible
(
boolean
visible
)
{
@DesignerProperty
(
editorType
=
PropertyTypeConstants
.
PROPERTY_TYPE_VISIBILITY
,
defaultValue
=
"True"
)
@SimpleProperty
(
description
=
"Specifies whether the component should be visible on the screen. "
+
"Value is true if the component is showing and false if hidden."
)
public
void
Visible
(
Boolean
visibility
)
{
// The principle of least astonishment suggests we not offer the
// Android option INVISIBLE.
getView
().
setVisibility
(
visib
le
?
View
.
VISIBLE
:
View
.
GONE
);
getView
().
setVisibility
(
visib
ility
?
View
.
VISIBLE
:
View
.
GONE
);
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment