From 31e818b2b6934a61162575e60b8148429934e7a3 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Fri, 5 Jul 2024 21:02:58 +0530 Subject: [PATCH 01/43] Focus component search box with / --- .../palette/YoungAndroidPalettePanel.java | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/palette/YoungAndroidPalettePanel.java b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/palette/YoungAndroidPalettePanel.java index 614cf065659..e9b2bdf740a 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/palette/YoungAndroidPalettePanel.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/palette/YoungAndroidPalettePanel.java @@ -7,6 +7,7 @@ package com.google.appinventor.client.editor.youngandroid.palette; import com.google.appinventor.client.ComponentsTranslation; +import com.google.appinventor.client.Ode; import com.google.appinventor.client.editor.simple.SimpleComponentDatabase; import com.google.appinventor.client.editor.simple.components.MockComponent; import com.google.appinventor.client.editor.simple.components.utils.PropertiesUtil; @@ -15,6 +16,7 @@ import com.google.appinventor.client.editor.simple.palette.SimpleComponentDescriptor; import com.google.appinventor.client.editor.simple.palette.SimplePaletteItem; import com.google.appinventor.client.editor.simple.palette.SimplePalettePanel; +import com.google.appinventor.client.editor.youngandroid.DesignToolbar; import com.google.appinventor.client.editor.youngandroid.YaFormEditor; import com.google.appinventor.client.explorer.project.ComponentDatabaseChangeListener; import com.google.appinventor.client.wizards.ComponentImportWizard; @@ -28,9 +30,12 @@ import com.google.gwt.event.dom.client.ChangeHandler; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.event.dom.client.FocusEvent; +import com.google.gwt.event.dom.client.FocusHandler; import com.google.gwt.user.client.ui.Anchor; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HasHorizontalAlignment; +import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.TextBox; import com.google.gwt.event.dom.client.KeyPressEvent; @@ -44,11 +49,6 @@ import jsinterop.annotations.JsOverlay; import jsinterop.annotations.JsType; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; import java.util.*; import static com.google.appinventor.client.Ode.MESSAGES; @@ -82,6 +82,7 @@ public class YoungAndroidPalettePanel extends Composite implements SimplePalette private final Map translationMap; private final TextBox searchText; + private boolean isSearchTextFocused = false; private final VerticalPanel searchResults; private JsArrayString arrayString = (JsArrayString) JsArrayString.createArray(); private String lastSearch = ""; @@ -183,6 +184,13 @@ public YoungAndroidPalettePanel(YaFormEditor editor) { @Override public void onBlur(BlurEvent event) { doSearch(); + isSearchTextFocused = false; + } + }); + searchText.addFocusHandler(new FocusHandler() { + @Override + public void onFocus(FocusEvent event) { + isSearchTextFocused = true; } }); searchText.addChangeHandler(new ChangeHandler() { @@ -192,6 +200,25 @@ public void onChange(ChangeEvent event) { } }); + /* User presses the slash key, the search text box is focused */ + RootPanel.get().addDomHandler(new KeyDownHandler() { + @Override + public void onKeyDown(KeyDownEvent event) { + DesignToolbar designToolbar = Ode.getInstance().getDesignToolbar(); + if (designToolbar.currentView == DesignToolbar.View.FORM) { + if (event.getNativeKeyCode() == 191 && !isSearchTextFocused) { + { + event.preventDefault(); + searchText.setFocus(true); + isSearchTextFocused = true; + } + } + } else { + isSearchTextFocused = false; + } + } + }, KeyDownEvent.getType()); + panel.setSpacing(3); panel.add(searchText); panel.setWidth("100%"); From fe22d80e1d16ce4c3186cfae20e79cded132e07f Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Fri, 5 Jul 2024 21:05:13 +0530 Subject: [PATCH 02/43] shortcuts for refreshing companion screen and resetting connection --- .../actions/RefreshCompanionAction.java | 22 +++++++++++++++++++ .../youngandroid/actions/ResetAction.java | 22 +++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/actions/RefreshCompanionAction.java b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/actions/RefreshCompanionAction.java index 36869878112..358439e6ba5 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/actions/RefreshCompanionAction.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/actions/RefreshCompanionAction.java @@ -6,13 +6,35 @@ package com.google.appinventor.client.editor.youngandroid.actions; import com.google.appinventor.client.Ode; +import com.google.gwt.dom.client.NativeEvent; +import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.user.client.Command; +import com.google.gwt.user.client.Event; public class RefreshCompanionAction implements Command { + + private RefreshCompanionAction() { + shortcutKeyHandler(); + } + @Override public void execute() { if (Ode.getInstance().okToConnect()) { Ode.getInstance().getTopToolbar().replUpdate(); } } + + private void shortcutKeyHandler() { + Event.addNativePreviewHandler(new Event.NativePreviewHandler() { + @Override + public void onPreviewNativeEvent(Event.NativePreviewEvent event) { + NativeEvent nativeEvent = event.getNativeEvent(); + if (event.getTypeInt() == Event.ONKEYDOWN && nativeEvent.getKeyCode() == KeyCodes.KEY_R + && nativeEvent.getAltKey()) { + nativeEvent.preventDefault(); + execute(); + } + } + }); + } } diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/actions/ResetAction.java b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/actions/ResetAction.java index 239ed04e50e..8f44719993e 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/actions/ResetAction.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/actions/ResetAction.java @@ -7,13 +7,35 @@ package com.google.appinventor.client.editor.youngandroid.actions; import com.google.appinventor.client.Ode; +import com.google.gwt.dom.client.NativeEvent; +import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.user.client.Command; +import com.google.gwt.user.client.Event; public class ResetAction implements Command { + + private ResetAction() { + shortcutKeyHandler(); + } + @Override public void execute() { if (Ode.getInstance().okToConnect()) { Ode.getInstance().getTopToolbar().startRepl(false, false, false, false); // We are really stopping the repl here } } + + private void shortcutKeyHandler() { + Event.addNativePreviewHandler(new Event.NativePreviewHandler() { + @Override + public void onPreviewNativeEvent(Event.NativePreviewEvent event) { + NativeEvent nativeEvent = event.getNativeEvent(); + if (event.getTypeInt() == Event.ONKEYDOWN && nativeEvent.getKeyCode() == KeyCodes.KEY_R + && nativeEvent.getAltKey() && nativeEvent.getShiftKey()) { + execute(); + nativeEvent.preventDefault(); + } + } + }); + } } From a6cd6c5bfdb2f30c45d1deda3f37b684e8c116f7 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Fri, 5 Jul 2024 21:28:09 +0530 Subject: [PATCH 03/43] Rename component with Alt + R --- .../explorer/SourceStructureExplorer.java | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/SourceStructureExplorer.java b/appinventor/appengine/src/com/google/appinventor/client/explorer/SourceStructureExplorer.java index 586fbdcc7fd..c7d34f69867 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/SourceStructureExplorer.java +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/SourceStructureExplorer.java @@ -130,6 +130,9 @@ public void onKeyDown(KeyDownEvent event) { if (keyCode == KeyCodes.KEY_DELETE || keyCode == KeyCodes.KEY_BACKSPACE) { event.preventDefault(); deleteItemFromTree(); + } else if (event.isAltKeyDown() && keyCode == KeyCodes.KEY_N) { + event.preventDefault(); + renameItem(); } } }); @@ -148,14 +151,7 @@ public void onKeyDown(KeyDownEvent event) { renameButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { - TreeItem treeItem = tree.getSelectedItem(); - if (treeItem != null) { - Object userObject = treeItem.getUserObject(); - if (userObject instanceof SourceStructureExplorerItem) { - SourceStructureExplorerItem item = (SourceStructureExplorerItem) userObject; - item.rename(); - } - } + renameItem(); } }); buttonPanel.add(renameButton); @@ -195,6 +191,17 @@ private void deleteItemFromTree() { } } + private void renameItem() { + TreeItem treeItem = tree.getSelectedItem(); + if (treeItem != null) { + Object userObject = treeItem.getUserObject(); + if (userObject instanceof SourceStructureExplorerItem) { + SourceStructureExplorerItem item = (SourceStructureExplorerItem) userObject; + item.rename(); + } + } + } + private void enableButtons(SourceStructureExplorerItem item) { renameButton.setEnabled(item.canRename()); deleteButton.setEnabled(item.canDelete()); From 800c48c1191716166313db8574331ce262099833 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Sun, 7 Jul 2024 21:22:02 +0530 Subject: [PATCH 04/43] Switch between design and blocks view --- .../editor/youngandroid/DesignToolbar.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/DesignToolbar.java b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/DesignToolbar.java index efb877c57cf..1b33bcde263 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/DesignToolbar.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/DesignToolbar.java @@ -11,6 +11,8 @@ import com.google.appinventor.client.editor.FileEditor; import com.google.appinventor.client.editor.ProjectEditor; import com.google.appinventor.client.editor.youngandroid.actions.SwitchScreenAction; +import com.google.appinventor.client.editor.youngandroid.actions.SwitchToBlocksEditorAction; +import com.google.appinventor.client.editor.youngandroid.actions.SwitchToFormEditorAction; import com.google.appinventor.client.widgets.DropDownButton; import com.google.appinventor.client.widgets.DropDownItem; import com.google.appinventor.client.widgets.Toolbar; @@ -21,9 +23,12 @@ import com.google.common.collect.Maps; import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.Scheduler; +import com.google.gwt.event.dom.client.KeyDownEvent; +import com.google.gwt.event.dom.client.KeyDownHandler; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.ui.Label; +import com.google.gwt.user.client.ui.RootPanel; import java.util.LinkedList; import java.util.Map; @@ -162,6 +167,7 @@ public DesignToolbar() { // Gray out the Designer button and enable the blocks button toggleEditor(false); Ode.getInstance().getTopToolbar().updateFileMenuButtons(0); + toggleView(); } private void doSwitchScreen(final long projectId, final String screenName, final View view) { @@ -366,6 +372,22 @@ public void toggleEditor(boolean blocks) { setButtonEnabled(WIDGET_NAME_REMOVEFORM, notOnScreen1); } + public void toggleView() { + SwitchToBlocksEditorAction blockView = new SwitchToBlocksEditorAction(); + SwitchToFormEditorAction designView = new SwitchToFormEditorAction(); + RootPanel.get().addDomHandler(new KeyDownHandler() { + public void onKeyDown(KeyDownEvent event) { + if (event.isControlKeyDown() && event.isAltKeyDown()) { + if (currentView == DesignToolbar.View.FORM) { + blockView.execute(); + } else if (currentView == DesignToolbar.View.BLOCKS) { + designView.execute(); + } + } + } + }, KeyDownEvent.getType()); + } + public DesignProject getCurrentProject() { return currentProject; } From 9c4646cd241f147e4464b0c3783a9bbb41a46a72 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Sun, 7 Jul 2024 21:22:40 +0530 Subject: [PATCH 05/43] Navigation for the project explorer --- .../client/explorer/folder/ProjectFolder.java | 36 +++++++++++++++++-- .../youngandroid/ProjectListItem.java | 20 +++++++++++ 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.java b/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.java index 47a09ab5808..1d51b74d553 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.java +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.java @@ -15,7 +15,11 @@ import com.google.appinventor.client.explorer.project.ProjectSelectionChangeHandler; import com.google.appinventor.client.explorer.youngandroid.ProjectListItem; import com.google.gwt.core.client.GWT; +import com.google.gwt.event.dom.client.BlurEvent; import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.FocusEvent; +import com.google.gwt.event.dom.client.KeyCodes; +import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.json.client.JSONArray; import com.google.gwt.json.client.JSONObject; @@ -131,9 +135,39 @@ public OdeMessages getMessages() { @UiHandler("checkBox") void toggleFolderSelection(ClickEvent e) { setSelected(checkBox.getValue()); + for (ProjectListItem item : projectListItems) { + item.setSelected(checkBox.getValue()); + } fireSelectionChangeEvent(); } + @UiHandler("checkBox") + void toggleFolderSelection(KeyDownEvent e) { + if (e.getNativeKeyCode() == KeyCodes.KEY_ENTER) { + setSelected(false); + isExpanded = !isExpanded; + if (isExpanded) { + expandButton.setIcon("expand_more"); + childrenContainer.removeStyleName("ode-ProjectRowHidden"); + checkBox.setValue(false); + } else { + expandButton.setIcon("chevron_right"); + childrenContainer.addStyleName("ode-ProjectRowHidden"); + } + fireSelectionChangeEvent(); + } + } + + @UiHandler("checkBox") + void highlightContainer(FocusEvent e) { + container.addStyleDependentName("Selector"); + } + + @UiHandler("checkBox") + void highlightContainer(BlurEvent e) { + container.removeStyleDependentName("Selector"); + } + @UiHandler("expandButton") void toggleExpandedState(ClickEvent e) { setSelected(false); @@ -141,12 +175,10 @@ void toggleExpandedState(ClickEvent e) { if (isExpanded) { expandButton.setIcon("expand_more"); childrenContainer.removeStyleName("ode-ProjectRowHidden"); - checkBox.addStyleName("ode-ProjectElementHidden"); checkBox.setValue(false); } else { expandButton.setIcon("chevron_right"); childrenContainer.addStyleName("ode-ProjectRowHidden"); - checkBox.removeStyleName("ode-ProjectElementHidden"); } fireSelectionChangeEvent(); } diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectListItem.java b/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectListItem.java index 49f0a67b03c..db10138255c 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectListItem.java +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectListItem.java @@ -16,7 +16,11 @@ import com.google.appinventor.shared.rpc.ServerLayout; import com.google.gwt.core.client.GWT; import com.google.gwt.dom.client.Element; +import com.google.gwt.event.dom.client.BlurEvent; import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.FocusEvent; +import com.google.gwt.event.dom.client.KeyCodes; +import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiFactory; @@ -94,6 +98,22 @@ void toggleItemSelection(ClickEvent e) { changeHandler.onSelectionChange(checkBox.getValue()); } + @UiHandler("checkBox") + void openProject(KeyDownEvent e) { + if (e.getNativeKeyCode() == KeyCodes.KEY_ENTER) { + Ode.getInstance().openYoungAndroidProjectInDesigner(project); + } + } + + @UiHandler("checkBox") + void highlightContainer(FocusEvent event) { + container.addStyleDependentName("Selector"); + } + + @UiHandler("checkBox") + void highlightContainer(BlurEvent event) { + container.removeStyleDependentName("Selector"); + } @SuppressWarnings("unused") @UiHandler("nameLabel") From e9af08a5d079bc846cf1f92314760f4e67d25d61 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Sun, 7 Jul 2024 21:23:01 +0530 Subject: [PATCH 06/43] Navigation for dropdowns --- .../client/widgets/ContextMenu.java | 19 ++++++++ .../client/widgets/DropDownButton.java | 44 ++++++++++++++++++- 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/widgets/ContextMenu.java b/appinventor/appengine/src/com/google/appinventor/client/widgets/ContextMenu.java index 9e48c0ac313..32722365f3a 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/widgets/ContextMenu.java +++ b/appinventor/appengine/src/com/google/appinventor/client/widgets/ContextMenu.java @@ -142,4 +142,23 @@ public void setPopupPosition(int left, int top) { public void hide() { popupPanel.hide(); } + + /* Returns if the context menu is showing */ + public boolean isShowing() { + return popupPanel.isShowing(); + } + + /* Gives the menubar focus */ + public void focus() { + menuBar.focus(); + } + + public void moveSelectionDown() { + menuBar.moveSelectionDown(); + } + + public void moveSelectionUp() { + menuBar.moveSelectionUp(); + } + } diff --git a/appinventor/appengine/src/com/google/appinventor/client/widgets/DropDownButton.java b/appinventor/appengine/src/com/google/appinventor/client/widgets/DropDownButton.java index 5ae1583ef1d..0c06571f266 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/widgets/DropDownButton.java +++ b/appinventor/appengine/src/com/google/appinventor/client/widgets/DropDownButton.java @@ -8,10 +8,15 @@ import com.google.appinventor.client.components.Icon; import com.google.appinventor.client.utils.PZAwarePositionCallback; import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.event.dom.client.KeyCodes; +import com.google.gwt.event.dom.client.KeyDownEvent; +import com.google.gwt.event.dom.client.KeyDownHandler; import com.google.gwt.uibinder.client.ElementParserToUse; import com.google.gwt.user.client.Command; +import com.google.gwt.user.client.Event; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.MenuItem; import com.google.gwt.user.client.ui.MenuItemSeparator; @@ -111,7 +116,44 @@ public DropDownButton() { addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { - menu.setPopupPositionAndShow(new DropDownPositionCallback(getElement())); + if (menu.isShowing()) { + menu.hide(); + } else { + menu.setPopupPositionAndShow(new DropDownPositionCallback(getElement())); + } + } + }); + + addKeyDownHandler(new KeyDownHandler() { + @Override + public void onKeyDown(KeyDownEvent event) { + if (event.getNativeKeyCode() == KeyCodes.KEY_DOWN) { + if (menu.isShowing()) { + event.preventDefault(); + menu.moveSelectionDown(); + menu.focus(); + } + } else if (event.getNativeKeyCode() == KeyCodes.KEY_UP) { + if (menu.isShowing()) { + event.preventDefault(); + menu.moveSelectionUp(); + menu.focus(); + } + } + } + }); + + Event.addNativePreviewHandler(new Event.NativePreviewHandler() { + @Override + public void onPreviewNativeEvent(Event.NativePreviewEvent event) { + NativeEvent nativeEvent = event.getNativeEvent(); + if (event.getTypeInt() == Event.ONKEYDOWN && nativeEvent.getKeyCode() == KeyCodes.KEY_TAB) { + if (menu.isShowing()) { + nativeEvent.preventDefault(); + menu.hide(); + setFocus(true); + } + } } }); } From ec12849aec4332f94c4c30938b11972c211ad239 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Sun, 7 Jul 2024 21:23:11 +0530 Subject: [PATCH 07/43] css --- appinventor/appengine/war/static/css/Ya.css | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/appinventor/appengine/war/static/css/Ya.css b/appinventor/appengine/war/static/css/Ya.css index d4d69a64187..807de81444c 100755 --- a/appinventor/appengine/war/static/css/Ya.css +++ b/appinventor/appengine/war/static/css/Ya.css @@ -309,6 +309,10 @@ div.StatusPanel { background-color: #fff6c3; } +.ode-ProjectRow-Selector { + background-color: #d2e0a6; +} + .ode-ProjectRowHidden { display:none; } @@ -551,9 +555,13 @@ div.StatusPanel { .ode-TopPanelButton:hover, .ActionDropDown-Default:hover, -.ActionDropDown-Options:hover { +.ActionDropDown-Options:hover, +.ode-TopPanelButton:focus, +.ActionDropDown-Default:focus, +.ActionDropDown-Options:focus { background: #E6E6E6; color: #5B5B5B; + outline: none; } .ode-TopPanelButton:active, From e8fc45a5efecb2b3febd9621f4c90db1a1c9549b Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Sun, 7 Jul 2024 22:48:21 +0530 Subject: [PATCH 08/43] shortcuts for blockly editor --- .../blocklyeditor/src/blocklyeditor.js | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/appinventor/blocklyeditor/src/blocklyeditor.js b/appinventor/blocklyeditor/src/blocklyeditor.js index 71ebce09301..289870df0b3 100644 --- a/appinventor/blocklyeditor/src/blocklyeditor.js +++ b/appinventor/blocklyeditor/src/blocklyeditor.js @@ -589,6 +589,26 @@ Blockly.ai_inject = function(container, workspace) { return workspace; }; +function isBlockEditorActive(e) { + var target = null; + + if (e.target.tagName.toLowerCase() == 'div' && e.target.className == 'injectionDiv') { + target = e.target; + } else { + var parent = e.target; + while (parent.parentNode && !(parent.tagName.toLowerCase() == 'div' && parent.className == 'injectionDiv')) { + parent = parent.parentNode; + } + target = parent; + } + + if (Blockly.mainWorkspace.getParentSvg().parentNode == target) { + return true; + } + + return false; +} + // Preserve Blockly during Closure and GWT optimizations window['Blockly'] = Blockly; top['Blockly'] = Blockly; @@ -615,3 +635,46 @@ top.document.addEventListener('mousedown', function(e) { Blockly.hideChaff(); } }, false); + +top.document.addEventListener('keydown', function(e) { + var selectedBlock = Blockly.selected; + var allBlocks = Blockly.mainWorkspace.getAllBlocks(); + + if (e.altKey) { + e.preventDefault(); + if (e.key.toLowerCase() === 'o') { + selectedBlock.setCollapsed(!selectedBlock.isCollapsed()); + } else if (e.key.toLowerCase() === 'i') { + selectedBlock.setInputsInline(!selectedBlock.getInputsInline()); + } else if (e.key.toLowerCase() === 'w') { + if (allBlocks.length > 0) { + i = (i + 1) % allBlocks.length; + allBlocks[i].select(); + } + } else if (e.key.toLowerCase() === 's') { + if (allBlocks.length > 0) { + i = (i - 1 + allBlocks.length) % allBlocks.length; + allBlocks[i].select(); + } + } else if (e.key.toLowerCase() === 'k') { + if (!selectedBlock.isCollapsed()) { + if (selectedBlock.comment && selectedBlock.comment.isVisible()) { + selectedBlock.comment.setVisible(false); + } else { + selectedBlock.setCommentText(''); + selectedBlock.comment.setVisible(true); + } + } + } else if (e.key === '+') { + Blockly.getMainWorkspace().zoomCenter(1); + } else if (e.key === '-') { + Blockly.getMainWorkspace().zoomCenter(-1); + } else if (e.key.toLowerCase() === 'g') { + var mainWorkspace = Blockly.getMainWorkspace(); + mainWorkspace.setScale(mainWorkspace.options.zoomOptions.startScale); + mainWorkspace.scrollCenter(); + } else if (e.key.toLowerCase() === 'b' && isBlockEditorActive(e)) { + Blockly.getMainWorkspace().getBackpack().openBackpack(e); + } + } +}, false); \ No newline at end of file From 87eb4c521a3f75227a9ea0125a2114a93ca96a0b Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Mon, 8 Jul 2024 21:23:02 +0530 Subject: [PATCH 09/43] checkbox text for screen readers --- .../client/explorer/folder/ProjectFolder.java | 13 +++++++----- .../youngandroid/ProjectListItem.java | 14 ++++++++----- .../client/style/neo/ProjectFolderNeo.java | 20 +++++++++++++++++++ .../client/style/neo/ProjectListItemNeo.java | 20 +++++++++++++++++++ 4 files changed, 57 insertions(+), 10 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.java b/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.java index 58c6c209bf0..f467b40e035 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.java +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.java @@ -15,6 +15,7 @@ import com.google.appinventor.client.explorer.project.ProjectSelectionChangeHandler; import com.google.appinventor.client.explorer.youngandroid.ProjectListItem; import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.event.dom.client.BlurEvent; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.FocusEvent; @@ -118,6 +119,8 @@ public ProjectFolder(JSONObject json, ProjectFolder parent, UiStyleFactory style public void bindUI() { ProjectFolderUiBinder uibinder = GWT.create(ProjectFolderUiBinder.class); initWidget(uibinder.createAndBindUi(this)); + checkBox.setText("Expand and Collapse" + nameLabel.getText() + "folder by pressing enter"); + checkBox.getElement().getStyle().setFontSize(0, Unit.PX); } public void setSelectionChangeHandler(ProjectSelectionChangeHandler changeHandler) { @@ -140,7 +143,7 @@ protected void toggleFolderSelection(ClickEvent e) { } @UiHandler("checkBox") - void toggleFolderSelection(KeyDownEvent e) { + protected void toggleFolderSelection(KeyDownEvent e) { if (e.getNativeKeyCode() == KeyCodes.KEY_ENTER) { setSelected(false); isExpanded = !isExpanded; @@ -157,12 +160,12 @@ void toggleFolderSelection(KeyDownEvent e) { } @UiHandler("checkBox") - void highlightContainer(FocusEvent e) { + protected void highlightContainer(FocusEvent e) { container.addStyleDependentName("Selector"); } @UiHandler("checkBox") - void highlightContainer(BlurEvent e) { + protected void highlightContainer(BlurEvent e) { container.removeStyleDependentName("Selector"); } @@ -184,9 +187,9 @@ protected void toggleExpandedState(ClickEvent e) { public void setSelected(boolean selected) { checkBox.setValue(selected); if (selected) { - container.addStyleName("ode-ProjectRowHighlighted"); + container.addStyleName("ode-ProjectRow-Highlighted"); } else { - container.removeStyleName("ode-ProjectRowHighlighted"); + container.removeStyleName("ode-ProjectRow-Highlighted"); } } diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectListItem.java b/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectListItem.java index 62fd812f66c..e39d23105f5 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectListItem.java +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectListItem.java @@ -16,6 +16,7 @@ import com.google.appinventor.shared.rpc.ServerLayout; import com.google.gwt.core.client.GWT; import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.event.dom.client.BlurEvent; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.FocusEvent; @@ -65,6 +66,9 @@ public ProjectListItem(Project project) { public void bindUI() { ProjectListItemUiBinder uibinder = GWT.create(ProjectListItemUiBinder.class); initWidget(uibinder.createAndBindUi(this)); + + checkBox.setText("open" + nameLabel.getText() + "project by pressing enter"); + checkBox.getElement().getStyle().setFontSize(0, Unit.PX); } public void setSelectionChangeHandler(ProjectSelectionChangeHandler changeHandler) { @@ -78,9 +82,9 @@ public boolean isSelected() { public void setSelected(boolean selected) { checkBox.setValue(selected); if (selected) { - container.addStyleName("ode-ProjectRowHighlighted"); + container.addStyleName("ode-ProjectRow-Highlighted"); } else { - container.removeStyleName("ode-ProjectRowHighlighted"); + container.removeStyleName("ode-ProjectRow-Highlighted"); } } @@ -101,19 +105,19 @@ protected void toggleItemSelection(ClickEvent e) { } @UiHandler("checkBox") - void openProject(KeyDownEvent e) { + protected void openProject(KeyDownEvent e) { if (e.getNativeKeyCode() == KeyCodes.KEY_ENTER) { Ode.getInstance().openYoungAndroidProjectInDesigner(project); } } @UiHandler("checkBox") - void highlightContainer(FocusEvent event) { + protected void highlightContainer(FocusEvent e) { container.addStyleDependentName("Selector"); } @UiHandler("checkBox") - void highlightContainer(BlurEvent event) { + protected void highlightContainer(BlurEvent e) { container.removeStyleDependentName("Selector"); } diff --git a/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectFolderNeo.java b/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectFolderNeo.java index cedc20e2b2d..429fb4dde06 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectFolderNeo.java +++ b/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectFolderNeo.java @@ -11,10 +11,15 @@ import com.google.appinventor.client.explorer.project.Project; import com.google.appinventor.client.explorer.youngandroid.ProjectListItem; import com.google.gwt.core.client.GWT; +import com.google.gwt.event.dom.client.BlurEvent; import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.FocusEvent; +import com.google.gwt.event.dom.client.KeyCodes; +import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.json.client.JSONObject; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.uibinder.client.UiHandler; import com.google.gwt.user.client.ui.CheckBox; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.Label; @@ -66,6 +71,21 @@ protected void toggleFolderSelection(ClickEvent e) { super.toggleFolderSelection(e); } + @UiHandler("checkBox") + protected void toggleFolderSelection(KeyDownEvent e) { + super.toggleFolderSelection(e); + } + + @UiHandler("checkBox") + protected void highlightContainer(FocusEvent e) { + super.highlightContainer(e); + } + + @UiHandler("checkBox") + protected void highlightContainer(BlurEvent e) { + super.highlightContainer(e); + } + @SuppressWarnings("unused") @Override protected void toggleExpandedState(ClickEvent e) { diff --git a/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectListItemNeo.java b/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectListItemNeo.java index 7f19aced78d..3d985795ed9 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectListItemNeo.java +++ b/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectListItemNeo.java @@ -5,10 +5,15 @@ package com.google.appinventor.client.style.neo; +import com.google.appinventor.client.Ode; import com.google.appinventor.client.explorer.project.Project; import com.google.appinventor.client.explorer.youngandroid.ProjectListItem; import com.google.gwt.core.client.GWT; +import com.google.gwt.event.dom.client.BlurEvent; import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.FocusEvent; +import com.google.gwt.event.dom.client.KeyCodes; +import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiHandler; @@ -48,6 +53,21 @@ protected void toggleItemSelection(ClickEvent e) { super.toggleItemSelection(e); } + @UiHandler("checkBox") + protected void openProject(KeyDownEvent e) { + super.openProject(e); + } + + @UiHandler("checkBox") + protected void highlightContainer(FocusEvent e) { + super.highlightContainer(e); + } + + @UiHandler("checkBox") + protected void highlightContainer(BlurEvent e) { + super.highlightContainer(e); + } + @UiHandler("nameLabel") protected void itemClicked(ClickEvent e) { super.itemClicked(e); From 14501ed5e8244d09b7fbf6354499efb37f33889c Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Mon, 8 Jul 2024 22:04:23 +0530 Subject: [PATCH 10/43] Accessibility --- .../appinventor/client/explorer/folder/ProjectFolder.java | 7 +++++-- .../client/explorer/youngandroid/ProjectListItem.java | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.java b/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.java index f467b40e035..d1d4728496a 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.java +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.java @@ -81,6 +81,8 @@ public ProjectFolder(String name, long dateCreated, long dateModified, ProjectFo this.parent = parent; this.projects = new ArrayList<>(); this.folders = new HashMap<>(); + checkBox.setText("Expand and Collapse" + nameLabel.getText() + "folder by pressing enter"); + checkBox.getElement().getStyle().setFontSize(0, Unit.PX); } public ProjectFolder(String name, long dateCreated, ProjectFolder parent) { @@ -114,13 +116,14 @@ public ProjectFolder(JSONObject json, ProjectFolder parent, UiStyleFactory style this)); } cachedJson = null; + + checkBox.setText("Expand and Collapse" + this.nameLabel.getText() + "folder by pressing enter"); + checkBox.getElement().getStyle().setFontSize(0, Unit.PX); } public void bindUI() { ProjectFolderUiBinder uibinder = GWT.create(ProjectFolderUiBinder.class); initWidget(uibinder.createAndBindUi(this)); - checkBox.setText("Expand and Collapse" + nameLabel.getText() + "folder by pressing enter"); - checkBox.getElement().getStyle().setFontSize(0, Unit.PX); } public void setSelectionChangeHandler(ProjectSelectionChangeHandler changeHandler) { diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectListItem.java b/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectListItem.java index e39d23105f5..180486f09bf 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectListItem.java +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectListItem.java @@ -61,14 +61,14 @@ public ProjectListItem(Project project) { dateModifiedLabel.setText(dateTimeFormat.format(dateModified)); dateCreatedLabel.setText(dateTimeFormat.format(dateCreated)); this.project = project; + + checkBox.setText("open" + nameLabel.getText() + "project by pressing enter"); + checkBox.getElement().getStyle().setFontSize(0, Unit.PX); } public void bindUI() { ProjectListItemUiBinder uibinder = GWT.create(ProjectListItemUiBinder.class); initWidget(uibinder.createAndBindUi(this)); - - checkBox.setText("open" + nameLabel.getText() + "project by pressing enter"); - checkBox.getElement().getStyle().setFontSize(0, Unit.PX); } public void setSelectionChangeHandler(ProjectSelectionChangeHandler changeHandler) { From d1f02f65c9b9ce9b5983a918e37009046bfaeb0c Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Mon, 8 Jul 2024 22:04:59 +0530 Subject: [PATCH 11/43] Tooltips and messages --- .../com/google/appinventor/client/OdeMessages.java | 6 +++--- appinventor/blocklyeditor/src/backpack.js | 3 +++ .../blocklyeditor/src/msg/ai_blockly/messages.json | 12 ++++++------ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java index 9d9f9341ef3..0cad529d965 100755 --- a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java +++ b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java @@ -655,7 +655,7 @@ public interface OdeMessages extends Messages, AutogeneratedOdeMessages { @Description("Message providing details about starting a USB connection.") String usbMenuItem(); - @DefaultMessage("Reset Connection") + @DefaultMessage("Reset Connection (Alt + Shift + R)") @Description("Reset all connections.") String resetConnectionsMenuItem(); @@ -663,7 +663,7 @@ public interface OdeMessages extends Messages, AutogeneratedOdeMessages { @Description("Hard Reset the Emulator.") String hardResetConnectionsMenuItem(); - @DefaultMessage("Refresh Companion Screen") + @DefaultMessage("Refresh Companion Screen (Alt + R)") @Description("Refresh the companion screen.") String refreshCompanionMenuItem(); @@ -1254,7 +1254,7 @@ public interface OdeMessages extends Messages, AutogeneratedOdeMessages { String blocksLoadFailure(String formName); // Used in editor/youngandroid/palette/YoungAndroidPalettePanel.java - @DefaultMessage("Search Components...") + @DefaultMessage("Type / to search components") @Description("Text shown in the component palette search box") String searchComponents(); diff --git a/appinventor/blocklyeditor/src/backpack.js b/appinventor/blocklyeditor/src/backpack.js index 938f9229a80..f96b804d00e 100644 --- a/appinventor/blocklyeditor/src/backpack.js +++ b/appinventor/blocklyeditor/src/backpack.js @@ -209,6 +209,9 @@ Blockly.Backpack.prototype.createDom = function(opt_workspace) { this.svgBody_.setAttribute('class', 'blocklybackpackImage'); + this.svgTooltip_ = Blockly.utils.createSvgElement('title', null , this.svgBody_); + this.svgTooltip_.textContent = 'Alt + B to Open/Close'; + return this.svgGroup_; }; diff --git a/appinventor/blocklyeditor/src/msg/ai_blockly/messages.json b/appinventor/blocklyeditor/src/msg/ai_blockly/messages.json index 659900ce539..06ae6360665 100644 --- a/appinventor/blocklyeditor/src/msg/ai_blockly/messages.json +++ b/appinventor/blocklyeditor/src/msg/ai_blockly/messages.json @@ -11,10 +11,10 @@ "Blockly.Msg.HIDE": "Hide Workspace Controls", "Blockly.Msg.SHOW": "Show Workspace Controls", "Blockly.Msg.DUPLICATE_BLOCK": "Duplicate", - "Blockly.Msg.REMOVE_COMMENT": "Remove Comment", - "Blockly.Msg.ADD_COMMENT": "Add Comment", - "Blockly.Msg.EXTERNAL_INPUTS": "External Inputs", - "Blockly.Msg.INLINE_INPUTS": "Inline Inputs", + "Blockly.Msg.REMOVE_COMMENT": "Remove Comment (Alt + K)", + "Blockly.Msg.ADD_COMMENT": "Add Comment (Alt + K)", + "Blockly.Msg.EXTERNAL_INPUTS": "External Inputs (Alt + I)", + "Blockly.Msg.INLINE_INPUTS": "Inline Inputs (Alt + I)", "Blockly.Msg.HORIZONTAL_PARAMETERS": "Arrange Parameters Horizontally", "Blockly.Msg.VERTICAL_PARAMETERS": "Arrange Parameters Vertically", "Blockly.Msg.CONFIRM_DELETE": "Confirm deletion", @@ -22,8 +22,8 @@ "Blockly.Msg.DELETE_BLOCK": "Delete Block", "Blockly.Msg.DELETE_X_BLOCKS": "Delete %1 Blocks", "Blockly.Msg.COLLAPSE_BLOCK": "Collapse Block", - "Blockly.Msg.EXPAND_BLOCK": "Expand Block", - "Blockly.Msg.DISABLE_BLOCK": "Disable Block", + "Blockly.Msg.EXPAND_BLOCK": "Expand Block (Alt + O)", + "Blockly.Msg.DISABLE_BLOCK": "Disable Block (Alt + O)", "Blockly.Msg.ENABLE_BLOCK": "Enable Block", "Blockly.Msg.HELP": "Help", "Blockly.Msg.EXPORT_IMAGE": "Download Blocks as Image", From b296f6cdbd8fb8b179504cf01f812796e3abc10a Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Wed, 10 Jul 2024 20:51:38 +0530 Subject: [PATCH 12/43] better version of project explorer navigation --- .../client/explorer/folder/ProjectFolder.java | 49 +++++------------ .../explorer/folder/ProjectFolder.ui.xml | 12 +++-- .../explorer/youngandroid/ProjectList.java | 35 ++++++++++-- .../explorer/youngandroid/ProjectList.ui.xml | 54 ++++++++++--------- .../youngandroid/ProjectListItem.java | 22 ++------ .../youngandroid/ProjectListItem.ui.xml | 4 +- .../client/style/neo/ProjectFolderNeo.java | 25 +++------ .../client/style/neo/ProjectFolderNeo.ui.xml | 12 +++-- .../client/style/neo/ProjectListItemNeo.java | 23 +++----- .../style/neo/ProjectListItemNeo.ui.xml | 4 +- .../client/style/neo/ProjectListNeo.java | 7 +++ .../client/style/neo/ProjectListNeo.ui.xml | 54 ++++++++++--------- appinventor/appengine/war/static/css/Ya.css | 11 ++-- 13 files changed, 156 insertions(+), 156 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.java b/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.java index d1d4728496a..e98bbd2f7e4 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.java +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.java @@ -15,10 +15,7 @@ import com.google.appinventor.client.explorer.project.ProjectSelectionChangeHandler; import com.google.appinventor.client.explorer.youngandroid.ProjectListItem; import com.google.gwt.core.client.GWT; -import com.google.gwt.dom.client.Style.Unit; -import com.google.gwt.event.dom.client.BlurEvent; import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.FocusEvent; import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.i18n.client.DateTimeFormat; @@ -32,6 +29,7 @@ import com.google.gwt.user.client.ui.CheckBox; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.FlowPanel; +import com.google.gwt.user.client.ui.FocusPanel; import com.google.gwt.user.client.ui.Label; import java.util.ArrayList; @@ -69,6 +67,7 @@ interface ProjectFolderUiBinder extends UiBinder { } @UiField protected Label dateCreatedLabel; @UiField protected CheckBox checkBox; @UiField protected Icon expandButton; + @UiField protected FocusPanel expandbuttonFocusPanel; public ProjectFolder(String name, long dateCreated, long dateModified, ProjectFolder parent) { bindUI(); @@ -81,8 +80,6 @@ public ProjectFolder(String name, long dateCreated, long dateModified, ProjectFo this.parent = parent; this.projects = new ArrayList<>(); this.folders = new HashMap<>(); - checkBox.setText("Expand and Collapse" + nameLabel.getText() + "folder by pressing enter"); - checkBox.getElement().getStyle().setFontSize(0, Unit.PX); } public ProjectFolder(String name, long dateCreated, ProjectFolder parent) { @@ -116,9 +113,6 @@ public ProjectFolder(JSONObject json, ProjectFolder parent, UiStyleFactory style this)); } cachedJson = null; - - checkBox.setText("Expand and Collapse" + this.nameLabel.getText() + "folder by pressing enter"); - checkBox.getElement().getStyle().setFontSize(0, Unit.PX); } public void bindUI() { @@ -139,50 +133,33 @@ public OdeMessages getMessages() { @UiHandler("checkBox") protected void toggleFolderSelection(ClickEvent e) { setSelected(checkBox.getValue()); - for (ProjectListItem item : projectListItems) { - item.setSelected(checkBox.getValue()); - } fireSelectionChangeEvent(); } - @UiHandler("checkBox") - protected void toggleFolderSelection(KeyDownEvent e) { - if (e.getNativeKeyCode() == KeyCodes.KEY_ENTER) { - setSelected(false); - isExpanded = !isExpanded; - if (isExpanded) { - expandButton.setIcon("expand_more"); - childrenContainer.removeStyleName("ode-ProjectRowHidden"); - checkBox.setValue(false); - } else { - expandButton.setIcon("chevron_right"); - childrenContainer.addStyleName("ode-ProjectRowHidden"); - } - fireSelectionChangeEvent(); - } - } - - @UiHandler("checkBox") - protected void highlightContainer(FocusEvent e) { - container.addStyleDependentName("Selector"); + @UiHandler("expandbuttonFocusPanel") + protected void toggleExpandedState(ClickEvent e) { + toggleState(); } - @UiHandler("checkBox") - protected void highlightContainer(BlurEvent e) { - container.removeStyleDependentName("Selector"); + @UiHandler("expandbuttonFocusPanel") + protected void toggleExpandedState(KeyDownEvent e) { + if (e.getNativeKeyCode() == KeyCodes.KEY_ENTER) { + toggleState(); + } } - @UiHandler("expandButton") - protected void toggleExpandedState(ClickEvent e) { + private void toggleState() { setSelected(false); isExpanded = !isExpanded; if (isExpanded) { expandButton.setIcon("expand_more"); childrenContainer.removeStyleName("ode-ProjectRowHidden"); + checkBox.addStyleName("ode-ProjectElementHidden"); checkBox.setValue(false); } else { expandButton.setIcon("chevron_right"); childrenContainer.addStyleName("ode-ProjectRowHidden"); + checkBox.removeStyleName("ode-ProjectElementHidden"); } fireSelectionChangeEvent(); } diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.ui.xml b/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.ui.xml index 3a01f3d0ee8..9039fe4bfc9 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.ui.xml +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.ui.xml @@ -12,11 +12,13 @@ - - - - - + + + + + + + diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectList.java b/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectList.java index 186234a8cbc..c969ef521d4 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectList.java +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectList.java @@ -15,13 +15,15 @@ import com.google.appinventor.client.explorer.project.ProjectSelectionChangeHandler; import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; - +import com.google.gwt.event.dom.client.KeyCodes; +import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiHandler; import com.google.gwt.user.client.ui.CheckBox; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.FlowPanel; +import com.google.gwt.user.client.ui.FocusPanel; import com.google.gwt.user.client.ui.InlineLabel; import java.util.Collections; @@ -70,6 +72,9 @@ private enum SortOrder { @UiField protected InlineLabel createDateSortAsc; @UiField protected InlineLabel modDateSortDec; @UiField protected InlineLabel modDateSortAsc; + @UiField protected FocusPanel nameFocusPanel; + @UiField protected FocusPanel createdateFocusPanel; + @UiField protected FocusPanel modDateFocusPanel; /** * Creates a new ProjectList @@ -98,21 +103,43 @@ public void bindIU() { } @SuppressWarnings("unused") - @UiHandler("projectName") + @UiHandler("nameFocusPanel") public void sortByNameField(ClickEvent e) { changeSortOrder(SortField.NAME); } - @UiHandler("createDate") + @SuppressWarnings("unused") + @UiHandler("nameFocusPanel") + public void sortByNameField(KeyDownEvent e) { + if (e.getNativeKeyCode() == KeyCodes.KEY_ENTER) { + changeSortOrder(SortField.NAME); + } + } + + @UiHandler("createdateFocusPanel") public void sortByCreateDate(ClickEvent e) { changeSortOrder(SortField.DATE_CREATED); } - @UiHandler("modDate") + @UiHandler("createdateFocusPanel") + public void sortByCreateDate(KeyDownEvent e) { + if (e.getNativeKeyCode() == KeyCodes.KEY_ENTER) { + changeSortOrder(SortField.DATE_CREATED); + } + } + + @UiHandler("modDateFocusPanel") public void sortByModDate(ClickEvent e) { changeSortOrder(SortField.DATE_MODIFIED); } + @UiHandler("modDateFocusPanel") + public void sortByModDate(KeyDownEvent e) { + if (e.getNativeKeyCode() == KeyCodes.KEY_ENTER) { + changeSortOrder(SortField.DATE_MODIFIED); + } + } + private void changeSortOrder(SortField clickedSortField) { if (sortField != clickedSortField) { sortField = clickedSortField; diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectList.ui.xml b/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectList.ui.xml index af4d6c3cd16..3bf211ffc24 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectList.ui.xml +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectList.ui.xml @@ -11,30 +11,36 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectListItem.java b/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectListItem.java index 180486f09bf..a8f712268d0 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectListItem.java +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectListItem.java @@ -16,10 +16,7 @@ import com.google.appinventor.shared.rpc.ServerLayout; import com.google.gwt.core.client.GWT; import com.google.gwt.dom.client.Element; -import com.google.gwt.dom.client.Style.Unit; -import com.google.gwt.event.dom.client.BlurEvent; import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.FocusEvent; import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.i18n.client.DateTimeFormat; @@ -30,6 +27,7 @@ import com.google.gwt.user.client.ui.CheckBox; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.FlowPanel; +import com.google.gwt.user.client.ui.FocusPanel; import com.google.gwt.user.client.ui.Label; import java.util.Date; @@ -42,6 +40,7 @@ interface ProjectListItemUiBinder extends UiBinder { @UiField protected Label dateModifiedLabel; @UiField protected Label dateCreatedLabel; @UiField protected CheckBox checkBox; + @UiField protected FocusPanel projectnameFocusPanel; private final Project project; private ProjectSelectionChangeHandler changeHandler; @@ -61,9 +60,6 @@ public ProjectListItem(Project project) { dateModifiedLabel.setText(dateTimeFormat.format(dateModified)); dateCreatedLabel.setText(dateTimeFormat.format(dateCreated)); this.project = project; - - checkBox.setText("open" + nameLabel.getText() + "project by pressing enter"); - checkBox.getElement().getStyle().setFontSize(0, Unit.PX); } public void bindUI() { @@ -104,25 +100,15 @@ protected void toggleItemSelection(ClickEvent e) { changeHandler.onSelectionChange(checkBox.getValue()); } - @UiHandler("checkBox") + @UiHandler("projectnameFocusPanel") protected void openProject(KeyDownEvent e) { if (e.getNativeKeyCode() == KeyCodes.KEY_ENTER) { Ode.getInstance().openYoungAndroidProjectInDesigner(project); } } - @UiHandler("checkBox") - protected void highlightContainer(FocusEvent e) { - container.addStyleDependentName("Selector"); - } - - @UiHandler("checkBox") - protected void highlightContainer(BlurEvent e) { - container.removeStyleDependentName("Selector"); - } - @SuppressWarnings("unused") - @UiHandler("nameLabel") + @UiHandler("projectnameFocusPanel") protected void itemClicked(ClickEvent e) { Ode.getInstance().openYoungAndroidProjectInDesigner(project); } diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectListItem.ui.xml b/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectListItem.ui.xml index b27eaf6e685..c0e2aa0971f 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectListItem.ui.xml +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/ProjectListItem.ui.xml @@ -10,7 +10,9 @@ - + + + diff --git a/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectFolderNeo.java b/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectFolderNeo.java index 429fb4dde06..00dc8c35913 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectFolderNeo.java +++ b/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectFolderNeo.java @@ -11,10 +11,7 @@ import com.google.appinventor.client.explorer.project.Project; import com.google.appinventor.client.explorer.youngandroid.ProjectListItem; import com.google.gwt.core.client.GWT; -import com.google.gwt.event.dom.client.BlurEvent; import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.FocusEvent; -import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.json.client.JSONObject; import com.google.gwt.uibinder.client.UiBinder; @@ -22,6 +19,7 @@ import com.google.gwt.uibinder.client.UiHandler; import com.google.gwt.user.client.ui.CheckBox; import com.google.gwt.user.client.ui.FlowPanel; +import com.google.gwt.user.client.ui.FocusPanel; import com.google.gwt.user.client.ui.Label; public class ProjectFolderNeo extends ProjectFolder { @@ -34,6 +32,7 @@ interface ProjectFolderUiBinderNeo extends UiBinder @UiField protected Label dateCreatedLabel; @UiField protected CheckBox checkBox; @UiField protected Icon expandButton; + @UiField protected FocusPanel expandbuttonFocusPanel; public ProjectFolderNeo(String name, long dateCreated, long dateModified, ProjectFolder parent) { super(name, dateCreated, dateModified, parent); @@ -58,6 +57,7 @@ public void bindUI() { super.dateCreatedLabel = dateCreatedLabel; super.checkBox = checkBox; super.expandButton = expandButton; + super.expandbuttonFocusPanel = expandbuttonFocusPanel; } @Override @@ -71,22 +71,13 @@ protected void toggleFolderSelection(ClickEvent e) { super.toggleFolderSelection(e); } - @UiHandler("checkBox") - protected void toggleFolderSelection(KeyDownEvent e) { - super.toggleFolderSelection(e); - } - - @UiHandler("checkBox") - protected void highlightContainer(FocusEvent e) { - super.highlightContainer(e); - } - - @UiHandler("checkBox") - protected void highlightContainer(BlurEvent e) { - super.highlightContainer(e); + @UiHandler("expandbuttonFocusPanel") + @Override + protected void toggleExpandedState(KeyDownEvent e) { + super.toggleExpandedState(e); } - @SuppressWarnings("unused") + @UiHandler("expandbuttonFocusPanel") @Override protected void toggleExpandedState(ClickEvent e) { super.toggleExpandedState(e); diff --git a/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectFolderNeo.ui.xml b/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectFolderNeo.ui.xml index d353dddfdc6..e34a6494010 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectFolderNeo.ui.xml +++ b/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectFolderNeo.ui.xml @@ -11,11 +11,13 @@ - - - - - + + + + + + + diff --git a/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectListItemNeo.java b/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectListItemNeo.java index 3d985795ed9..dcdcc3c70db 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectListItemNeo.java +++ b/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectListItemNeo.java @@ -5,20 +5,17 @@ package com.google.appinventor.client.style.neo; -import com.google.appinventor.client.Ode; import com.google.appinventor.client.explorer.project.Project; import com.google.appinventor.client.explorer.youngandroid.ProjectListItem; import com.google.gwt.core.client.GWT; -import com.google.gwt.event.dom.client.BlurEvent; import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.FocusEvent; -import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiHandler; import com.google.gwt.user.client.ui.CheckBox; import com.google.gwt.user.client.ui.FlowPanel; +import com.google.gwt.user.client.ui.FocusPanel; import com.google.gwt.user.client.ui.Label; public class ProjectListItemNeo extends ProjectListItem { @@ -33,6 +30,7 @@ interface ProjectListItemUiBinderNeo extends UiBinder - + + + diff --git a/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectListNeo.java b/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectListNeo.java index a9d3db11e0c..6af3a9dcb54 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectListNeo.java +++ b/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectListNeo.java @@ -15,6 +15,7 @@ import com.google.gwt.uibinder.client.UiHandler; import com.google.gwt.user.client.ui.CheckBox; import com.google.gwt.user.client.ui.FlowPanel; +import com.google.gwt.user.client.ui.FocusPanel; import com.google.gwt.user.client.ui.InlineLabel; public class ProjectListNeo extends ProjectList { @@ -29,6 +30,9 @@ interface ProjectListUiBinderNeo extends UiBinder {} @UiField InlineLabel createDateSortAsc; @UiField InlineLabel modDateSortDec; @UiField InlineLabel modDateSortAsc; + @UiField FocusPanel nameFocusPanel; + @UiField FocusPanel createdateFocusPanel; + @UiField FocusPanel modDateFocusPanel; @Override public void bindIU() { @@ -42,6 +46,9 @@ public void bindIU() { super.createDateSortDec = createDateSortDec; super.modDateSortAsc = modDateSortAsc; super.modDateSortDec = modDateSortDec; + super.nameFocusPanel = nameFocusPanel; + super.createdateFocusPanel = createdateFocusPanel; + super.modDateFocusPanel = modDateFocusPanel; Ode.getInstance().getFolderManager().addFolderManagerEventListener(this); // It is important to listen to project manager events as soon as possible. diff --git a/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectListNeo.ui.xml b/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectListNeo.ui.xml index 22926ab5803..c8dc07b320f 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectListNeo.ui.xml +++ b/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectListNeo.ui.xml @@ -11,30 +11,36 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/appinventor/appengine/war/static/css/Ya.css b/appinventor/appengine/war/static/css/Ya.css index 3c6ae3f275a..a20395dd2cc 100755 --- a/appinventor/appengine/war/static/css/Ya.css +++ b/appinventor/appengine/war/static/css/Ya.css @@ -328,13 +328,18 @@ div.StatusPanel { align-items: center; } +.ode-ProjectNameFocusPanel, +.ode-ExpandButtonFocusPanel, +.ode-NameFocusPanel { + flex-grow: 1; +} + .ode-ProjectNameLabel { font-weight: bold; font-size: small; color: #555; cursor: pointer; vertical-align: top; - padding-right: 10px; text-align: left; flex-grow: 1; min-width: 100px; @@ -372,10 +377,6 @@ div.StatusPanel { background-color: #fff6c3; } -.ode-ProjectRow-Selector { - background-color: #d2e0a6; -} - .ode-ProjectRowHidden { display:none; } From 4e2a97976d1a20188f9ae4857f71f4d693cff1c3 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Sun, 14 Jul 2024 20:30:07 +0530 Subject: [PATCH 13/43] neo --- .../appinventor/client/style/neo/ProjectFolderNeo.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectFolderNeo.java b/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectFolderNeo.java index 00dc8c35913..52806a74ef3 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectFolderNeo.java +++ b/appinventor/appengine/src/com/google/appinventor/client/style/neo/ProjectFolderNeo.java @@ -16,7 +16,6 @@ import com.google.gwt.json.client.JSONObject; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.uibinder.client.UiHandler; import com.google.gwt.user.client.ui.CheckBox; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.FocusPanel; @@ -71,13 +70,13 @@ protected void toggleFolderSelection(ClickEvent e) { super.toggleFolderSelection(e); } - @UiHandler("expandbuttonFocusPanel") + @SuppressWarnings("unused") @Override protected void toggleExpandedState(KeyDownEvent e) { super.toggleExpandedState(e); } - @UiHandler("expandbuttonFocusPanel") + @SuppressWarnings("unused") @Override protected void toggleExpandedState(ClickEvent e) { super.toggleExpandedState(e); From d53b2934454ff90337b21313a56718533b7df5c5 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Thu, 1 Aug 2024 01:13:57 +0530 Subject: [PATCH 14/43] adding components using keyboard only --- .../components/MockVisibleComponent.java | 5 ++ .../simple/palette/SimplePaletteItem.java | 57 +++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockVisibleComponent.java b/appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockVisibleComponent.java index 01da3fc8ddc..e822b31d1d4 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockVisibleComponent.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockVisibleComponent.java @@ -10,6 +10,7 @@ import com.google.appinventor.client.ComponentsTranslation; import com.google.appinventor.client.editor.simple.SimpleEditor; +import com.google.appinventor.client.editor.simple.SimpleNonVisibleComponentsPanel; import com.google.appinventor.client.editor.youngandroid.properties.YoungAndroidLengthPropertyEditor; import com.google.appinventor.client.widgets.properties.TextPropertyEditor; import com.google.appinventor.components.common.ComponentConstants; @@ -158,4 +159,8 @@ public void onPropertyChange(String propertyName, String newValue) { refreshForm(); } } + + public SimpleNonVisibleComponentsPanel getNonVisibleComponentsPanel() { + return editor.getNonVisibleComponentsPanel(); + } } diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/simple/palette/SimplePaletteItem.java b/appinventor/appengine/src/com/google/appinventor/client/editor/simple/palette/SimplePaletteItem.java index 1e18fa2dbce..0e00fd0ffb4 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/simple/palette/SimplePaletteItem.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/simple/palette/SimplePaletteItem.java @@ -6,12 +6,23 @@ package com.google.appinventor.client.editor.simple.palette; +import java.util.List; + import com.google.appinventor.client.ComponentsTranslation; import com.google.appinventor.client.editor.simple.components.MockComponent; import com.google.appinventor.client.editor.simple.components.MockComponentsUtil; +import com.google.appinventor.client.editor.simple.components.MockContainer; +import com.google.appinventor.client.editor.simple.components.MockVisibleComponent; import com.google.appinventor.client.widgets.dnd.DragSourcePanel; import com.google.appinventor.client.widgets.dnd.DragSourceSupport; import com.google.appinventor.client.widgets.dnd.DropTarget; +import com.google.gwt.event.dom.client.DoubleClickEvent; +import com.google.gwt.event.dom.client.DoubleClickHandler; +import com.google.gwt.event.dom.client.FocusEvent; +import com.google.gwt.event.dom.client.FocusHandler; +import com.google.gwt.event.dom.client.KeyCodes; +import com.google.gwt.event.dom.client.KeyDownEvent; +import com.google.gwt.event.dom.client.KeyDownHandler; import com.google.gwt.event.dom.client.MouseDownEvent; import com.google.gwt.event.dom.client.MouseDownHandler; import com.google.gwt.event.dom.client.TouchStartEvent; @@ -114,6 +125,52 @@ public void onTouchStart(TouchStartEvent event) { select(getWidget()); } }); + addFocusHandler(new FocusHandler() { + @Override + public void onFocus(FocusEvent event) { + select(getWidget()); + } + }); + addKeyDownHandler(new KeyDownHandler() { + @Override + public void onKeyDown (KeyDownEvent event) { + if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { + addComponent(); + } + } + }); + addDoubleClickHandler(new DoubleClickHandler() { + public void onDoubleClick (DoubleClickEvent event) { + addComponent(); + } + }); + } + + private void addComponent() { + boolean added = false; + MockComponent component = createMockComponent(); + MockVisibleComponent mockVisibleComponent = (MockVisibleComponent) dropTargetProvider.getDropTargets()[0]; + DropTarget[] dropTargets = dropTargetProvider.getDropTargets(); + for (DropTarget target : dropTargets) { + if(target instanceof MockContainer) + { + List mcl = mockVisibleComponent.getForm().getSelectedComponents(); + if(mcl.size()==1) { + if (mcl.get(0) instanceof MockContainer && mcl.get(0).isVisibleComponent()) { + MockContainer container = (MockContainer) mcl.get(0); + container.addComponent(component); + added = true; + break; + } + } + } + } + if (!added) { + mockVisibleComponent.getForm().addComponent(component); + } + if (!component.isVisibleComponent()) { + mockVisibleComponent.getNonVisibleComponentsPanel().addComponent(component); + } } /** From 347b05b3695223ada2f1c854d36ac69628f6bad8 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Thu, 1 Aug 2024 01:32:19 +0530 Subject: [PATCH 15/43] focus SourceStructureExplorerItem on selection change. --- .../appinventor/client/explorer/SourceStructureExplorer.java | 1 + 1 file changed, 1 insertion(+) diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/SourceStructureExplorer.java b/appinventor/appengine/src/com/google/appinventor/client/explorer/SourceStructureExplorer.java index c7d34f69867..e0f81c5e088 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/SourceStructureExplorer.java +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/SourceStructureExplorer.java @@ -105,6 +105,7 @@ public void onOpen(OpenEvent event) { tree.addSelectionHandler(new SelectionHandler() { @Override public void onSelection(SelectionEvent event) { + tree.setFocus(true); TreeItem treeItem = event.getSelectedItem(); if (treeItem != null) { Object userObject = treeItem.getUserObject(); From 79f7391a6cac1842e9d05d945a88251c9764f781 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Thu, 1 Aug 2024 02:27:27 +0530 Subject: [PATCH 16/43] Focus trap for new folder and new project dialog box --- .../client/wizards/NewFolderWizard.java | 16 ++++++++++++++++ .../client/wizards/NewFolderWizard.ui.xml | 4 +++- .../NewYoungAndroidProjectWizard.java | 14 +++++++++++++- .../NewYoungAndroidProjectWizard.ui.xml | 2 ++ appinventor/appengine/war/static/css/Ya.css | 15 +++++++++++++++ 5 files changed, 49 insertions(+), 2 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/wizards/NewFolderWizard.java b/appinventor/appengine/src/com/google/appinventor/client/wizards/NewFolderWizard.java index 0ecb46868ea..a62b1f6d398 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/wizards/NewFolderWizard.java +++ b/appinventor/appengine/src/com/google/appinventor/client/wizards/NewFolderWizard.java @@ -8,7 +8,11 @@ import com.google.appinventor.client.widgets.LabeledTextBox; import com.google.appinventor.client.widgets.Validator; import com.google.gwt.core.client.GWT; +import com.google.gwt.event.dom.client.BlurEvent; +import com.google.gwt.event.dom.client.BlurHandler; import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.FocusEvent; +import com.google.gwt.event.dom.client.FocusHandler; import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.event.dom.client.KeyDownHandler; @@ -41,6 +45,8 @@ interface NewFolderWizardUiBinder extends UiBinder {} @UiField Button cancelButton; @UiField LabeledTextBox input; @UiField Tree tree; + @UiField Button topInvisible; + @UiField Button bottomInvisible; /** * Creates a new command for renaming projects @@ -117,4 +123,14 @@ void addFolder(ClickEvent e) { } addDialog.hide(); } + + @UiHandler("topInvisible") + protected void FocusLast(FocusEvent event) { + addButton.setFocus(true); + } + + @UiHandler("bottomInvisible") + protected void FocusFirst(FocusEvent event) { + input.setFocus(true); + } } diff --git a/appinventor/appengine/src/com/google/appinventor/client/wizards/NewFolderWizard.ui.xml b/appinventor/appengine/src/com/google/appinventor/client/wizards/NewFolderWizard.ui.xml index 88f81c9e685..b50671945bd 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/wizards/NewFolderWizard.ui.xml +++ b/appinventor/appengine/src/com/google/appinventor/client/wizards/NewFolderWizard.ui.xml @@ -13,16 +13,18 @@ + - + + diff --git a/appinventor/appengine/src/com/google/appinventor/client/wizards/youngandroid/NewYoungAndroidProjectWizard.java b/appinventor/appengine/src/com/google/appinventor/client/wizards/youngandroid/NewYoungAndroidProjectWizard.java index 3f44309c8f2..49d92821b82 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/wizards/youngandroid/NewYoungAndroidProjectWizard.java +++ b/appinventor/appengine/src/com/google/appinventor/client/wizards/youngandroid/NewYoungAndroidProjectWizard.java @@ -17,6 +17,7 @@ import com.google.gwt.core.client.GWT; import com.google.appinventor.client.widgets.Validator; import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.FocusEvent; import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.event.dom.client.KeyDownHandler; @@ -67,6 +68,8 @@ interface NewYoungAndroidProjectWizardUiBinder extends UiBinder + @@ -33,6 +34,7 @@ + diff --git a/appinventor/appengine/war/static/css/Ya.css b/appinventor/appengine/war/static/css/Ya.css index a20395dd2cc..99f04ff2928 100755 --- a/appinventor/appengine/war/static/css/Ya.css +++ b/appinventor/appengine/war/static/css/Ya.css @@ -841,6 +841,8 @@ div.StatusPanel { .gwt-Tree .gwt-TreeItem span:hover, .gwt-Tree .gwt-TreeItem-selected span { background-color: #d2e0a6; + outline:#000000 2px solid; + border-radius: 4px; } /* Young Android Toolbar */ @@ -1627,6 +1629,19 @@ path.ode-SimpleMockMapFeature-selected { /* All dialog boxes */ +.FocusTrap { + position: absolute; + left: -9999px; + width: 1px; + height: 1px; + opacity: 0; + overflow: hidden; + border: none; + background: none; + padding: 0; + margin: 0; +} + /* Start of NoProjectsDialogBox. */ .ode-noDialogDiv { box-shadow: 0 0 10px gray; From 6115d959f0acc722e9f36fde1a163e2327ae91b4 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Mon, 5 Aug 2024 22:11:31 +0530 Subject: [PATCH 17/43] component adding --- .../editor/simple/palette/SimplePaletteItem.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/simple/palette/SimplePaletteItem.java b/appinventor/appengine/src/com/google/appinventor/client/editor/simple/palette/SimplePaletteItem.java index 0e00fd0ffb4..80b5e088863 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/simple/palette/SimplePaletteItem.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/simple/palette/SimplePaletteItem.java @@ -154,14 +154,12 @@ private void addComponent() { for (DropTarget target : dropTargets) { if(target instanceof MockContainer) { - List mcl = mockVisibleComponent.getForm().getSelectedComponents(); - if(mcl.size()==1) { - if (mcl.get(0) instanceof MockContainer && mcl.get(0).isVisibleComponent()) { - MockContainer container = (MockContainer) mcl.get(0); - container.addComponent(component); - added = true; - break; - } + MockComponent selectedComponent = mockVisibleComponent.getForm().getLastSelectedComponent(); + if (selectedComponent instanceof MockContainer && selectedComponent.isVisibleComponent()) { + MockContainer container = (MockContainer) selectedComponent; + container.addComponent(component); + added = true; + break; } } } From cd1c39e16d148a90558fe047fa5b881324269489 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Thu, 8 Aug 2024 23:34:38 +0530 Subject: [PATCH 18/43] property editors made keyboard accessible --- .../properties/YoungAndroidLengthPropertyEditor.java | 6 ++++++ .../properties/AdditionalChoicePropertyEditor.java | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/properties/YoungAndroidLengthPropertyEditor.java b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/properties/YoungAndroidLengthPropertyEditor.java index 1745fb951b8..65d98a312db 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/properties/YoungAndroidLengthPropertyEditor.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/properties/YoungAndroidLengthPropertyEditor.java @@ -140,6 +140,12 @@ public void onClick(ClickEvent event) { initAdditionalChoicePanel(panel); } + @Override + protected void openAdditionalChoiceDialog() { + super.openAdditionalChoiceDialog(); + automaticRadioButton.setFocus(true); + } + @Override protected void updateValue() { super.updateValue(); diff --git a/appinventor/appengine/src/com/google/appinventor/client/widgets/properties/AdditionalChoicePropertyEditor.java b/appinventor/appengine/src/com/google/appinventor/client/widgets/properties/AdditionalChoicePropertyEditor.java index 495467f2bdd..aa95b36c429 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/widgets/properties/AdditionalChoicePropertyEditor.java +++ b/appinventor/appengine/src/com/google/appinventor/client/widgets/properties/AdditionalChoicePropertyEditor.java @@ -9,6 +9,9 @@ import static com.google.appinventor.client.Ode.MESSAGES; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.event.dom.client.KeyCodes; +import com.google.gwt.event.dom.client.KeyDownEvent; +import com.google.gwt.event.dom.client.KeyDownHandler; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.HorizontalPanel; @@ -45,6 +48,14 @@ public void onClick(ClickEvent event) { openAdditionalChoiceDialog(); } }); + summary.addKeyDownHandler(new KeyDownHandler() { + @Override + public void onKeyDown(KeyDownEvent event) { + if(event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { + openAdditionalChoiceDialog(); + } + } + }); initWidget(summary); } @@ -154,6 +165,7 @@ protected final void closeAdditionalChoiceDialog(boolean ok) { updateValue(); // Restore previous property value } popup.hide(); + summary.setFocus(true); } /** From 18484a397829b685a06b0a5f9504301f9a8393ae Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Fri, 9 Aug 2024 02:18:46 +0530 Subject: [PATCH 19/43] better focus visibility for checkboxes and ColorChoicePropertyEditor --- appinventor/appengine/war/static/css/Ya.css | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/appinventor/appengine/war/static/css/Ya.css b/appinventor/appengine/war/static/css/Ya.css index 99f04ff2928..d2605f80909 100755 --- a/appinventor/appengine/war/static/css/Ya.css +++ b/appinventor/appengine/war/static/css/Ya.css @@ -1241,13 +1241,14 @@ select.ode-PropertyEditor[disabled] { } .ode-ColorChoicePropertyEditor:focus { + border-color: #D3D3D3; outline: 0; outline: thin dotted \9; /* IE6-9 */ - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0); - -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0); + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px #D3D3D3; + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px #D3D3D3; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.07), 0 0 8px #D3D3D3; } .ode-SimpleFormDesigner { @@ -1258,6 +1259,10 @@ select.ode-PropertyEditor[disabled] { font-size: 12px; } +.gwt-CheckBox input[type="checkbox"]:focus { + outline: 2px solid #333; +} + .ode-SimpleMockForm { height: auto !important; background-color: #d2e0a6; From f4cb8506e913185f46f5e6e68ce01818b1907251 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Mon, 12 Aug 2024 00:47:09 +0530 Subject: [PATCH 20/43] Dropdown button maintaing focus, check box visibility and UI settings focus trap --- .../widgets/properties/ChoicePropertyEditor.java | 2 ++ .../properties/SubsetJSONPropertyEditor.java | 5 +++++ .../google/appinventor/client/wizards/Dialog.java | 1 + .../client/wizards/UISettingsWizard.java | 14 ++++++++++++++ .../client/wizards/UISettingsWizard.ui.xml | 2 ++ appinventor/appengine/war/static/css/Ya.css | 13 ++++++------- 6 files changed, 30 insertions(+), 7 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/widgets/properties/ChoicePropertyEditor.java b/appinventor/appengine/src/com/google/appinventor/client/widgets/properties/ChoicePropertyEditor.java index a9fbbb22079..fd428b0befe 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/widgets/properties/ChoicePropertyEditor.java +++ b/appinventor/appengine/src/com/google/appinventor/client/widgets/properties/ChoicePropertyEditor.java @@ -108,6 +108,7 @@ public void execute() { if (autoupdate) { updateValue(); } + dropDownButton.setFocus(true); } })); if (Objects.equals(choice.value, defaultValue)) { @@ -139,6 +140,7 @@ public void execute() { boolean multiple = isMultipleValues(); setMultipleValues(false); property.setValue(choice.value, multiple); + dropDownButton.setFocus(true); } })); } diff --git a/appinventor/appengine/src/com/google/appinventor/client/widgets/properties/SubsetJSONPropertyEditor.java b/appinventor/appengine/src/com/google/appinventor/client/widgets/properties/SubsetJSONPropertyEditor.java index 2c7a261f419..5a65ca8a662 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/widgets/properties/SubsetJSONPropertyEditor.java +++ b/appinventor/appengine/src/com/google/appinventor/client/widgets/properties/SubsetJSONPropertyEditor.java @@ -120,6 +120,7 @@ public void onChange(ChangeEvent changeEvent) { public void execute() { property.setValue(BeginnerToolkit.INSTANCE.getToolkit().getText()); updateValue(); + dropDownButton.setFocus(true); }})); items.add(new DropDownItem("Subset Property Editor", MESSAGES.intermediateToolkitButton(), new Command() { @@ -127,6 +128,7 @@ public void execute() { public void execute() { property.setValue(IntermediateToolkit.INSTANCE.getToolkit().getText()); updateValue(); + dropDownButton.setFocus(true); }})); items.add(new DropDownItem("Subset Property Editor", MESSAGES.expertToolkitButton(), new Command() { @@ -134,6 +136,7 @@ public void execute() { public void execute() { property.setValue(""); updateValue(); + dropDownButton.setFocus(true); }})); if (!newProject) { items.add(new DropDownItem("Subset Property Editor", MESSAGES.matchProjectButton(), new Command() { @@ -142,6 +145,7 @@ public void execute() { matchProject(); property.setValue(createJSONString()); updateValue(); + dropDownButton.setFocus(true); } })); } @@ -158,6 +162,7 @@ public void execute() { @Override public void execute() { showCustomSubsetPanel(); + dropDownButton.setFocus(true); }})); dropDownButton = new DropDownButton("Subset Property Editor", "", items, false); diff --git a/appinventor/appengine/src/com/google/appinventor/client/wizards/Dialog.java b/appinventor/appengine/src/com/google/appinventor/client/wizards/Dialog.java index ac75cd3667a..209c0d20be6 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/wizards/Dialog.java +++ b/appinventor/appengine/src/com/google/appinventor/client/wizards/Dialog.java @@ -19,6 +19,7 @@ public Dialog() { super(false, true, new CaptionImpl()); caption = getCaption(); setGlassEnabled(true); + setModal(false); } public void setCaption(String text) { diff --git a/appinventor/appengine/src/com/google/appinventor/client/wizards/UISettingsWizard.java b/appinventor/appengine/src/com/google/appinventor/client/wizards/UISettingsWizard.java index e774d21debd..725015e3494 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/wizards/UISettingsWizard.java +++ b/appinventor/appengine/src/com/google/appinventor/client/wizards/UISettingsWizard.java @@ -8,6 +8,7 @@ import com.google.appinventor.client.Ode; import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.FocusEvent; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiHandler; @@ -32,6 +33,8 @@ interface UISettingsWizardUiBinder extends UiBinder {} // @UiField protected RadioButton darkModeRadioButton; @UiField protected RadioButton classicRadioButton; @UiField protected RadioButton modernRadioButton; + @UiField protected Button topInvisible; + @UiField protected Button bottomInvisible; Boolean userThemePreference; Boolean userLayoutPreference; @@ -62,6 +65,7 @@ public void bindUI() { public void show() { UIDialog.center(); + classicRadioButton.setFocus(true); } // @UiHandler("darkModeButton") @@ -115,4 +119,14 @@ protected void applySettings(ClickEvent e) { Ode.saveUserDesignSettings(); UIDialog.hide(); } + + @UiHandler("topInvisible") + protected void FocusLast(FocusEvent event) { + applyButton.setFocus(true); + } + + @UiHandler("bottomInvisible") + protected void FocusFirst(FocusEvent event) { + classicRadioButton.setFocus(true); + } } diff --git a/appinventor/appengine/src/com/google/appinventor/client/wizards/UISettingsWizard.ui.xml b/appinventor/appengine/src/com/google/appinventor/client/wizards/UISettingsWizard.ui.xml index 400ba87373f..9cd59ad6769 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/wizards/UISettingsWizard.ui.xml +++ b/appinventor/appengine/src/com/google/appinventor/client/wizards/UISettingsWizard.ui.xml @@ -11,6 +11,7 @@ + @@ -42,6 +43,7 @@ + diff --git a/appinventor/appengine/war/static/css/Ya.css b/appinventor/appengine/war/static/css/Ya.css index d2605f80909..416f384e23a 100755 --- a/appinventor/appengine/war/static/css/Ya.css +++ b/appinventor/appengine/war/static/css/Ya.css @@ -841,8 +841,6 @@ div.StatusPanel { .gwt-Tree .gwt-TreeItem span:hover, .gwt-Tree .gwt-TreeItem-selected span { background-color: #d2e0a6; - outline:#000000 2px solid; - border-radius: 4px; } /* Young Android Toolbar */ @@ -1210,7 +1208,7 @@ div.StatusPanel { } .ode-ChoicePropertyEditor:focus { - border-color: #D3D3D3; + border-color: rgba(82, 168, 236, 0.8); outline: 0; outline: thin dotted \9; /* IE6-9 */ @@ -1241,14 +1239,14 @@ select.ode-PropertyEditor[disabled] { } .ode-ColorChoicePropertyEditor:focus { - border-color: #D3D3D3; + border-color: rgba(82, 168, 236, 0.8); outline: 0; outline: thin dotted \9; /* IE6-9 */ - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px #D3D3D3; - -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px #D3D3D3; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.07), 0 0 8px #D3D3D3; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.8); + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.8); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.07), 0 0 8px rgba(82, 168, 236, 0.8); } .ode-SimpleFormDesigner { @@ -2190,6 +2188,7 @@ input[type="email"]:focus, input[type="url"]:focus, input[type="search"]:focus, input[type="tel"]:focus, +input[type="checkbox"]:focus, input[type="color"]:focus, .uneditable-input:focus { border-color: rgba(82, 168, 236, 0.8); From 9a96f1a9a84225b4a5debdddb046940ff667bc71 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Mon, 12 Aug 2024 01:10:43 +0530 Subject: [PATCH 21/43] Color choice property editor maintains focus after selection. --- .../client/widgets/properties/ColorChoicePropertyEditor.java | 1 + 1 file changed, 1 insertion(+) diff --git a/appinventor/appengine/src/com/google/appinventor/client/widgets/properties/ColorChoicePropertyEditor.java b/appinventor/appengine/src/com/google/appinventor/client/widgets/properties/ColorChoicePropertyEditor.java index 74663b00687..e63841b0a59 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/widgets/properties/ColorChoicePropertyEditor.java +++ b/appinventor/appengine/src/com/google/appinventor/client/widgets/properties/ColorChoicePropertyEditor.java @@ -189,6 +189,7 @@ public void execute() { color.alphaString + color.rgbString; selectedColorMenu.replaceLastItem(new DropDownItem(WIDGET_NAME, makeCustomHTML(customColor), showCustomPicker)); } + selectedColorMenu.setFocus(true); } })); } From 25d4f321290abb776f9d4e30fd09190dd7b633fe Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Wed, 14 Aug 2024 18:48:15 +0530 Subject: [PATCH 22/43] tree highlight and focus-trap in move projects dialog --- .../explorer/SourceStructureExplorer.java | 22 ++++++++++++- .../client/wizards/MoveProjectsWizard.java | 32 ++++++++++++++++++- .../client/wizards/MoveProjectsWizard.ui.xml | 6 +++- .../client/wizards/NewFolderWizard.java | 14 ++++++++ appinventor/appengine/war/static/css/Ya.css | 4 +++ 5 files changed, 75 insertions(+), 3 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/SourceStructureExplorer.java b/appinventor/appengine/src/com/google/appinventor/client/explorer/SourceStructureExplorer.java index e0f81c5e088..618f8959dfe 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/SourceStructureExplorer.java +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/SourceStructureExplorer.java @@ -9,8 +9,12 @@ import com.google.appinventor.client.Ode; import com.google.appinventor.client.widgets.TextButton; import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.event.dom.client.FocusEvent; +import com.google.gwt.event.dom.client.FocusHandler; import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.event.dom.client.KeyDownHandler; +import com.google.gwt.event.dom.client.BlurEvent; +import com.google.gwt.event.dom.client.BlurHandler; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.logical.shared.CloseHandler; @@ -104,7 +108,7 @@ public void onOpen(OpenEvent event) { }); tree.addSelectionHandler(new SelectionHandler() { @Override - public void onSelection(SelectionEvent event) { + public void onSelection(SelectionEvent event) { tree.setFocus(true); TreeItem treeItem = event.getSelectedItem(); if (treeItem != null) { @@ -137,6 +141,18 @@ public void onKeyDown(KeyDownEvent event) { } } }); + tree.addFocusHandler(new FocusHandler() { + @Override + public void onFocus(FocusEvent event) { + tree.getParent().setStyleName("gwt-Tree-focused"); + } + }); + tree.addBlurHandler(new BlurHandler() { + @Override + public void onBlur(BlurEvent event) { + tree.getParent().removeStyleName("gwt-Tree-focused"); + } + }); // Put a ScrollPanel around the tree. ScrollPanel scrollPanel = new ScrollPanel(tree); @@ -323,4 +339,8 @@ public void selectItem(SourceStructureExplorerItem item) { public void unselectItem(SourceStructureExplorerItem item) { selectItem(item, false); } + + public Tree getTree() { + return tree; + } } diff --git a/appinventor/appengine/src/com/google/appinventor/client/wizards/MoveProjectsWizard.java b/appinventor/appengine/src/com/google/appinventor/client/wizards/MoveProjectsWizard.java index fec69b4b033..b4f739d9c0a 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/wizards/MoveProjectsWizard.java +++ b/appinventor/appengine/src/com/google/appinventor/client/wizards/MoveProjectsWizard.java @@ -13,7 +13,11 @@ import com.google.appinventor.client.explorer.project.Project; import com.google.appinventor.client.explorer.youngandroid.ProjectList; import com.google.gwt.core.client.GWT; +import com.google.gwt.event.dom.client.BlurEvent; +import com.google.gwt.event.dom.client.BlurHandler; import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.FocusEvent; +import com.google.gwt.event.dom.client.FocusHandler; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiHandler; @@ -36,7 +40,8 @@ interface MoveProjectsWizardUiBinder extends UiBinder + - + + + + diff --git a/appinventor/appengine/src/com/google/appinventor/client/wizards/NewFolderWizard.java b/appinventor/appengine/src/com/google/appinventor/client/wizards/NewFolderWizard.java index a62b1f6d398..d8222aa15fb 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/wizards/NewFolderWizard.java +++ b/appinventor/appengine/src/com/google/appinventor/client/wizards/NewFolderWizard.java @@ -96,6 +96,20 @@ public void onKeyUp(KeyUpEvent event) { //Validate the text each time a key is l input.validate(); } }); + + tree.addFocusHandler(new FocusHandler() { + @Override + public void onFocus(FocusEvent event) { + tree.getParent().setStyleName("gwt-Tree-focused"); + } + }); + + tree.addBlurHandler(new BlurHandler() { + @Override + public void onBlur(BlurEvent event) { + tree.getParent().removeStyleName("gwt-Tree-focused"); + } + }); } private FolderTreeItem renderFolder(ProjectFolder folder) { diff --git a/appinventor/appengine/war/static/css/Ya.css b/appinventor/appengine/war/static/css/Ya.css index 416f384e23a..19cbbc9fa64 100755 --- a/appinventor/appengine/war/static/css/Ya.css +++ b/appinventor/appengine/war/static/css/Ya.css @@ -843,6 +843,10 @@ div.StatusPanel { background-color: #d2e0a6; } +.gwt-Tree-focused { + outline: solid 2px #000000; +} + /* Young Android Toolbar */ .ya-Toolbar { From e7e3b0f81f4fe62e321b1c99b91cf12e2d0b3c05 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Mon, 19 Aug 2024 21:01:01 +0530 Subject: [PATCH 23/43] Focus search text box with / (better code) --- .../palette/YoungAndroidPalettePanel.java | 27 ++++++------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/palette/YoungAndroidPalettePanel.java b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/palette/YoungAndroidPalettePanel.java index e9b2bdf740a..e772e08780b 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/palette/YoungAndroidPalettePanel.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/palette/YoungAndroidPalettePanel.java @@ -30,8 +30,6 @@ import com.google.gwt.event.dom.client.ChangeHandler; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.event.dom.client.FocusEvent; -import com.google.gwt.event.dom.client.FocusHandler; import com.google.gwt.user.client.ui.Anchor; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HasHorizontalAlignment; @@ -82,7 +80,6 @@ public class YoungAndroidPalettePanel extends Composite implements SimplePalette private final Map translationMap; private final TextBox searchText; - private boolean isSearchTextFocused = false; private final VerticalPanel searchResults; private JsArrayString arrayString = (JsArrayString) JsArrayString.createArray(); private String lastSearch = ""; @@ -184,13 +181,6 @@ public YoungAndroidPalettePanel(YaFormEditor editor) { @Override public void onBlur(BlurEvent event) { doSearch(); - isSearchTextFocused = false; - } - }); - searchText.addFocusHandler(new FocusHandler() { - @Override - public void onFocus(FocusEvent event) { - isSearchTextFocused = true; } }); searchText.addChangeHandler(new ChangeHandler() { @@ -205,16 +195,11 @@ public void onChange(ChangeEvent event) { @Override public void onKeyDown(KeyDownEvent event) { DesignToolbar designToolbar = Ode.getInstance().getDesignToolbar(); - if (designToolbar.currentView == DesignToolbar.View.FORM) { - if (event.getNativeKeyCode() == 191 && !isSearchTextFocused) { - { - event.preventDefault(); - searchText.setFocus(true); - isSearchTextFocused = true; - } + if (designToolbar.currentView == DesignToolbar.View.FORM && event.getNativeKeyCode() == 191 && !isTextboxFocused()) { + { + event.preventDefault(); + searchText.setFocus(true); } - } else { - isSearchTextFocused = false; } } }, KeyDownEvent.getType()); @@ -531,4 +516,8 @@ public void reloadComponents() { loadComponents(); } + public native boolean isTextboxFocused()/*-{ + var element = $doc.activeElement; + return (element.tagName.toLowerCase() === 'input' && element.type.toLowerCase() === 'text') || element.tagName.toLowerCase() === 'textarea'; + }-*/; } From e5d131f85a1be9603a6b579b12ae3fb860069697 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Mon, 19 Aug 2024 21:15:57 +0530 Subject: [PATCH 24/43] single line imports --- .../youngandroid/palette/YoungAndroidPalettePanel.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/palette/YoungAndroidPalettePanel.java b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/palette/YoungAndroidPalettePanel.java index e772e08780b..675b94fb356 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/palette/YoungAndroidPalettePanel.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/palette/YoungAndroidPalettePanel.java @@ -47,7 +47,12 @@ import jsinterop.annotations.JsOverlay; import jsinterop.annotations.JsType; -import java.util.*; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Iterator; +import java.util.Set; import static com.google.appinventor.client.Ode.MESSAGES; From dc22e439599a45aaced1a4df75fa43160fdc7ee3 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Mon, 19 Aug 2024 21:45:00 +0530 Subject: [PATCH 25/43] fix : Constructor visibility --- .../editor/youngandroid/actions/RefreshCompanionAction.java | 2 +- .../client/editor/youngandroid/actions/ResetAction.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/actions/RefreshCompanionAction.java b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/actions/RefreshCompanionAction.java index 358439e6ba5..4aab313fe5a 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/actions/RefreshCompanionAction.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/actions/RefreshCompanionAction.java @@ -13,7 +13,7 @@ public class RefreshCompanionAction implements Command { - private RefreshCompanionAction() { + public RefreshCompanionAction() { shortcutKeyHandler(); } diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/actions/ResetAction.java b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/actions/ResetAction.java index 8f44719993e..d97da5a5d89 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/actions/ResetAction.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/actions/ResetAction.java @@ -14,7 +14,7 @@ public class ResetAction implements Command { - private ResetAction() { + public ResetAction() { shortcutKeyHandler(); } From 596332520d5907c4c1c0af2f0072050afb02cbfd Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Sat, 24 Aug 2024 00:57:58 +0530 Subject: [PATCH 26/43] dialog boxes --- .../com/google/appinventor/client/Ode.java | 17 ++++++++++ .../simple/components/MockComponent.java | 34 +++++++++++++++---- .../explorer/commands/AddFormCommand.java | 8 ++--- .../CopyYoungAndroidProjectCommand.java | 8 ++--- .../explorer/commands/DeleteFileCommand.java | 30 +++++++++++++++- .../explorer/dialogs/NoProjectDialogBox.java | 17 ++++++++++ .../dialogs/NoProjectDialogBox.ui.xml | 3 +- .../dialogs/ProjectPropertiesDialogBox.java | 20 ++++++++++- .../dialogs/ProjectPropertiesDialogBox.ui.xml | 2 ++ .../client/wizards/FileUploadWizard.java | 14 ++++++++ .../client/wizards/FileUploadWizard.ui.xml | 2 ++ 11 files changed, 138 insertions(+), 17 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/Ode.java b/appinventor/appengine/src/com/google/appinventor/client/Ode.java index 430db9ad261..63975143d07 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/Ode.java +++ b/appinventor/appengine/src/com/google/appinventor/client/Ode.java @@ -20,6 +20,7 @@ import com.google.appinventor.client.editor.EditorManager; import com.google.appinventor.client.editor.FileEditor; import com.google.appinventor.client.editor.ProjectEditor; +import com.google.appinventor.client.editor.simple.components.MockComponent; import com.google.appinventor.client.editor.simple.palette.DropTargetProvider; import com.google.appinventor.client.editor.youngandroid.BlocklyPanel; import com.google.appinventor.client.editor.youngandroid.DesignToolbar; @@ -82,7 +83,11 @@ import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.RunAsyncCallback; +import com.google.gwt.dom.client.NativeEvent; +import com.google.gwt.event.dom.client.BlurHandler; import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.event.dom.client.KeyCodes; +import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.event.dom.client.MouseWheelEvent; import com.google.gwt.event.dom.client.MouseWheelHandler; import com.google.gwt.event.logical.shared.ValueChangeEvent; @@ -94,6 +99,7 @@ import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.Command; import com.google.gwt.user.client.Event; +import com.google.gwt.user.client.Event.NativePreviewEvent; import com.google.gwt.user.client.History; import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.Window; @@ -117,6 +123,8 @@ import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; +import com.google.gwt.widgetideas.client.event.KeyDownHandler; + import java.util.Random; import java.util.logging.Level; import java.util.logging.Logger; @@ -1609,6 +1617,15 @@ public DialogBox createEmptyTrashDialog(boolean showDialog) { dialogBox.show(); } + Event.addNativePreviewHandler(new Event.NativePreviewHandler() { + @Override + public void onPreviewNativeEvent(Event.NativePreviewEvent event) { + if (event.getTypeInt() == Event.ONKEYDOWN && dialogBox.isShowing()) { + dialogBox.hide(); + } + } + }); + return dialogBox; } diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockComponent.java b/appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockComponent.java index d16bdc76166..3f81102eebf 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockComponent.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockComponent.java @@ -39,10 +39,12 @@ import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.DomEvent; +import com.google.gwt.event.dom.client.FocusEvent; +import com.google.gwt.event.dom.client.FocusHandler; import com.google.gwt.event.dom.client.HasAllTouchHandlers; import com.google.gwt.event.dom.client.KeyCodes; -import com.google.gwt.event.dom.client.KeyUpEvent; -import com.google.gwt.event.dom.client.KeyUpHandler; +import com.google.gwt.event.dom.client.KeyDownEvent; +import com.google.gwt.event.dom.client.KeyDownHandler; import com.google.gwt.event.dom.client.TouchCancelHandler; import com.google.gwt.event.dom.client.TouchEndHandler; import com.google.gwt.event.dom.client.TouchMoveHandler; @@ -110,12 +112,15 @@ private class RenameDialog extends DialogBox { private final LabeledTextBox newNameTextBox; RenameDialog(String oldName) { - super(false, true); - + super(false, false); + setGlassEnabled(true); setStylePrimaryName("ode-DialogBox"); setText(MESSAGES.renameTitle()); VerticalPanel contentPanel = new VerticalPanel(); + Button topInvisible = new Button(); + contentPanel.add(topInvisible); + LabeledTextBox oldNameTextBox = new LabeledTextBox(MESSAGES.oldNameLabel()); oldNameTextBox.setText(getName()); oldNameTextBox.setEnabled(false); @@ -123,9 +128,9 @@ private class RenameDialog extends DialogBox { newNameTextBox = new LabeledTextBox(MESSAGES.newNameLabel()); newNameTextBox.setText(oldName); - newNameTextBox.getTextBox().addKeyUpHandler(new KeyUpHandler() { + newNameTextBox.getTextBox().addKeyDownHandler(new KeyDownHandler() { @Override - public void onKeyUp(KeyUpEvent event) { + public void onKeyDown(KeyDownEvent event) { int keyCode = event.getNativeKeyCode(); if (keyCode == KeyCodes.KEY_ENTER) { handleOkClick(); @@ -150,9 +155,26 @@ public void onClick(ClickEvent event) { handleOkClick(); } }); + + Button bottomInvisible = new Button(); + bottomInvisible.setStyleName("FocusTrap"); + topInvisible.setStyleName("FocusTrap"); + topInvisible.addFocusHandler(new FocusHandler() { + @Override + public void onFocus(FocusEvent event) { + okButton.setFocus(true); + } + }); + bottomInvisible.addFocusHandler(new FocusHandler() { + public void onFocus(FocusEvent event) { + newNameTextBox.setFocus(true); + } + }); + HorizontalPanel buttonPanel = new HorizontalPanel(); buttonPanel.add(cancelButton); buttonPanel.add(okButton); + buttonPanel.add(bottomInvisible); buttonPanel.setSize("100%", "24px"); contentPanel.add(buttonPanel); contentPanel.setSize("320px", "100%"); diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/commands/AddFormCommand.java b/appinventor/appengine/src/com/google/appinventor/client/explorer/commands/AddFormCommand.java index 15aff037a04..386156e85b9 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/commands/AddFormCommand.java +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/commands/AddFormCommand.java @@ -25,8 +25,8 @@ import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.KeyCodes; -import com.google.gwt.event.dom.client.KeyUpEvent; -import com.google.gwt.event.dom.client.KeyUpHandler; +import com.google.gwt.event.dom.client.KeyDownEvent; +import com.google.gwt.event.dom.client.KeyDownHandler; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.DialogBox; @@ -109,9 +109,9 @@ private class NewFormDialog extends DialogBox { newNameTextBox = new LabeledTextBox(MESSAGES.formNameLabel()); newNameTextBox.setText(defaultFormName); - newNameTextBox.getTextBox().addKeyUpHandler(new KeyUpHandler() { + newNameTextBox.getTextBox().addKeyDownHandler(new KeyDownHandler() { @Override - public void onKeyUp(KeyUpEvent event) { + public void onKeyDown(KeyDownEvent event) { int keyCode = event.getNativeKeyCode(); if (keyCode == KeyCodes.KEY_ENTER) { handleOkClick(projectRootNode); diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/commands/CopyYoungAndroidProjectCommand.java b/appinventor/appengine/src/com/google/appinventor/client/explorer/commands/CopyYoungAndroidProjectCommand.java index d865352e557..444bdd0626b 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/commands/CopyYoungAndroidProjectCommand.java +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/commands/CopyYoungAndroidProjectCommand.java @@ -20,8 +20,8 @@ import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.KeyCodes; -import com.google.gwt.event.dom.client.KeyUpEvent; -import com.google.gwt.event.dom.client.KeyUpHandler; +import com.google.gwt.event.dom.client.KeyDownEvent; +import com.google.gwt.event.dom.client.KeyDownHandler; import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.user.client.Command; import com.google.gwt.user.client.DeferredCommand; @@ -154,9 +154,9 @@ public String getErrorMessage() { } }); newNameTextBox.setText(defaultNewName); - newNameTextBox.getTextBox().addKeyUpHandler(new KeyUpHandler() { + newNameTextBox.getTextBox().addKeyDownHandler(new KeyDownHandler() { @Override - public void onKeyUp(KeyUpEvent event) { + public void onKeyDown(KeyDownEvent event) { int keyCode = event.getNativeKeyCode(); if (keyCode == KeyCodes.KEY_ENTER) { handleOkClick(oldProjectNode); diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/commands/DeleteFileCommand.java b/appinventor/appengine/src/com/google/appinventor/client/explorer/commands/DeleteFileCommand.java index 9dc7d2518ef..190057aa4f5 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/commands/DeleteFileCommand.java +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/commands/DeleteFileCommand.java @@ -22,6 +22,9 @@ import com.google.gwt.core.client.Scheduler; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.event.dom.client.FocusEvent; +import com.google.gwt.event.dom.client.FocusHandler; +import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyUpEvent; import com.google.gwt.event.dom.client.KeyUpHandler; import com.google.gwt.user.client.Window; @@ -100,7 +103,8 @@ private class DeleteFormDialog extends DialogBox { private final String formName; DeleteFormDialog(final YoungAndroidSourceNode node) { - super(false, true); + super(false, false); + setGlassEnabled(true); this.node = node; formName = node.getFormName(); @@ -108,6 +112,11 @@ private class DeleteFormDialog extends DialogBox { setStylePrimaryName("ode-DialogBox"); setText(MESSAGES.removeFormButton()); + Button topInvisible = new Button(); + Button bottomInvisible = new Button(); + topInvisible.setStyleName("FocusTrap"); + bottomInvisible.setStyleName("FocusTrap"); + Button cancelButton = new Button(MESSAGES.cancelButton()); cancelButton.addClickHandler(new ClickHandler() { @Override @@ -133,11 +142,13 @@ public void onClick(ClickEvent event) { labelPanel.add(warnmsg); labelPanel.setSize("100%", "22px"); contentPanel.add(labelPanel); + contentPanel.add(topInvisible); contentPanel.add(nameTextBox); HorizontalPanel buttonPanel = new HorizontalPanel(); HorizontalPanel checkboxPanel = new HorizontalPanel(); buttonPanel.add(cancelButton); buttonPanel.add(deleteButton); + buttonPanel.add(bottomInvisible); checkboxPanel.add(cb); checkboxPanel.setSize("100%", "20px"); contentPanel.add(checkboxPanel); @@ -148,15 +159,32 @@ public void onClick(ClickEvent event) { nameTextBox.getTextBox().addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { + if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) { + hide(); + executionFailedOrCanceled(); + } if (nameTextBox.getText().equals(formName)) { deleteButton.setEnabled(true); nameTextBox.setColor("#00c8ff"); + if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { + handleOkClick(); + } } else { deleteButton.setEnabled(false); nameTextBox.setColor("red"); } } }); + topInvisible.addFocusHandler(new FocusHandler() { + public void onFocus(FocusEvent event) { + cancelButton.setFocus(true); + } + }); + bottomInvisible.addFocusHandler(new FocusHandler() { + public void onFocus(FocusEvent event) { + nameTextBox.setFocus(true); + } + }); add(contentPanel); } diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/dialogs/NoProjectDialogBox.java b/appinventor/appengine/src/com/google/appinventor/client/explorer/dialogs/NoProjectDialogBox.java index 3c03a337531..89d80708a2b 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/dialogs/NoProjectDialogBox.java +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/dialogs/NoProjectDialogBox.java @@ -12,6 +12,7 @@ import com.google.appinventor.client.wizards.youngandroid.NewYoungAndroidProjectWizard; import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.FocusEvent; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiHandler; @@ -54,6 +55,10 @@ public void execute(Project project) { Button goToYR; @UiField Button noDialogNewProject; + @UiField + Button topInvisible; + @UiField + Button bottomInvisible; /** * Creates a new dialog box when the user has no current projects in their @@ -66,6 +71,8 @@ public NoProjectDialogBox() { this.center(); this.setAnimationEnabled(true); this.setAutoHideEnabled(true); + this.setModal(false); + noDialogNewProject.setFocus(true); lastDialog = this; } @@ -109,4 +116,14 @@ public static void closeIfOpen() { lastDialog = null; } } + + @UiHandler("topInvisible") + protected void FocusLast(FocusEvent event) { + closeDialogBox.setFocus(true); + } + + @UiHandler("bottomInvisible") + protected void FocusFirst(FocusEvent event) { + goToPurr.setFocus(true); + } } diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/dialogs/NoProjectDialogBox.ui.xml b/appinventor/appengine/src/com/google/appinventor/client/explorer/dialogs/NoProjectDialogBox.ui.xml index 6b414d3744e..862747c0faf 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/dialogs/NoProjectDialogBox.ui.xml +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/dialogs/NoProjectDialogBox.ui.xml @@ -13,6 +13,7 @@ +

@@ -127,7 +128,7 @@

- + diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/dialogs/ProjectPropertiesDialogBox.java b/appinventor/appengine/src/com/google/appinventor/client/explorer/dialogs/ProjectPropertiesDialogBox.java index be50ee6b1bf..e0355cfe0ce 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/dialogs/ProjectPropertiesDialogBox.java +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/dialogs/ProjectPropertiesDialogBox.java @@ -20,6 +20,7 @@ import com.google.gwt.event.dom.client.ChangeEvent; import com.google.gwt.event.dom.client.ChangeHandler; import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.FocusEvent; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiHandler; @@ -58,6 +59,12 @@ interface ProjectPropertiesDialogBoxUiBinder extends UiBinder + @@ -27,6 +28,7 @@ >Close + diff --git a/appinventor/appengine/src/com/google/appinventor/client/wizards/FileUploadWizard.java b/appinventor/appengine/src/com/google/appinventor/client/wizards/FileUploadWizard.java index a9695dad0b4..b8bdbee6f38 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/wizards/FileUploadWizard.java +++ b/appinventor/appengine/src/com/google/appinventor/client/wizards/FileUploadWizard.java @@ -23,6 +23,7 @@ import com.google.appinventor.shared.rpc.project.youngandroid.YoungAndroidAssetsFolder; import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.FocusEvent; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiHandler; @@ -56,6 +57,8 @@ interface FileUploadWizardUiBinder extends UiBinder {} @UiField FileUpload upload; @UiField Button okButton; @UiField Button cancelButton; + @UiField Button topInvisible; + @UiField Button bottomInvisible; private final FolderNode folderNode; @@ -119,6 +122,7 @@ public FileUploadWizard(final FolderNode folderNode, public void show() { uploadDialog.center(); + upload.setFocus(true); } @UiHandler("cancelButton") @@ -264,5 +268,15 @@ private void finishUpload(FolderNode folderNode, String filename, } } + @UiHandler("topInvisible") + protected void FocusLast(FocusEvent event) { + okButton.setFocus(true); + } + + @UiHandler("bottomInvisible") + protected void FocusFirst(FocusEvent event) { + upload.setFocus(true); + } + } diff --git a/appinventor/appengine/src/com/google/appinventor/client/wizards/FileUploadWizard.ui.xml b/appinventor/appengine/src/com/google/appinventor/client/wizards/FileUploadWizard.ui.xml index 478751dc401..2503c21c0ab 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/wizards/FileUploadWizard.ui.xml +++ b/appinventor/appengine/src/com/google/appinventor/client/wizards/FileUploadWizard.ui.xml @@ -12,11 +12,13 @@ + + From b6f63300d9f430b4eb5f8aa76a97e58e06be964f Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Sat, 24 Aug 2024 02:43:56 +0530 Subject: [PATCH 27/43] updated isTextboxFocused method --- .../editor/youngandroid/palette/YoungAndroidPalettePanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/palette/YoungAndroidPalettePanel.java b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/palette/YoungAndroidPalettePanel.java index 675b94fb356..0503b1167d3 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/palette/YoungAndroidPalettePanel.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/palette/YoungAndroidPalettePanel.java @@ -523,6 +523,6 @@ public void reloadComponents() { public native boolean isTextboxFocused()/*-{ var element = $doc.activeElement; - return (element.tagName.toLowerCase() === 'input' && element.type.toLowerCase() === 'text') || element.tagName.toLowerCase() === 'textarea'; + return element.tagName === 'INPUT' && element.type === 'text' || element.tagName === 'TEXTAREA'; }-*/; } From 2a52e64f5388d8b4406ea78046677c28c2a2de1a Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Sun, 25 Aug 2024 23:48:42 +0530 Subject: [PATCH 28/43] Update: Component adding --- .../simple/palette/SimplePaletteItem.java | 29 +++++++------------ 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/simple/palette/SimplePaletteItem.java b/appinventor/appengine/src/com/google/appinventor/client/editor/simple/palette/SimplePaletteItem.java index 80b5e088863..329cefabbe4 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/simple/palette/SimplePaletteItem.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/simple/palette/SimplePaletteItem.java @@ -12,6 +12,7 @@ import com.google.appinventor.client.editor.simple.components.MockComponent; import com.google.appinventor.client.editor.simple.components.MockComponentsUtil; import com.google.appinventor.client.editor.simple.components.MockContainer; +import com.google.appinventor.client.editor.simple.components.MockForm; import com.google.appinventor.client.editor.simple.components.MockVisibleComponent; import com.google.appinventor.client.widgets.dnd.DragSourcePanel; import com.google.appinventor.client.widgets.dnd.DragSourceSupport; @@ -147,27 +148,17 @@ public void onDoubleClick (DoubleClickEvent event) { } private void addComponent() { - boolean added = false; MockComponent component = createMockComponent(); MockVisibleComponent mockVisibleComponent = (MockVisibleComponent) dropTargetProvider.getDropTargets()[0]; - DropTarget[] dropTargets = dropTargetProvider.getDropTargets(); - for (DropTarget target : dropTargets) { - if(target instanceof MockContainer) - { - MockComponent selectedComponent = mockVisibleComponent.getForm().getLastSelectedComponent(); - if (selectedComponent instanceof MockContainer && selectedComponent.isVisibleComponent()) { - MockContainer container = (MockContainer) selectedComponent; - container.addComponent(component); - added = true; - break; - } - } - } - if (!added) { - mockVisibleComponent.getForm().addComponent(component); - } - if (!component.isVisibleComponent()) { - mockVisibleComponent.getNonVisibleComponentsPanel().addComponent(component); + MockForm form = mockVisibleComponent.getForm(); + MockComponent selectedComponent = form.getLastSelectedComponent(); + if (selectedComponent instanceof MockContainer && ((MockContainer) selectedComponent).willAcceptComponentType(component.getType()) && component.isVisibleComponent()) { + ((MockContainer) selectedComponent).addComponent(component); + } else if (form.willAcceptComponentType(component.getType()) && component.isVisibleComponent()) { + form.addComponent(component); + } else if (form.willAcceptComponentType(component.getType()) && !component.isVisibleComponent()) { + form.addComponent(component); + form.getNonVisibleComponentsPanel().addComponent(component); } } From 4c98fafbeb65c37c437849b8189517117542e467 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Mon, 26 Aug 2024 02:58:57 +0530 Subject: [PATCH 29/43] Shortcuts Dialog box --- .../appinventor/client/OdeMessages.java | 33 +++++++++++ .../appinventor/client/TopToolbar.ui.xml | 3 + .../client/actions/ShowShortcutsAction.java | 59 +++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 appinventor/appengine/src/com/google/appinventor/client/actions/ShowShortcutsAction.java diff --git a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java index 0cad529d965..a126df78cb3 100755 --- a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java +++ b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java @@ -725,6 +725,10 @@ public interface OdeMessages extends Messages, AutogeneratedOdeMessages { @Description("Redisplay the Splash Screen") String showSplashMenuItem(); + @DefaultMessage("Show Keyboard Shortcuts (Alt + ?)") + @Description("Display the Shortcuts dialog") + String showShortcuts(); + @DefaultMessage("Library") @Description("Name of Library link") String libraryMenuItem(); @@ -5119,6 +5123,35 @@ String newerVersionComponentException(String componentType, int srcCompVersion, @Description("") String MaximumRangeMethods(); + @DefaultMessage( + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "
ActionKey Combination
Focus component search box/
Switch between Designer and Block editorCtrl + Alt
Rename ComponentAlt + N
Reset ConnectionAlt + Shift + R
Refresh Companion ScreenAlt + R
Open/Close BackpackAlt + B
Switch between Inline and External InputsAlt + I
Add comment to a blockAlt + K
Expand/Collapse blockAlt + O
Navigate up the blocksAlt + S
Navigate down the blocksAlt + W
Zoom inAlt + +
Zoom outAlt + -
Re-centerAlt + G
Open this dialogAlt + ?
") + @Description("") + String KeyBoardShortcuts(); + // =========== ListPicker @DefaultMessage("ItemTextColor") @Description("") diff --git a/appinventor/appengine/src/com/google/appinventor/client/TopToolbar.ui.xml b/appinventor/appengine/src/com/google/appinventor/client/TopToolbar.ui.xml index 8e053e17657..2c4f5951f33 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/TopToolbar.ui.xml +++ b/appinventor/appengine/src/com/google/appinventor/client/TopToolbar.ui.xml @@ -173,6 +173,9 @@ + + + diff --git a/appinventor/appengine/src/com/google/appinventor/client/actions/ShowShortcutsAction.java b/appinventor/appengine/src/com/google/appinventor/client/actions/ShowShortcutsAction.java new file mode 100644 index 00000000000..fbaa167b0e8 --- /dev/null +++ b/appinventor/appengine/src/com/google/appinventor/client/actions/ShowShortcutsAction.java @@ -0,0 +1,59 @@ +// -*- mode: java; c-basic-offset: 2; -*- +// Copyright 2009-2011 Google, All Rights reserved +// Copyright 2011-2023 MIT, All rights reserved +// Released under the Apache License, Version 2.0 +// http://www.apache.org/licenses/LICENSE-2.0 + +package com.google.appinventor.client.actions; + +import static com.google.appinventor.client.Ode.MESSAGES; + +import com.google.gwt.dom.client.NativeEvent; +import com.google.gwt.user.client.Command; +import com.google.gwt.user.client.Event; +import com.google.gwt.user.client.ui.DialogBox; +import com.google.gwt.user.client.ui.HTML; +import com.google.gwt.user.client.ui.VerticalPanel; + +public class ShowShortcutsAction implements Command { + + private DialogBox db; + + public ShowShortcutsAction() { + db = new DialogBox(true, false); + db.setText("Keyboard Shortcuts"); + db.setStyleName("ode-DialogBox"); + db.setHeight("200px"); + db.setWidth("400px"); + db.setGlassEnabled(true); + db.setAnimationEnabled(true); + + shortcutKeyHandler(); + } + + @Override + public void execute() { + VerticalPanel DialogBoxContents = new VerticalPanel(); + HTML message = new HTML(MESSAGES.KeyBoardShortcuts()); + DialogBoxContents.add(message); + db.setWidget(DialogBoxContents); + db.center(); + db.show(); + } + + private void shortcutKeyHandler() { + Event.addNativePreviewHandler(new Event.NativePreviewHandler() { + @Override + public void onPreviewNativeEvent(Event.NativePreviewEvent event) { + NativeEvent nativeEvent = event.getNativeEvent(); + if (event.getTypeInt() == Event.ONKEYDOWN && nativeEvent.getAltKey() && nativeEvent.getKeyCode() == 191 && !db.isShowing()) { + nativeEvent.preventDefault(); + execute(); + } else if (event.getTypeInt() == Event.ONKEYDOWN) { + nativeEvent.preventDefault(); + db.hide(); + } + } + }); + } +} From 5f40827d169703d9885c887addf62bb74250dcb5 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Mon, 26 Aug 2024 11:40:52 +0530 Subject: [PATCH 30/43] fix: shortcuts dialog --- .../src/com/google/appinventor/client/OdeMessages.java | 1 + .../google/appinventor/client/actions/ShowShortcutsAction.java | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java index a126df78cb3..6ac3b4dd6c8 100755 --- a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java +++ b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java @@ -5146,6 +5146,7 @@ String newerVersionComponentException(String componentType, int srcCompVersion, "Zoom inAlt + +" + "Zoom outAlt + -" + "Re-centerAlt + G" + + "Navigate Components↑/↓" + "Open this dialogAlt + ?" + "" + "") diff --git a/appinventor/appengine/src/com/google/appinventor/client/actions/ShowShortcutsAction.java b/appinventor/appengine/src/com/google/appinventor/client/actions/ShowShortcutsAction.java index fbaa167b0e8..898239808d4 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/actions/ShowShortcutsAction.java +++ b/appinventor/appengine/src/com/google/appinventor/client/actions/ShowShortcutsAction.java @@ -9,6 +9,7 @@ import static com.google.appinventor.client.Ode.MESSAGES; import com.google.gwt.dom.client.NativeEvent; +import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.user.client.Command; import com.google.gwt.user.client.Event; import com.google.gwt.user.client.ui.DialogBox; @@ -49,7 +50,7 @@ public void onPreviewNativeEvent(Event.NativePreviewEvent event) { if (event.getTypeInt() == Event.ONKEYDOWN && nativeEvent.getAltKey() && nativeEvent.getKeyCode() == 191 && !db.isShowing()) { nativeEvent.preventDefault(); execute(); - } else if (event.getTypeInt() == Event.ONKEYDOWN) { + } else if (event.getTypeInt() == Event.ONKEYDOWN && db.isShowing()) { nativeEvent.preventDefault(); db.hide(); } From ce12f23dbdadad53f49931d246fddb55445464b6 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Mon, 26 Aug 2024 16:53:36 +0530 Subject: [PATCH 31/43] Component Moving --- .../appinventor/client/OdeMessages.java | 3 +- .../editor/youngandroid/YaFormEditor.java | 84 +++++++++++++++++++ 2 files changed, 86 insertions(+), 1 deletion(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java index 6ac3b4dd6c8..ad2fd40acf0 100755 --- a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java +++ b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java @@ -5132,7 +5132,8 @@ String newerVersionComponentException(String componentType, int srcCompVersion, "" + "" + "" + - "Focus component search box/" + + "Focus Component search box/" + + "Focus Components treeT" + "Switch between Designer and Block editorCtrl + Alt" + "Rename ComponentAlt + N" + "Reset ConnectionAlt + Shift + R" + diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/YaFormEditor.java b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/YaFormEditor.java index 78189f9a2e7..c3cfbda9ab9 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/YaFormEditor.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/YaFormEditor.java @@ -56,12 +56,17 @@ import com.google.gwt.core.client.JsArrayString; import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler.ScheduledCommand; +import com.google.gwt.event.dom.client.KeyCodes; +import com.google.gwt.event.dom.client.KeyDownEvent; +import com.google.gwt.event.dom.client.KeyDownHandler; import com.google.gwt.user.client.Command; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.DockPanel; +import com.google.gwt.user.client.ui.RootPanel; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -199,6 +204,7 @@ public DropTarget[] getDropTargets() { initWidget(componentsPanel); setSize("100%", "100%"); registerNativeListeners(); + registerKeyDownListeners(); } public boolean shouldDisplayHiddenComponents() { @@ -939,6 +945,84 @@ public void onResetDatabase() { } } + + private void registerKeyDownListeners () { + RootPanel.get().addDomHandler(new KeyDownHandler() { + @Override + public void onKeyDown(KeyDownEvent event) { + if (event.isAltKeyDown() && isActiveEditor()) { + List allComponents = new ArrayList<>(getComponents().values()); + MockComponent selectedComponent = form.getLastSelectedComponent(); + int index = form.getChildren().indexOf(selectedComponent); + + if (selectedComponent.isVisibleComponent()) { + switch (event.getNativeKeyCode()) { + case KeyCodes.KEY_DOWN: + if (index < 0) { + MockContainer container = selectedComponent.getContainer(); + List containerComponents = container.getChildren(); + int indexC = containerComponents.indexOf(selectedComponent); + int indexOfContainer = allComponents.indexOf(container); + selectedComponent.getContainer().removeComponent(selectedComponent, false); + + if (indexC == containerComponents.size() && container.getContainer().willAcceptComponentType(selectedComponent.getType())) { + container.getContainer().addVisibleComponent(selectedComponent, indexOfContainer); + } else { + container.addVisibleComponent(selectedComponent, indexC + 1); + } + } else { + index++; + form.removeComponent(selectedComponent, false); + MockComponent nextComponent = allComponents.get(index + 1); + int nextComponentindex = form.getChildren().indexOf(nextComponent); + if(nextComponent instanceof MockContainer && ((MockContainer) nextComponent).willAcceptComponentType(selectedComponent.getType())) { + ((MockContainer)nextComponent).addVisibleComponent(selectedComponent, 0); + } else if (nextComponentindex < 0 && ((MockContainer) nextComponent.getContainer()).willAcceptComponentType(selectedComponent.getType())) { + nextComponent.getContainer().addVisibleComponent(selectedComponent, 0); + } else { + form.addVisibleComponent(selectedComponent, index); + } + } + break; + + case KeyCodes.KEY_UP: + if (index < 0) { + MockContainer container = selectedComponent.getContainer(); + List containerComponents = container.getChildren(); + int indexC = containerComponents.indexOf(selectedComponent); + int indexOfContainer = allComponents.indexOf(container); + selectedComponent.getContainer().removeComponent(selectedComponent, false); + if (indexC == 0 && container.getContainer().willAcceptComponentType(selectedComponent.getType())) { + container.getContainer().addVisibleComponent(selectedComponent, indexOfContainer - 1); + } else { + container.addVisibleComponent(selectedComponent, indexC - 1); + } + } else { + index++; + form.removeComponent(selectedComponent, false); + MockComponent prevComponent = allComponents.get(index - 1); + int prevComponentIndex = form.getChildren().indexOf(prevComponent); + if(prevComponent instanceof MockContainer && ((MockContainer) prevComponent).willAcceptComponentType(selectedComponent.getType())) { + ((MockContainer)prevComponent).addVisibleComponent(selectedComponent, -1); + } else if (prevComponentIndex < 0 && ((MockContainer) prevComponent).willAcceptComponentType(selectedComponent.getType())) { + prevComponent.getContainer().addVisibleComponent(selectedComponent, -1); + } else { + form.addVisibleComponent(selectedComponent, index - 2); + } + } + break; + + default: + break; + } + } + } else if (event.getNativeKeyCode() == KeyCodes.KEY_T && !palettePanel.isTextboxFocused() && isActiveEditor()) { + SourceStructureBox.getSourceStructureBox().getSourceStructureExplorer().getTree().setFocus(true); + } + } + }, KeyDownEvent.getType()); + } + @SuppressWarnings("checkstyle:LineLength") private native void registerNativeListeners()/*-{ var editor = this; From 7ecfa20c215aed9ecd7768abea330f7a1a24f338 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Tue, 27 Aug 2024 00:00:04 +0530 Subject: [PATCH 32/43] tree highlighting upon click --- .../client/explorer/SourceStructureExplorer.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/SourceStructureExplorer.java b/appinventor/appengine/src/com/google/appinventor/client/explorer/SourceStructureExplorer.java index 618f8959dfe..aaffe74ea8b 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/SourceStructureExplorer.java +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/SourceStructureExplorer.java @@ -13,6 +13,8 @@ import com.google.gwt.event.dom.client.FocusHandler; import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.event.dom.client.KeyDownHandler; +import com.google.gwt.event.dom.client.MouseUpEvent; +import com.google.gwt.event.dom.client.MouseUpHandler; import com.google.gwt.event.dom.client.BlurEvent; import com.google.gwt.event.dom.client.BlurHandler; import com.google.gwt.event.dom.client.ClickEvent; @@ -109,7 +111,6 @@ public void onOpen(OpenEvent event) { tree.addSelectionHandler(new SelectionHandler() { @Override public void onSelection(SelectionEvent event) { - tree.setFocus(true); TreeItem treeItem = event.getSelectedItem(); if (treeItem != null) { Object userObject = treeItem.getUserObject(); @@ -153,6 +154,12 @@ public void onBlur(BlurEvent event) { tree.getParent().removeStyleName("gwt-Tree-focused"); } }); + tree.addMouseUpHandler(new MouseUpHandler() { + @Override + public void onMouseUp(MouseUpEvent event) { + tree.setFocus(true); + } + }); // Put a ScrollPanel around the tree. ScrollPanel scrollPanel = new ScrollPanel(tree); From ab4c3d419281b0cbd19857402fc79534efbc5e7d Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Wed, 28 Aug 2024 22:22:13 +0530 Subject: [PATCH 33/43] Shortcuts dialog for neo --- .../com/google/appinventor/client/style/neo/TopPanelNeo.ui.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/appinventor/appengine/src/com/google/appinventor/client/style/neo/TopPanelNeo.ui.xml b/appinventor/appengine/src/com/google/appinventor/client/style/neo/TopPanelNeo.ui.xml index 6292eba6f16..9ffe84a883e 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/style/neo/TopPanelNeo.ui.xml +++ b/appinventor/appengine/src/com/google/appinventor/client/style/neo/TopPanelNeo.ui.xml @@ -54,6 +54,9 @@ + + + From 1ea47755b7ec6dd095361991d332cdd7613efa0d Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Mon, 2 Sep 2024 01:17:25 +0530 Subject: [PATCH 34/43] Shortcuts to focus the Viewer and Properties, using V and P --- .../src/com/google/appinventor/client/OdeMessages.java | 2 ++ .../client/editor/simple/SimpleVisibleComponentsPanel.java | 6 ++++++ .../editor/simple/SimpleVisibleComponentsPanel.ui.xml | 2 +- .../client/editor/youngandroid/YaFormEditor.java | 4 ++++ .../client/style/neo/SimpleVisibleComponentsPanelNeo.java | 3 +++ .../client/style/neo/SimpleVisibleComponentsPanelNeo.ui.xml | 2 +- 6 files changed, 17 insertions(+), 2 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java index ad2fd40acf0..f0b5bb5cff9 100755 --- a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java +++ b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java @@ -5134,6 +5134,8 @@ String newerVersionComponentException(String componentType, int srcCompVersion, "" + "Focus Component search box/" + "Focus Components treeT" + + "Focus ViewerV" + + "Focus Properties PanelP" + "Switch between Designer and Block editorCtrl + Alt" + "Rename ComponentAlt + N" + "Reset ConnectionAlt + Shift + R" + diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/simple/SimpleVisibleComponentsPanel.java b/appinventor/appengine/src/com/google/appinventor/client/editor/simple/SimpleVisibleComponentsPanel.java index f7353ba1131..5498d24317d 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/simple/SimpleVisibleComponentsPanel.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/simple/SimpleVisibleComponentsPanel.java @@ -20,6 +20,7 @@ import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.client.ui.CheckBox; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; @@ -42,6 +43,7 @@ interface SimpleVisibleComponentsPanelUiBinder extends UiBinder - + diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/YaFormEditor.java b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/YaFormEditor.java index c3cfbda9ab9..ff4bde2dea5 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/YaFormEditor.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/YaFormEditor.java @@ -1018,6 +1018,10 @@ public void onKeyDown(KeyDownEvent event) { } } else if (event.getNativeKeyCode() == KeyCodes.KEY_T && !palettePanel.isTextboxFocused() && isActiveEditor()) { SourceStructureBox.getSourceStructureBox().getSourceStructureExplorer().getTree().setFocus(true); + } else if (event.getNativeKeyCode() == KeyCodes.KEY_V && !palettePanel.isTextboxFocused() && isActiveEditor()) { + getVisibleComponentsPanel().focusCheckbox(); + } else if (event.getNativeKeyCode() == KeyCodes.KEY_P && !palettePanel.isTextboxFocused() && isActiveEditor()) { + PropertiesBox.getPropertiesBox().getElement().getElementsByTagName("a").getItem(0).focus(); } } }, KeyDownEvent.getType()); diff --git a/appinventor/appengine/src/com/google/appinventor/client/style/neo/SimpleVisibleComponentsPanelNeo.java b/appinventor/appengine/src/com/google/appinventor/client/style/neo/SimpleVisibleComponentsPanelNeo.java index d986d519975..f1a7663ac2e 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/style/neo/SimpleVisibleComponentsPanelNeo.java +++ b/appinventor/appengine/src/com/google/appinventor/client/style/neo/SimpleVisibleComponentsPanelNeo.java @@ -13,6 +13,7 @@ import com.google.gwt.core.client.GWT; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.client.ui.CheckBox; import com.google.gwt.user.client.ui.ListBox; import com.google.gwt.user.client.ui.VerticalPanel; @@ -24,6 +25,7 @@ interface SimpleVisibleComponentsPanelUiBinderNeo extends UiBinder - + From 0244b78cceed3508fe7cc0b96657ddded59e8fc7 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Sun, 8 Sep 2024 21:25:57 +0530 Subject: [PATCH 35/43] fix: dropdown opens with no pre-selected item. --- .../client/widgets/ContextMenu.java | 4 +++ .../client/widgets/DropDownButton.java | 31 ++++++++----------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/widgets/ContextMenu.java b/appinventor/appengine/src/com/google/appinventor/client/widgets/ContextMenu.java index 32722365f3a..9621f9d9b89 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/widgets/ContextMenu.java +++ b/appinventor/appengine/src/com/google/appinventor/client/widgets/ContextMenu.java @@ -161,4 +161,8 @@ public void moveSelectionUp() { menuBar.moveSelectionUp(); } + public void resetSelection() { + menuBar.selectItem(null); + } + } diff --git a/appinventor/appengine/src/com/google/appinventor/client/widgets/DropDownButton.java b/appinventor/appengine/src/com/google/appinventor/client/widgets/DropDownButton.java index 19890c7927d..ba168779c75 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/widgets/DropDownButton.java +++ b/appinventor/appengine/src/com/google/appinventor/client/widgets/DropDownButton.java @@ -119,6 +119,7 @@ public void onClick(ClickEvent event) { if (menu.isShowing()) { menu.hide(); } else { + menu.resetSelection(); menu.setPopupPositionAndShow(new DropDownPositionCallback(getElement())); } } @@ -127,18 +128,14 @@ public void onClick(ClickEvent event) { addKeyDownHandler(new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { - if (event.getNativeKeyCode() == KeyCodes.KEY_DOWN) { - if (menu.isShowing()) { - event.preventDefault(); - menu.moveSelectionDown(); - menu.focus(); - } - } else if (event.getNativeKeyCode() == KeyCodes.KEY_UP) { - if (menu.isShowing()) { - event.preventDefault(); - menu.moveSelectionUp(); - menu.focus(); - } + if (event.getNativeKeyCode() == KeyCodes.KEY_DOWN && menu.isShowing()) { + event.preventDefault(); + menu.moveSelectionDown(); + menu.focus(); + } else if (event.getNativeKeyCode() == KeyCodes.KEY_UP && menu.isShowing()) { + event.preventDefault(); + menu.moveSelectionUp(); + menu.focus(); } } }); @@ -147,12 +144,10 @@ public void onKeyDown(KeyDownEvent event) { @Override public void onPreviewNativeEvent(Event.NativePreviewEvent event) { NativeEvent nativeEvent = event.getNativeEvent(); - if (event.getTypeInt() == Event.ONKEYDOWN && nativeEvent.getKeyCode() == KeyCodes.KEY_TAB) { - if (menu.isShowing()) { - nativeEvent.preventDefault(); - menu.hide(); - setFocus(true); - } + if (event.getTypeInt() == Event.ONKEYDOWN && nativeEvent.getKeyCode() == KeyCodes.KEY_TAB && menu.isShowing()) { + nativeEvent.preventDefault(); + menu.hide(); + setFocus(true); } } }); From 7e7cad30b99076cc62203b0d0b7eec1ec63561a6 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Sun, 8 Sep 2024 23:55:57 +0530 Subject: [PATCH 36/43] chore: remove unused code. --- .../editor/simple/components/MockVisibleComponent.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockVisibleComponent.java b/appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockVisibleComponent.java index e822b31d1d4..baffdfa5cc5 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockVisibleComponent.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockVisibleComponent.java @@ -10,7 +10,6 @@ import com.google.appinventor.client.ComponentsTranslation; import com.google.appinventor.client.editor.simple.SimpleEditor; -import com.google.appinventor.client.editor.simple.SimpleNonVisibleComponentsPanel; import com.google.appinventor.client.editor.youngandroid.properties.YoungAndroidLengthPropertyEditor; import com.google.appinventor.client.widgets.properties.TextPropertyEditor; import com.google.appinventor.components.common.ComponentConstants; @@ -159,8 +158,4 @@ public void onPropertyChange(String propertyName, String newValue) { refreshForm(); } } - - public SimpleNonVisibleComponentsPanel getNonVisibleComponentsPanel() { - return editor.getNonVisibleComponentsPanel(); - } -} +} \ No newline at end of file From 080be5de7bf9e1e84edaa61c594881d2004d85b6 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Mon, 9 Sep 2024 02:09:52 +0530 Subject: [PATCH 37/43] revert: remove unused code. --- .../editor/simple/components/MockVisibleComponent.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockVisibleComponent.java b/appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockVisibleComponent.java index baffdfa5cc5..48614ac6655 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockVisibleComponent.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockVisibleComponent.java @@ -10,6 +10,7 @@ import com.google.appinventor.client.ComponentsTranslation; import com.google.appinventor.client.editor.simple.SimpleEditor; +import com.google.appinventor.client.editor.simple.SimpleNonVisibleComponentsPanel; import com.google.appinventor.client.editor.youngandroid.properties.YoungAndroidLengthPropertyEditor; import com.google.appinventor.client.widgets.properties.TextPropertyEditor; import com.google.appinventor.components.common.ComponentConstants; @@ -158,4 +159,9 @@ public void onPropertyChange(String propertyName, String newValue) { refreshForm(); } } + + public SimpleNonVisibleComponentsPanel getNonVisibleComponentsPanel() { + return editor.getNonVisibleComponentsPanel(); + } + } \ No newline at end of file From 91df4ccdcec7de0f4cfefc16c787eab03ea71f7b Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Mon, 16 Dec 2024 01:53:33 +0530 Subject: [PATCH 38/43] OK button addded to shortcuts dialog and fixed shortcut for diff keyboard layouts --- .../client/actions/ShowShortcutsAction.java | 42 +++++++++++-------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/actions/ShowShortcutsAction.java b/appinventor/appengine/src/com/google/appinventor/client/actions/ShowShortcutsAction.java index 898239808d4..752c3e880d1 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/actions/ShowShortcutsAction.java +++ b/appinventor/appengine/src/com/google/appinventor/client/actions/ShowShortcutsAction.java @@ -8,10 +8,8 @@ import static com.google.appinventor.client.Ode.MESSAGES; -import com.google.gwt.dom.client.NativeEvent; -import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.user.client.Command; -import com.google.gwt.user.client.Event; +import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.DialogBox; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.VerticalPanel; @@ -29,32 +27,42 @@ public ShowShortcutsAction() { db.setGlassEnabled(true); db.setAnimationEnabled(true); - shortcutKeyHandler(); + shortcutKeyHandler(this); } @Override public void execute() { VerticalPanel DialogBoxContents = new VerticalPanel(); HTML message = new HTML(MESSAGES.KeyBoardShortcuts()); + Button button = new Button("OK"); + button.addClickHandler(event -> db.hide()); DialogBoxContents.add(message); + DialogBoxContents.add(button); db.setWidget(DialogBoxContents); db.center(); db.show(); } - private void shortcutKeyHandler() { - Event.addNativePreviewHandler(new Event.NativePreviewHandler() { - @Override - public void onPreviewNativeEvent(Event.NativePreviewEvent event) { - NativeEvent nativeEvent = event.getNativeEvent(); - if (event.getTypeInt() == Event.ONKEYDOWN && nativeEvent.getAltKey() && nativeEvent.getKeyCode() == 191 && !db.isShowing()) { - nativeEvent.preventDefault(); - execute(); - } else if (event.getTypeInt() == Event.ONKEYDOWN && db.isShowing()) { - nativeEvent.preventDefault(); - db.hide(); + private native void shortcutKeyHandler(ShowShortcutsAction action) /*-{ + $wnd.document.addEventListener("keydown", function (event) { + if (event.altKey && event.key === "?") { + event.preventDefault(); + action.@com.google.appinventor.client.actions.ShowShortcutsAction::onShortcutTriggered()(); + } else if (event.key === "Escape"){ + action.@com.google.appinventor.client.actions.ShowShortcutsAction::escPressed()(); } - } }); + }-*/; + + private void shortcutPressed() { + if (!db.isShowing()) { + execute(); + } + } + + private void escPressed() { + if (db.isShowing()) { + db.hide(); + } } -} +} \ No newline at end of file From b46f841ee52f01dd3acf9db7c8042d6cff745f12 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Mon, 16 Dec 2024 04:05:06 +0530 Subject: [PATCH 39/43] variable colors --- .../appinventor/client/explorer/folder/ProjectFolder.java | 4 ++-- .../src/com/google/appinventor/client/variableColors.css | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.java b/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.java index e98bbd2f7e4..08cda851d62 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.java +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/folder/ProjectFolder.java @@ -167,9 +167,9 @@ private void toggleState() { public void setSelected(boolean selected) { checkBox.setValue(selected); if (selected) { - container.addStyleName("ode-ProjectRow-Highlighted"); + container.addStyleName("ode-ProjectRowHighlighted"); } else { - container.removeStyleName("ode-ProjectRow-Highlighted"); + container.removeStyleName("ode-ProjectRowHighlighted"); } } diff --git a/appinventor/appengine/src/com/google/appinventor/client/variableColors.css b/appinventor/appengine/src/com/google/appinventor/client/variableColors.css index d60b75be763..f85ca716e42 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/variableColors.css +++ b/appinventor/appengine/src/com/google/appinventor/client/variableColors.css @@ -302,6 +302,10 @@ body { background-color: bar-color; } +.gwt-Tree-focused { + outline: solid 2px border-color; +} + /* Young Android Toolbar */ .ya-Toolbar { @@ -837,7 +841,7 @@ select:focus, input[type="file"]:focus, input[type="radio"]:focus, input[type="checkbox"]:focus { - outline: thin dotted panel-shadow; + outline: 2px solid panel-shadow; } From 87d768bd02fd0f3aa7d2a32050fcbd8f5164a52a Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Tue, 17 Dec 2024 01:34:34 +0530 Subject: [PATCH 40/43] fix: shortcut --- .../google/appinventor/client/actions/ShowShortcutsAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/actions/ShowShortcutsAction.java b/appinventor/appengine/src/com/google/appinventor/client/actions/ShowShortcutsAction.java index 752c3e880d1..3844c770778 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/actions/ShowShortcutsAction.java +++ b/appinventor/appengine/src/com/google/appinventor/client/actions/ShowShortcutsAction.java @@ -47,7 +47,7 @@ private native void shortcutKeyHandler(ShowShortcutsAction action) /*-{ $wnd.document.addEventListener("keydown", function (event) { if (event.altKey && event.key === "?") { event.preventDefault(); - action.@com.google.appinventor.client.actions.ShowShortcutsAction::onShortcutTriggered()(); + action.@com.google.appinventor.client.actions.ShowShortcutsAction::shortcutPressed()(); } else if (event.key === "Escape"){ action.@com.google.appinventor.client.actions.ShowShortcutsAction::escPressed()(); } From 4547532b34c3f99dca1a5de09b894dcebb81eca9 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Sat, 28 Dec 2024 00:41:09 +0530 Subject: [PATCH 41/43] fix: Shortcuts --- .../src/com/google/appinventor/client/OdeMessages.java | 4 +++- .../appinventor/client/actions/ShowShortcutsAction.java | 4 +++- .../appinventor/client/editor/youngandroid/YaFormEditor.java | 3 +++ .../appinventor/client/explorer/SourceStructureExplorer.java | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java index f0b5bb5cff9..9077e52cdad 100755 --- a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java +++ b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java @@ -5136,8 +5136,10 @@ String newerVersionComponentException(String componentType, int srcCompVersion, "Focus Components treeT" + "Focus ViewerV" + "Focus Properties PanelP" + + "Focus Media PanelM" + "Switch between Designer and Block editorCtrl + Alt" + "Rename ComponentAlt + N" + + "Delete ComponentDelete/Backspace" + "Reset ConnectionAlt + Shift + R" + "Refresh Companion ScreenAlt + R" + "Open/Close BackpackAlt + B" + @@ -5149,7 +5151,7 @@ String newerVersionComponentException(String componentType, int srcCompVersion, "Zoom inAlt + +" + "Zoom outAlt + -" + "Re-centerAlt + G" + - "Navigate Components↑/↓" + + "Navigate Components in components tree↑/↓" + "Open this dialogAlt + ?" + "" + "") diff --git a/appinventor/appengine/src/com/google/appinventor/client/actions/ShowShortcutsAction.java b/appinventor/appengine/src/com/google/appinventor/client/actions/ShowShortcutsAction.java index 3844c770778..7336e17528e 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/actions/ShowShortcutsAction.java +++ b/appinventor/appengine/src/com/google/appinventor/client/actions/ShowShortcutsAction.java @@ -8,6 +8,7 @@ import static com.google.appinventor.client.Ode.MESSAGES; +import com.google.appinventor.client.Ode; import com.google.gwt.user.client.Command; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.DialogBox; @@ -34,13 +35,14 @@ public ShowShortcutsAction() { public void execute() { VerticalPanel DialogBoxContents = new VerticalPanel(); HTML message = new HTML(MESSAGES.KeyBoardShortcuts()); - Button button = new Button("OK"); + Button button = new Button(Ode.MESSAGES.okButton()); button.addClickHandler(event -> db.hide()); DialogBoxContents.add(message); DialogBoxContents.add(button); db.setWidget(DialogBoxContents); db.center(); db.show(); + button.setFocus(true); } private native void shortcutKeyHandler(ShowShortcutsAction action) /*-{ diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/YaFormEditor.java b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/YaFormEditor.java index ff4bde2dea5..af45ecc9bc2 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/YaFormEditor.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/YaFormEditor.java @@ -15,6 +15,7 @@ import com.google.appinventor.client.boxes.PaletteBox; import com.google.appinventor.client.boxes.PropertiesBox; import com.google.appinventor.client.boxes.SourceStructureBox; +import com.google.appinventor.client.boxes.AssetListBox; import com.google.appinventor.client.editor.ProjectEditor; import com.google.appinventor.client.editor.simple.ComponentNotFoundException; import com.google.appinventor.client.editor.simple.SimpleComponentDatabase; @@ -1022,6 +1023,8 @@ public void onKeyDown(KeyDownEvent event) { getVisibleComponentsPanel().focusCheckbox(); } else if (event.getNativeKeyCode() == KeyCodes.KEY_P && !palettePanel.isTextboxFocused() && isActiveEditor()) { PropertiesBox.getPropertiesBox().getElement().getElementsByTagName("a").getItem(0).focus(); + } else if (event.getNativeKeyCode() == KeyCodes.KEY_M && !palettePanel.isTextboxFocused() && isActiveEditor()) { + AssetListBox.getAssetListBox().getAssetList().getTree().setFocus(true); } } }, KeyDownEvent.getType()); diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/SourceStructureExplorer.java b/appinventor/appengine/src/com/google/appinventor/client/explorer/SourceStructureExplorer.java index aaffe74ea8b..d8af9509858 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/SourceStructureExplorer.java +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/SourceStructureExplorer.java @@ -110,7 +110,7 @@ public void onOpen(OpenEvent event) { }); tree.addSelectionHandler(new SelectionHandler() { @Override - public void onSelection(SelectionEvent event) { + public void onSelection(SelectionEvent event) { TreeItem treeItem = event.getSelectedItem(); if (treeItem != null) { Object userObject = treeItem.getUserObject(); From 2a917bbcf3241396ec91b65b87f07af4326dc766 Mon Sep 17 00:00:00 2001 From: Venkata Sai Date: Sat, 28 Dec 2024 00:41:46 +0530 Subject: [PATCH 42/43] fix: dialogs --- .../com/google/appinventor/client/Ode.java | 11 ++++++++- .../simple/components/MockComponent.java | 23 ++++++++++--------- .../explorer/youngandroid/AssetList.java | 22 ++++++++++++++++++ 3 files changed, 44 insertions(+), 12 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/Ode.java b/appinventor/appengine/src/com/google/appinventor/client/Ode.java index 63975143d07..7b61325a185 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/Ode.java +++ b/appinventor/appengine/src/com/google/appinventor/client/Ode.java @@ -1652,7 +1652,7 @@ private void createWelcomeDialog(final boolean force) { return; } // Create the UI elements of the DialogBox - final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal) + final DialogBox dialogBox = new DialogBox(false, false); // DialogBox(autohide, modal) dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setText(MESSAGES.createWelcomeDialogText()); dialogBox.setHeight(splashConfig.height + "px"); @@ -1683,7 +1683,16 @@ public void onClick(Widget sender) { DialogBoxContents.add(message); DialogBoxContents.add(holder); dialogBox.setWidget(DialogBoxContents); + ok.setFocus(true); dialogBox.show(); + + Event.addNativePreviewHandler(new Event.NativePreviewHandler() { + public void onPreviewNativeEvent(NativePreviewEvent event) { + if (event.getTypeInt() == Event.ONKEYDOWN && event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE && dialogBox.isShowing()) { + dialogBox.hide(); + } + } + }); } /** diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockComponent.java b/appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockComponent.java index 3f81102eebf..35e909d9ab1 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockComponent.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockComponent.java @@ -12,6 +12,7 @@ import com.google.appinventor.client.ComponentsTranslation; import com.google.appinventor.client.Images; import com.google.appinventor.client.Ode; +import com.google.appinventor.client.boxes.SourceStructureBox; import com.google.appinventor.client.editor.simple.SimpleEditor; import com.google.appinventor.client.editor.simple.components.utils.PropertiesUtil; import com.google.appinventor.client.editor.youngandroid.YaBlocksEditor; @@ -249,8 +250,9 @@ public void execute() { * This class defines the dialog box for deleting a component. */ private class DeleteDialog extends DialogBox { + private final Button deleteButton; DeleteDialog() { - super(false, true); + super(false, false); setStylePrimaryName("ode-DialogBox"); setText(MESSAGES.deleteComponentButton()); @@ -264,13 +266,14 @@ public void onClick(ClickEvent event) { hide(); } }); - Button deleteButton = new Button(MESSAGES.deleteButton()); + deleteButton = new Button(MESSAGES.deleteButton()); deleteButton.addStyleName("destructive-action"); deleteButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { hide(); MockComponent.this.delete(); + SourceStructureBox.getSourceStructureBox().getSourceStructureExplorer().getTree().setFocus(true); } }); HorizontalPanel buttonPanel = new HorizontalPanel(); @@ -285,17 +288,15 @@ public void onClick(ClickEvent event) { @Override protected void onPreviewNativeEvent(NativePreviewEvent event) { super.onPreviewNativeEvent(event); - switch (event.getTypeInt()) { - case Event.ONKEYDOWN: - if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE) { - hide(); - } else if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) { - hide(); - MockComponent.this.delete(); - } - break; + if (event.getTypeInt() == Event.ONKEYDOWN && event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE) { + hide(); } } + + public void center() { + super.center(); + deleteButton.setFocus(true); + } } // Component database: information about components (including their properties and events) diff --git a/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/AssetList.java b/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/AssetList.java index a46a24f2aef..cc9d49eaa77 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/AssetList.java +++ b/appinventor/appengine/src/com/google/appinventor/client/explorer/youngandroid/AssetList.java @@ -24,6 +24,12 @@ 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.dom.client.BlurEvent; +import com.google.gwt.event.dom.client.BlurHandler; +import com.google.gwt.event.dom.client.FocusEvent; +import com.google.gwt.event.dom.client.FocusHandler; +import com.google.gwt.event.dom.client.KeyCodes; +import com.google.gwt.event.dom.client.KeyDownHandler; import com.google.gwt.event.logical.shared.SelectionEvent; import com.google.gwt.event.logical.shared.SelectionHandler; import com.google.gwt.user.client.Event; @@ -105,6 +111,18 @@ public void onSelection(SelectionEvent event) { // type in CommandRegistry.java ProjectNodeContextMenu.show(node, selected.getWidget(), clientX, clientY); }}); + assetList.addFocusHandler(new FocusHandler() { + @Override + public void onFocus(FocusEvent event) { + assetList.addStyleName("gwt-Tree-focused"); + } + }); + assetList.addBlurHandler(new BlurHandler() { + @Override + public void onBlur(BlurEvent event) { + assetList.removeStyleName("gwt-Tree-focused"); + } + }); } /* @@ -188,4 +206,8 @@ public void onProjectNodeRemoved(Project project, ProjectNode node) { refreshAssetList(); } } + + public Tree getTree() { + return assetList; + } } From ad8540c24505b6afd6fd6f96a4058bcc09e57d34 Mon Sep 17 00:00:00 2001 From: SusanRatiLane Date: Wed, 8 Jan 2025 13:52:08 -0500 Subject: [PATCH 43/43] Remove shortcuts for blocks editor --- .../appinventor/client/OdeMessages.java | 9 --- appinventor/blocklyeditor/src/backpack.js | 3 - .../blocklyeditor/src/blocklyeditor.js | 63 ------------------- .../src/msg/ai_blockly/messages.json | 12 ++-- 4 files changed, 6 insertions(+), 81 deletions(-) diff --git a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java index 9077e52cdad..55d3f130e82 100755 --- a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java +++ b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java @@ -5142,15 +5142,6 @@ String newerVersionComponentException(String componentType, int srcCompVersion, "Delete ComponentDelete/Backspace" + "Reset ConnectionAlt + Shift + R" + "Refresh Companion ScreenAlt + R" + - "Open/Close BackpackAlt + B" + - "Switch between Inline and External InputsAlt + I" + - "Add comment to a blockAlt + K" + - "Expand/Collapse blockAlt + O" + - "Navigate up the blocksAlt + S" + - "Navigate down the blocksAlt + W" + - "Zoom inAlt + +" + - "Zoom outAlt + -" + - "Re-centerAlt + G" + "Navigate Components in components tree↑/↓" + "Open this dialogAlt + ?" + "" + diff --git a/appinventor/blocklyeditor/src/backpack.js b/appinventor/blocklyeditor/src/backpack.js index f96b804d00e..938f9229a80 100644 --- a/appinventor/blocklyeditor/src/backpack.js +++ b/appinventor/blocklyeditor/src/backpack.js @@ -209,9 +209,6 @@ Blockly.Backpack.prototype.createDom = function(opt_workspace) { this.svgBody_.setAttribute('class', 'blocklybackpackImage'); - this.svgTooltip_ = Blockly.utils.createSvgElement('title', null , this.svgBody_); - this.svgTooltip_.textContent = 'Alt + B to Open/Close'; - return this.svgGroup_; }; diff --git a/appinventor/blocklyeditor/src/blocklyeditor.js b/appinventor/blocklyeditor/src/blocklyeditor.js index 289870df0b3..71ebce09301 100644 --- a/appinventor/blocklyeditor/src/blocklyeditor.js +++ b/appinventor/blocklyeditor/src/blocklyeditor.js @@ -589,26 +589,6 @@ Blockly.ai_inject = function(container, workspace) { return workspace; }; -function isBlockEditorActive(e) { - var target = null; - - if (e.target.tagName.toLowerCase() == 'div' && e.target.className == 'injectionDiv') { - target = e.target; - } else { - var parent = e.target; - while (parent.parentNode && !(parent.tagName.toLowerCase() == 'div' && parent.className == 'injectionDiv')) { - parent = parent.parentNode; - } - target = parent; - } - - if (Blockly.mainWorkspace.getParentSvg().parentNode == target) { - return true; - } - - return false; -} - // Preserve Blockly during Closure and GWT optimizations window['Blockly'] = Blockly; top['Blockly'] = Blockly; @@ -635,46 +615,3 @@ top.document.addEventListener('mousedown', function(e) { Blockly.hideChaff(); } }, false); - -top.document.addEventListener('keydown', function(e) { - var selectedBlock = Blockly.selected; - var allBlocks = Blockly.mainWorkspace.getAllBlocks(); - - if (e.altKey) { - e.preventDefault(); - if (e.key.toLowerCase() === 'o') { - selectedBlock.setCollapsed(!selectedBlock.isCollapsed()); - } else if (e.key.toLowerCase() === 'i') { - selectedBlock.setInputsInline(!selectedBlock.getInputsInline()); - } else if (e.key.toLowerCase() === 'w') { - if (allBlocks.length > 0) { - i = (i + 1) % allBlocks.length; - allBlocks[i].select(); - } - } else if (e.key.toLowerCase() === 's') { - if (allBlocks.length > 0) { - i = (i - 1 + allBlocks.length) % allBlocks.length; - allBlocks[i].select(); - } - } else if (e.key.toLowerCase() === 'k') { - if (!selectedBlock.isCollapsed()) { - if (selectedBlock.comment && selectedBlock.comment.isVisible()) { - selectedBlock.comment.setVisible(false); - } else { - selectedBlock.setCommentText(''); - selectedBlock.comment.setVisible(true); - } - } - } else if (e.key === '+') { - Blockly.getMainWorkspace().zoomCenter(1); - } else if (e.key === '-') { - Blockly.getMainWorkspace().zoomCenter(-1); - } else if (e.key.toLowerCase() === 'g') { - var mainWorkspace = Blockly.getMainWorkspace(); - mainWorkspace.setScale(mainWorkspace.options.zoomOptions.startScale); - mainWorkspace.scrollCenter(); - } else if (e.key.toLowerCase() === 'b' && isBlockEditorActive(e)) { - Blockly.getMainWorkspace().getBackpack().openBackpack(e); - } - } -}, false); \ No newline at end of file diff --git a/appinventor/blocklyeditor/src/msg/ai_blockly/messages.json b/appinventor/blocklyeditor/src/msg/ai_blockly/messages.json index 06ae6360665..659900ce539 100644 --- a/appinventor/blocklyeditor/src/msg/ai_blockly/messages.json +++ b/appinventor/blocklyeditor/src/msg/ai_blockly/messages.json @@ -11,10 +11,10 @@ "Blockly.Msg.HIDE": "Hide Workspace Controls", "Blockly.Msg.SHOW": "Show Workspace Controls", "Blockly.Msg.DUPLICATE_BLOCK": "Duplicate", - "Blockly.Msg.REMOVE_COMMENT": "Remove Comment (Alt + K)", - "Blockly.Msg.ADD_COMMENT": "Add Comment (Alt + K)", - "Blockly.Msg.EXTERNAL_INPUTS": "External Inputs (Alt + I)", - "Blockly.Msg.INLINE_INPUTS": "Inline Inputs (Alt + I)", + "Blockly.Msg.REMOVE_COMMENT": "Remove Comment", + "Blockly.Msg.ADD_COMMENT": "Add Comment", + "Blockly.Msg.EXTERNAL_INPUTS": "External Inputs", + "Blockly.Msg.INLINE_INPUTS": "Inline Inputs", "Blockly.Msg.HORIZONTAL_PARAMETERS": "Arrange Parameters Horizontally", "Blockly.Msg.VERTICAL_PARAMETERS": "Arrange Parameters Vertically", "Blockly.Msg.CONFIRM_DELETE": "Confirm deletion", @@ -22,8 +22,8 @@ "Blockly.Msg.DELETE_BLOCK": "Delete Block", "Blockly.Msg.DELETE_X_BLOCKS": "Delete %1 Blocks", "Blockly.Msg.COLLAPSE_BLOCK": "Collapse Block", - "Blockly.Msg.EXPAND_BLOCK": "Expand Block (Alt + O)", - "Blockly.Msg.DISABLE_BLOCK": "Disable Block (Alt + O)", + "Blockly.Msg.EXPAND_BLOCK": "Expand Block", + "Blockly.Msg.DISABLE_BLOCK": "Disable Block", "Blockly.Msg.ENABLE_BLOCK": "Enable Block", "Blockly.Msg.HELP": "Help", "Blockly.Msg.EXPORT_IMAGE": "Download Blocks as Image",