<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: divyanshu_Kumar</title>
    <description>The latest articles on DEV Community by divyanshu_Kumar (@d1vyanshukumar).</description>
    <link>https://dev.to/d1vyanshukumar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1362930%2F77a03698-994a-49c3-b4f5-b09de881c363.jpeg</url>
      <title>DEV Community: divyanshu_Kumar</title>
      <link>https://dev.to/d1vyanshukumar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/d1vyanshukumar"/>
    <language>en</language>
    <item>
      <title>GSoC Progress (Weeks 1–4) at MIT App Inventor — Building a Responsive GWT Interface</title>
      <dc:creator>divyanshu_Kumar</dc:creator>
      <pubDate>Sun, 29 Jun 2025 19:04:56 +0000</pubDate>
      <link>https://dev.to/d1vyanshukumar/gsoc-progress-weeks-1-4-at-mit-app-inventor-building-a-responsive-gwt-interface-2fa4</link>
      <guid>https://dev.to/d1vyanshukumar/gsoc-progress-weeks-1-4-at-mit-app-inventor-building-a-responsive-gwt-interface-2fa4</guid>
      <description>&lt;p&gt;So far, GSoC has been an incredibly rewarding journey. Building mobile‑friendly UIs with GWT UiBinder and Java has pushed me to solve real‑world challenges—and every obstacle has taught me something new. In this post, I’ll share my progress through Week 4 and the key lessons I’ve learned along the way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Week 1: Planning &amp;amp; Mentor Review
&lt;/h2&gt;

&lt;p&gt;During the first week, I dove into the existing codebase to understand its structure and began envisioning how the mobile UI components would connect. I sketched out my implementation plan and discussed it in detail with my mentor, outlining the key integration points and data flows. Although this period coincided with my semester exams (so I couldn’t code as much as I’d hoped), I came away with a clear roadmap for building and wiring up the mobile interface.&lt;/p&gt;

&lt;h2&gt;
  
  
  Week 2: Building a Standalone Mobile UI with GWT &amp;amp; UiBinder
&lt;/h2&gt;

&lt;p&gt;This week, I began building a standalone mobile UI module from the ground up instead of retrofitting the existing desktop code with media queries—an approach that often leads to cluttered styles and unintended breakages. By leveraging GWT and UiBinder (the same stack behind MIT App Inventor), we write type‑safe Java that compiles to optimised JavaScript, enjoy robust IDE support and compile‑time checks, and define our layouts declaratively in XML for a clean separation of structure and behaviour. This lets us reuse the desktop’s core business logic without touching its styles, avoid the cross‑browser quirks common in pure JavaScript frameworks, and benefit from GWT‑RPC’s efficient client–server communication and strong unit‑testing tools. In doing so, we achieve a maintainable, scalable codebase with clear separation of concerns—desktop versus mobile—and a mentor‑approved foundation for a robust mobile interface.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenges
&lt;/h2&gt;

&lt;p&gt;Breakpoint-Driven Desktop‑to‑Mobile Interface Swap&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In our GWT app, we define a numeric breakpoint—say, &lt;strong&gt;768px&lt;/strong&gt;—that separates desktop from mobile. On initial load, we call&lt;/p&gt;


&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Window&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getClientWidth&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;to read the current viewport width. If &lt;code&gt;width &amp;lt; BREAKPOINT&lt;/code&gt;, we inject our &lt;strong&gt;mobile CSS bundle&lt;/strong&gt; (for example, &lt;code&gt;mobileStyles.ensureInjected()&lt;/code&gt;), which swaps in touch‑friendly layouts and hides desktop‑only elements. Otherwise, we keep the default desktop styles.&lt;/p&gt;

&lt;p&gt;To handle user‑driven resizes—when someone drags the browser window or rotates their device—we register a resize handler:&lt;/p&gt;


&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Window&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;addResizeHandler&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;newWidth&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getWidth&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;newWidth&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;BREAKPOINT&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;mobileStyles&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;ensureInjected&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;desktopStyles&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;ensureInjected&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;This listener means we don’t just detect the breakpoint once; we continuously watch for the window crossing that threshold, dynamically swapping style bundles as needed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why this matters:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;getClientWidth()&lt;/code&gt;&lt;/strong&gt; gives a one‑time measurement on load, ensuring your UI starts in the right mode.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;addResizeHandler()&lt;/code&gt;&lt;/strong&gt; lets you react to changes—critical for desktop users who resize or tablets that rotate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CSS bundles&lt;/strong&gt; in GWT let you package and inject only the rules you need (mobile vs. desktop), keeping your CSS lean and avoiding messy overrides in a single stylesheet.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Together, these APIs provide a type‑safe, maintainable way to implement true adaptive behaviour—rather than bolting on media queries to an existing stylesheet, you cleanly separate and inject the appropriate styles at runtime.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Week 3: Begin TopToolbar and TopPanel Development Following Successful Mobile Interface Binding
&lt;/h2&gt;

&lt;p&gt;This week, I began developing the TopPanel—specifically the TopToolbar—after successfully binding our mobile interface. Inheriting all of the desktop styles initially prevented any toolbar changes from appearing on mobile; instead, the app continued to render the parent‑class TopPanel.&lt;/p&gt;

&lt;p&gt;During troubleshooting, my mentor, Susan, guided me to a second culprit in the build menu configuration: if the &lt;code&gt;buildDropDown&lt;/code&gt; items aren’t explicitly defined, the template silently falls back to the Classic layout. To work around this, she suggested mirroring those menu entries in the mobile menu (and simply hiding the original build menu) so the template can load correctly.&lt;/p&gt;

&lt;p&gt;Digging deeper, we found the underlying XML parsers enforce a strict mapping between custom tags and Java classes. These parsers handle our drop‑down buttons without extra Java or CSS, but they’re not very feature‑rich—labels aren’t even supported yet. Although we could refine them later, ensuring every inherited component tag appears in UiBinder was enough to restore the mobile styling for now.&lt;/p&gt;

&lt;p&gt;Although the popup‑based approach I initially built might still work, Susan and I opted for a single menu built on our existing framework to guarantee stability. Solving these nested inheritance and parser quirks taught me a valuable lesson about GWT’s markup requirements and reinforced the importance of aligning UiBinder XML with component hierarchies. Despite the week’s frustrations, Week 3 turned into a highly educational deep dive into GWT’s theming and templating mechanics.&lt;/p&gt;

&lt;h2&gt;
  
  
  Week 4: Implementing Hamburger Menu &amp;amp; PopupPanel via DisclosurePanel
&lt;/h2&gt;

&lt;p&gt;This week’s focus was on replacing our dropdown build menu with a responsive hamburger menu. When tapped, it now opens a PopupPanel containing the full menu and submenus, structured with GWT’s &lt;code&gt;DisclosurePanel&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;DisclosurePanel&lt;/code&gt; provides a collapsible header and content area that expands when clicked—perfect for nested submenus. Within our mobile UI, each header acts as a section title (e.g., Build, Settings), and the content panel holds related submenu items.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why I chose DisclosurePanel + PopupPanel:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;PopupPanel&lt;/code&gt; overlays the rest of the UI and supports auto-hide behaviour and backdrop glass.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;DisclosurePanel&lt;/code&gt; nested inside the popup lets users expand and collapse sub-categories smoothly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Implementation summary:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tapping the hamburger icon opens a vertical menu panel within a &lt;code&gt;PopupPanel&lt;/code&gt;, positioned just next to the icon.&lt;/li&gt;
&lt;li&gt;Inside the &lt;code&gt;PopupPanel&lt;/code&gt;’s UiBinder template, each menu section is wrapped in a &lt;code&gt;&amp;lt;g:DisclosurePanel&amp;gt;&lt;/code&gt;, allowing GWT to link these sections to corresponding Java event handlers.&lt;/li&gt;
&lt;li&gt;Here’s an example of the UiBinder markup:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;ai:DropDownButton&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"Settings"&lt;/span&gt;
                   &lt;span class="na"&gt;styleName=&lt;/span&gt;&lt;span class="s"&gt;"ode-TopPanelButton"&lt;/span&gt;
                   &lt;span class="na"&gt;ui:field=&lt;/span&gt;&lt;span class="s"&gt;"settingsDropDown"&lt;/span&gt;
                   &lt;span class="na"&gt;align=&lt;/span&gt;&lt;span class="s"&gt;"left"&lt;/span&gt;
                   &lt;span class="na"&gt;icon=&lt;/span&gt;&lt;span class="s"&gt;"menu"&lt;/span&gt;
                   &lt;span class="na"&gt;caption=&lt;/span&gt;&lt;span class="s"&gt;"{messages.menuButton}"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/ai:DropDownButton&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;g:VerticalPanel&lt;/span&gt; &lt;span class="na"&gt;ui:field=&lt;/span&gt;&lt;span class="s"&gt;"menuContent"&lt;/span&gt; &lt;span class="na"&gt;visible=&lt;/span&gt;&lt;span class="s"&gt;"false"&lt;/span&gt; &lt;span class="na"&gt;spacing=&lt;/span&gt;&lt;span class="s"&gt;"10"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="c"&gt;&amp;lt;!-- Projects Section --&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;g:DisclosurePanel&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;g:header&lt;/span&gt; &lt;span class="na"&gt;styleName=&lt;/span&gt;&lt;span class="s"&gt;"mobile-SectionHeader"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Projects&lt;span class="nt"&gt;&amp;lt;/g:header&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;g:VerticalPanel&lt;/span&gt; &lt;span class="na"&gt;styleName=&lt;/span&gt;&lt;span class="s"&gt;"mobile-SectionPanel"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;g:Button&lt;/span&gt; &lt;span class="na"&gt;ui:field=&lt;/span&gt;&lt;span class="s"&gt;"myProjectsButton"&lt;/span&gt;
                &lt;span class="na"&gt;text=&lt;/span&gt;&lt;span class="s"&gt;"{messages.projectMenuItem}"&lt;/span&gt;
                &lt;span class="na"&gt;visible=&lt;/span&gt;&lt;span class="s"&gt;"false"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;g:Button&lt;/span&gt; &lt;span class="na"&gt;ui:field=&lt;/span&gt;&lt;span class="s"&gt;"newButton"&lt;/span&gt;
                &lt;span class="na"&gt;text=&lt;/span&gt;&lt;span class="s"&gt;"{messages.newProjectMenuItem}"&lt;/span&gt;
                &lt;span class="na"&gt;visible=&lt;/span&gt;&lt;span class="s"&gt;"{hasWriteAccess}"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;g:Button&lt;/span&gt; &lt;span class="na"&gt;ui:field=&lt;/span&gt;&lt;span class="s"&gt;"importProjectButton"&lt;/span&gt;
                &lt;span class="na"&gt;text=&lt;/span&gt;&lt;span class="s"&gt;"{messages.importProjectMenuItem}"&lt;/span&gt;
                &lt;span class="na"&gt;visible=&lt;/span&gt;&lt;span class="s"&gt;"false"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;

 &lt;span class="c"&gt;&amp;lt;!-- Other subMenu Items here --&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;/g:VerticalPanel&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/g:DisclosurePanel&amp;gt;&lt;/span&gt;

  &lt;span class="c"&gt;&amp;lt;!-- Additional sections here --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/g:VerticalPanel&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;settingsDropDown.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        LOG.warning("Hamburger menu clicked");
        menuPopup.setWidget(menuContent);
        menuPopup.center();
        menuContent.setVisible(true);
      }
    });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;strong&gt;What changed and why it works:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clarified that the vertical menu is shown inside a &lt;code&gt;PopupPanel&lt;/code&gt; when the hamburger is tapped.&lt;/li&gt;
&lt;li&gt;Specified that each section uses &lt;code&gt;DisclosurePanel&lt;/code&gt; to enable collapsible behavior and backend event handling.&lt;/li&gt;
&lt;li&gt;Improved markup readability by aligning attributes and showing how GWT binds UI to Java logic.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Resources I relied on this week:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/ui/DisclosurePanel.html" rel="noopener noreferrer"&gt;GWT Javadoc for &lt;code&gt;DisclosurePanel&lt;/code&gt; usage, constructor options, and CSS styling&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Week 4 delivered not just a functional hamburger menu, but also strengthened my understanding of GWT’s composable widgets. It’s been a gratifying step toward a more intuitive mobile experience.&lt;/p&gt;

&lt;p&gt;Here is my Pr Link:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/mit-cml/appinventor-sources/pull/3491" rel="noopener noreferrer"&gt;https://github.com/mit-cml/appinventor-sources/pull/3491&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Thank you for reading to the end!&lt;/strong&gt; I hope you found this post insightful and full of useful takeaways. I’ll be back soon with Week 5’s update—so stay tuned. Until then, keep coding and keep exploring!&lt;/p&gt;

</description>
      <category>java</category>
      <category>gwt</category>
      <category>opensource</category>
      <category>gsoc</category>
    </item>
  </channel>
</rss>
