Is it possible to detect a scrollbar release event in GWT? - gwt

I'm building a GWT app where I want to be able to detect when a user releases a scroll bar on one of my ScrollPanels.
My use case is that the horizontal scroll bar represents time. Since it's impossible to represent the full range of scrollable time I want to just represent a small window of time with the scroll bar. When the user moves and releases the scroll bar I want to do a smooth recentering where the new center is the release point.
I can work out how to do this by building a custom scroll bar widget, but I wanted to check if I was missing some way to do it using a "native" scroll bar first.

You might be able to do it with a ScrollPanel and implementing your own ScrollHandler. Just use the addScrollHandler() method and you should be able to override whatever functionality you need.
However, I would suggest that you re-think your approach. What you seem to really want is a slider control for time, that kind of looks like a scroll bar. You should check out the Composite class and the Widget Gallery to see if there is some combination of Widgets that would suit what you need more. Failing that, I'd also look at SmartGWT. They have a very extensive library of GUI Widgets available, and you may find something you can use already there.

Related

Standard way of handling a user customizable view on iPhone?

This is a two part question.
Our iPhone application has a screen which needs to be customizable by users. It is a simple screen with 4-5 customizable slots. Users will be able to pick from list of wiglets/controls they would like to see in the view. They should be able to re-order the widgets and add/remove as they see fit.
Below is a UI mockup showing how a widget screen like this would work. The user would press and hold anywhere on the screen, and it would go into edit mode, similar to how deleting an app works. They then have the opportunity to remove an app from the dashboard and add new ones using a tray at the bottom.
Is this an appropriate way of handing this type of view on iPhone, if not where would be a good starting point? Any links or views/controls to look at would be appreciated.
Certainly, everything described here could be implemented from scratch using UIView as a base, but are there existing views available from Apple that could help me here?
UI Mockup
1 - Existing widget
2 - Empty spot available for widget
3 - Available widgets
I'd make each widget a customized UIView subclass, and just add them to the main view as subviews. As far as specific classes, you could use a customized UITableView (with custom UITableViewCells) for the widget drop area. The widget selection area you could easily implement with a custom UIView and four positioned UIViews. You could also consider AQGridView.
There aren't any standardized view classes that Apple provides for this.

Titanium - Custom Map Annotation Bubbles?

Is there any way to customize the map annotation bubbles in Appcelerator Titanium? Specifically, I'd like them to be able to display more text than what they show (ideally, by expanding to fit the text). I know I can make them clickable and take the user to a page with more info, but I simply don't have enough information to warrant that. It's basically just the title text is too long (and I can't change the text itself, it comes from sources I have no control over).
Alternatively (if customizing what's there isn't an option), is there an easy way to do custom bubbles? I don't really want to have to reinvent the wheel and rewrite the pins themselves and their event handlers, but if it comes down to it (and someone can point me to some code that can get me started, since I know if it's required, someone's done it), then so be it.
iPhone-specific options are fine.
At this moment the latest Titanium SDK gives you such possibilities for annotation bubble customization:
Add subtitle for the bubble (subtitle option). You will see additional text under the title. On Android subtitle can be multiline (using '\n').
Add left and right view to the bubble (leftView\rightView options). You can add custom view to the left or right part of the bubble. And view can consist of different elements (label, image...).
Read more here.
If this is enough for your task - you can use it. But for deeper customization you must create your own view and show it on annotation click event.

Vertically add elements to a scrollview: diffs between Java and iPhone SDK?

Folks,
coming from the Java/Swing world, I am sometimes puzzled by the UI programming on the iPhone. I've spent the last hours with Googling for information but it seems that I asked the wrong questions by thinking too much in Java. Could you please point me to resources to get more familiar with the GUI concepts to be able to achive the following functionality:
Basically, I want to create a vertically scrollable view that represents structured text (for example, a recipe). Each step consists of a title and a textual description. As I want to fold and unfold such steps, the title would be somehow interactive and by clicking it the description would be displayed or hidden.
In Java, I would create a component that renders one such section. The layout manager would compute the components preferred height (with or without description being displayed).
Then, in Java, I would create a panel with a vertical layout manager and sequentially add my components. This panel would be placed in a scroll pane; the scroll pane would ask the panel to layout itself and then show a viewport on it, if for example the height is bigger than the scroll pane's height.
What Java provides me is:
layouting of elements (computing their preferred height and width), thus no need to deal with coordinates and dimensions
dynamic creation of UIs by creating and adding components during runtime
What I understood on the iPhone:
I can dynamically add views as subview to a view, e.g. a scrollview by calling addSubview
I can even remove that stuff using removeFromSubview (as explained here Clear content of UIScrollView)
What I don't understand on the iPhone:
does one view always correspond to a visible screen (I did use tab and navbar navigation so far and there whenever I set a new view, it fills the current visible screen minus the space needed for the two bars)?
or is it possible to define a view that contains a label on top ("north") and a text in center; if so, could such a view automatically determine its height?
can I realize my example in a similar way like in Java or would I need to calculate all dimensions and coordinates of the individual components on my own? (This example seems to touch on that topic: iPhone scrollView add elements dynamically with id)
Alternatively, could I use a WebView and render my stuff as local HTML using JavaScript to show or hide nodes?
Thanks for any hint or link!
There are no layout managers in Cocoa, views are being reposition according to their struts and springs settings. For information on that read the documentation: http://developer.apple.com/library/ios/#documentation/DeveloperTools/Conceptual/IB_UserGuide/Layout/Layout.html
To create a "view that contains a label on top and a text in center" you create a view with subviews - one being a label at the top, second the textview in center. If you configure struts/springs for all of subviews properly, they will autoresize when the container view is resized.
You should also get accustomed to Interface Builder, creating views in code is real pain in the ass.

Left-aligned tabs in GWT

I have a project in which I need a way to display essentially a list of tabs, each with their own content pages, down the left side of the page. I'm using TabLayoutPanels elsewhere to good effect, but after looking at how they are constructed it seems like it would be quite a bit of work to undo Google's carefully constructed layout and get it to work in any other orientation than top-aligned.
This doesn't seem like it would be an uncommon layout, so does anyone know of a successful implementation of this kind of container?
Best you can do is use DeckPanel, and make your custom tab controls to switch visible widget in that DeckPanel.

Scrolling TabPanel

I Am trying to create a Tab Panel where I can add and delete tabs on demand.
Where I am getting stuck is that if a potential user adds too many tabs the new tabs go off the screen.
Each Tab is to contain a text area widget where a user may enter text.
Is there any way of horizontally scrolling the just the TabBar and not the whole browser window?
I could use a scroll panel but I was hoping to scrol just the Tabs, not the panel contents.
I cannot see any available method in the com.google.gwt.user.client.ui.TabPanel API that will perform this function and no real way to split the panel.
Help!
It's not what you've asked for, but you might consider using a StackPanel instead of a TabPanel, since if the user can enter a long list of items it's generally better to have vertical scrolling instead of horizontal scrolling.
The gwt TabPanel isn't the greatest, and there's not a real easy way to do what you want. You could take a look at the tab widget in Ext-GWT, which scrolls the tabs, but I don't think extjs is generally a good idea.
There's a bunch of new layout-based widgets arriving with GWT 2.0. Look at TabLayoutPanel. It places tabs in a very wide container inside a div with overflow=hidden. You might be able to add some controls to scroll that container and get the effect you want.
Good luck, and report back if you get something working. GWT really needs more widget contributors.