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
3776bb0a
Commit
3776bb0a
authored
Sep 24, 2019
by
Evan W. Patton
Committed by
Susan Rati Lane
Sep 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cancel focusing on TreeItems in Tree widgets (#1848)
Change-Id: Ib3e663aae8135694ddf423611ebcf7a7caffbd39
parent
43a74f92
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
5 deletions
+49
-5
appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockComponent.java
...ventor/client/editor/simple/components/MockComponent.java
+29
-1
appinventor/appengine/src/com/google/appinventor/client/explorer/SourceStructureExplorer.java
.../appinventor/client/explorer/SourceStructureExplorer.java
+1
-0
appinventor/appengine/src/com/google/appinventor/client/explorer/project/ProjectNodeContextMenu.java
...entor/client/explorer/project/ProjectNodeContextMenu.java
+4
-3
appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/AssetList.java
...e/appinventor/client/explorer/youngandroid/AssetList.java
+15
-1
No files found.
appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockComponent.java
View file @
3776bb0a
...
@@ -63,6 +63,7 @@ import com.google.gwt.user.client.Window;
...
@@ -63,6 +63,7 @@ import com.google.gwt.user.client.Window;
import
com.google.gwt.user.client.ui.Button
;
import
com.google.gwt.user.client.ui.Button
;
import
com.google.gwt.user.client.ui.Composite
;
import
com.google.gwt.user.client.ui.Composite
;
import
com.google.gwt.user.client.ui.DialogBox
;
import
com.google.gwt.user.client.ui.DialogBox
;
import
com.google.gwt.user.client.ui.Focusable
;
import
com.google.gwt.user.client.ui.HTML
;
import
com.google.gwt.user.client.ui.HTML
;
import
com.google.gwt.user.client.ui.HorizontalPanel
;
import
com.google.gwt.user.client.ui.HorizontalPanel
;
import
com.google.gwt.user.client.ui.Image
;
import
com.google.gwt.user.client.ui.Image
;
...
@@ -739,6 +740,28 @@ public abstract class MockComponent extends Composite implements PropertyChangeL
...
@@ -739,6 +740,28 @@ public abstract class MockComponent extends Composite implements PropertyChangeL
return
container
;
return
container
;
}
}
private
final
Focusable
nullFocusable
=
new
Focusable
()
{
@Override
public
int
getTabIndex
()
{
return
0
;
}
@Override
public
void
setAccessKey
(
char
key
)
{
}
@Override
public
void
setFocus
(
boolean
focused
)
{
}
@Override
public
void
setTabIndex
(
int
index
)
{
}
};
/**
/**
* Constructs a tree item for the component which will be displayed in the
* Constructs a tree item for the component which will be displayed in the
* source structure explorer.
* source structure explorer.
...
@@ -751,7 +774,12 @@ public abstract class MockComponent extends Composite implements PropertyChangeL
...
@@ -751,7 +774,12 @@ public abstract class MockComponent extends Composite implements PropertyChangeL
// used to get HTML for the iconImage. AbstractImagePrototype requires
// used to get HTML for the iconImage. AbstractImagePrototype requires
// an ImageResource, which we don't necessarily have.
// an ImageResource, which we don't necessarily have.
TreeItem
itemNode
=
new
TreeItem
(
TreeItem
itemNode
=
new
TreeItem
(
new
HTML
(
"<span>"
+
iconImage
.
getElement
().
getString
()
+
getName
()
+
"</span>"
));
new
HTML
(
"<span>"
+
iconImage
.
getElement
().
getString
()
+
getName
()
+
"</span>"
))
{
@Override
protected
Focusable
getFocusable
()
{
return
nullFocusable
;
}
};
itemNode
.
setUserObject
(
sourceStructureExplorerItem
);
itemNode
.
setUserObject
(
sourceStructureExplorerItem
);
return
itemNode
;
return
itemNode
;
}
}
...
...
appinventor/appengine/src/com/google/appinventor/client/explorer/SourceStructureExplorer.java
View file @
3776bb0a
...
@@ -37,6 +37,7 @@ public class SourceStructureExplorer extends Composite {
...
@@ -37,6 +37,7 @@ public class SourceStructureExplorer extends Composite {
// Initialize UI elements
// Initialize UI elements
tree
=
new
Tree
(
Ode
.
getImageBundle
());
tree
=
new
Tree
(
Ode
.
getImageBundle
());
tree
.
setAnimationEnabled
(
true
);
tree
.
setAnimationEnabled
(
true
);
tree
.
setScrollOnSelectEnabled
(
false
);
tree
.
addCloseHandler
(
new
CloseHandler
<
TreeItem
>()
{
tree
.
addCloseHandler
(
new
CloseHandler
<
TreeItem
>()
{
@Override
@Override
public
void
onClose
(
CloseEvent
<
TreeItem
>
event
)
{
public
void
onClose
(
CloseEvent
<
TreeItem
>
event
)
{
...
...
appinventor/appengine/src/com/google/appinventor/client/explorer/project/ProjectNodeContextMenu.java
View file @
3776bb0a
...
@@ -12,6 +12,7 @@ import com.google.appinventor.client.explorer.commands.ProjectNodeCommand;
...
@@ -12,6 +12,7 @@ import com.google.appinventor.client.explorer.commands.ProjectNodeCommand;
import
com.google.appinventor.client.widgets.ContextMenu
;
import
com.google.appinventor.client.widgets.ContextMenu
;
import
com.google.appinventor.shared.rpc.project.ProjectNode
;
import
com.google.appinventor.shared.rpc.project.ProjectNode
;
import
com.google.gwt.user.client.Command
;
import
com.google.gwt.user.client.Command
;
import
com.google.gwt.user.client.Window
;
import
com.google.gwt.user.client.ui.Widget
;
import
com.google.gwt.user.client.ui.Widget
;
import
java.util.List
;
import
java.util.List
;
...
@@ -31,7 +32,7 @@ public final class ProjectNodeContextMenu {
...
@@ -31,7 +32,7 @@ public final class ProjectNodeContextMenu {
* @param node node for which to show the context menu
* @param node node for which to show the context menu
* @param host widget to anchor context menu to
* @param host widget to anchor context menu to
*/
*/
public
static
void
show
(
final
ProjectNode
node
,
Widget
host
)
{
public
static
void
show
(
final
ProjectNode
node
,
Widget
host
,
int
clientX
,
int
clientY
)
{
List
<
CommandRegistry
.
Entry
>
entries
=
Ode
.
getCommandRegistry
().
get
(
node
);
List
<
CommandRegistry
.
Entry
>
entries
=
Ode
.
getCommandRegistry
().
get
(
node
);
if
(
entries
.
isEmpty
())
{
if
(
entries
.
isEmpty
())
{
...
@@ -40,8 +41,8 @@ public final class ProjectNodeContextMenu {
...
@@ -40,8 +41,8 @@ public final class ProjectNodeContextMenu {
final
ContextMenu
menu
=
new
ContextMenu
();
final
ContextMenu
menu
=
new
ContextMenu
();
// Position the context menu to the East of the host widget.
// Position the context menu to the East of the host widget.
menu
.
setPopupPosition
(
host
.
getAbsoluteLeft
()
+
host
.
getOffsetWidth
()
,
menu
.
setPopupPosition
(
Window
.
getScrollLeft
()
+
clientX
,
host
.
getAbsoluteTop
()
);
Window
.
getScrollTop
()
+
clientY
);
for
(
final
CommandRegistry
.
Entry
entry
:
entries
)
{
for
(
final
CommandRegistry
.
Entry
entry
:
entries
)
{
final
ProjectNodeCommand
cmd
=
entry
.
getCommand
();
final
ProjectNodeCommand
cmd
=
entry
.
getCommand
();
...
...
appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/AssetList.java
View file @
3776bb0a
...
@@ -22,8 +22,11 @@ import com.google.appinventor.shared.rpc.project.youngandroid.YoungAndroidProjec
...
@@ -22,8 +22,11 @@ import com.google.appinventor.shared.rpc.project.youngandroid.YoungAndroidProjec
import
com.google.appinventor.shared.storage.StorageUtil
;
import
com.google.appinventor.shared.storage.StorageUtil
;
import
com.google.gwt.event.dom.client.ClickEvent
;
import
com.google.gwt.event.dom.client.ClickEvent
;
import
com.google.gwt.event.dom.client.ClickHandler
;
import
com.google.gwt.event.dom.client.ClickHandler
;
import
com.google.gwt.event.dom.client.MouseMoveEvent
;
import
com.google.gwt.event.dom.client.MouseMoveHandler
;
import
com.google.gwt.event.logical.shared.SelectionEvent
;
import
com.google.gwt.event.logical.shared.SelectionEvent
;
import
com.google.gwt.event.logical.shared.SelectionHandler
;
import
com.google.gwt.event.logical.shared.SelectionHandler
;
import
com.google.gwt.user.client.Event
;
import
com.google.gwt.user.client.ui.Composite
;
import
com.google.gwt.user.client.ui.Composite
;
import
com.google.gwt.user.client.ui.HTML
;
import
com.google.gwt.user.client.ui.HTML
;
import
com.google.gwt.user.client.ui.Image
;
import
com.google.gwt.user.client.ui.Image
;
...
@@ -47,6 +50,8 @@ public class AssetList extends Composite implements ProjectChangeListener {
...
@@ -47,6 +50,8 @@ public class AssetList extends Composite implements ProjectChangeListener {
private
long
projectId
;
private
long
projectId
;
private
Project
project
;
private
Project
project
;
private
YoungAndroidAssetsFolder
assetsFolder
;
private
YoungAndroidAssetsFolder
assetsFolder
;
private
int
clientX
;
private
int
clientY
;
/**
/**
* Creates a new AssetList
* Creates a new AssetList
...
@@ -81,6 +86,15 @@ public class AssetList extends Composite implements ProjectChangeListener {
...
@@ -81,6 +86,15 @@ public class AssetList extends Composite implements ProjectChangeListener {
initWidget
(
panel
);
initWidget
(
panel
);
assetList
.
setScrollOnSelectEnabled
(
false
);
assetList
.
sinkEvents
(
Event
.
ONMOUSEMOVE
);
assetList
.
addMouseMoveHandler
(
new
MouseMoveHandler
()
{
@Override
public
void
onMouseMove
(
MouseMoveEvent
event
)
{
clientX
=
event
.
getClientX
();
clientY
=
event
.
getClientY
();
}
});
assetList
.
addSelectionHandler
(
new
SelectionHandler
<
TreeItem
>()
{
assetList
.
addSelectionHandler
(
new
SelectionHandler
<
TreeItem
>()
{
@Override
@Override
public
void
onSelection
(
SelectionEvent
<
TreeItem
>
event
)
{
public
void
onSelection
(
SelectionEvent
<
TreeItem
>
event
)
{
...
@@ -88,7 +102,7 @@ public class AssetList extends Composite implements ProjectChangeListener {
...
@@ -88,7 +102,7 @@ public class AssetList extends Composite implements ProjectChangeListener {
ProjectNode
node
=
(
ProjectNode
)
selected
.
getUserObject
();
ProjectNode
node
=
(
ProjectNode
)
selected
.
getUserObject
();
// The actual menu is determined by what is registered for the filenode
// The actual menu is determined by what is registered for the filenode
// type in CommandRegistry.java
// type in CommandRegistry.java
ProjectNodeContextMenu
.
show
(
node
,
selected
.
getWidget
());
ProjectNodeContextMenu
.
show
(
node
,
selected
.
getWidget
()
,
clientX
,
clientY
);
}});
}});
}
}
...
...
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