BorderLayout with GWT - html

How to achieve a true BorderLayout effect in GWT?
If possible without a library?
If I need to use a library, please not a payed one, neither a deprecated one?

From Kinjal's post, the 2.0 *LayoutPanel classes are almost certainly what you want. The DockLayoutPanel and its subclass the SplitLayoutPanel will provide this functionality in two different ways.
There are two important things about using Layout Panel classes. First, use a strict doctype (such as the html5 doctype). Second, all panels must be given a size and must be informed of resizes - this is why they all implement the RequiresResize interface.
The easiest way to do that is to start not with a RootPanel, but with a RootLayoutPanel - this will ensure that you get resize events from the browser window. Then, add in the layout panel of your choice, and it too will be resized.
If you build your own widget subclasses and want to be notified when resizing happens, you too should implement RequiresResize. Similarly, if you are building a widget subclass that will be sizing its children, you should implement the ProvidesResize interface.

Use HLayout or VLayout and set custom css style to achieve it.
You can also take a look at this Layout documentation

Related

StageWebView - hide just for JS

I want to use StageWebView just for communicating with a JS page, without actually showing it at all
Is this possible, and if so, what is the best recommended way of doing it?
Seems that not setting the viewport might accomplish this, as well as positioning the viewport offscreen
First you need the interaction, then you need to put the view off the stage. Take a look at RichWebView which is an alternative to StageWebView https://github.com/myflashlab/webView-ANE
As the documentation says, you can't do this with StageWebView.
The StageWebView class provides a simple means to display HTML content
on devices where the HTMLLoader class is not supported. The class
provides no interaction between ActionScript and the HTML content
except through the methods and properties of the StageWebView class
itself. There is, for example, no way to pass values or call
functions between ActionScript and JavaScript.
Using HTMLLoader you could do this.

Implement a Virtual Web Browser using Canvas

Would it be possible to create a virtual web browser, inside your existing web browser, using canvas, to achieve near pixel perfect representation of websites across all browsers?
Take a look at http://html2canvas.hertzen.com/ - It's a HTML renderer using a Canvas element. There are a few limitations (some CSS3 properties don't work) and you can only do static images with it. But it's still very cool.
Also it's still going to be browser-specific in terms of exact positioning of elements.
Theoretically: Yea, maybe... no.
Practically: Hell no.
You can't play flash / silverlight / java applets on canvas. Also, you'd have to:
Manually parse the DOM,
Apply CSS,
Execute JS,
Render everything,
Make input elements,
dropdown menu's,
hyperlinks,
mouseovers,
and all that kind of interaction work,
And whatever else I've forgotten.
Like proper Anti-Aliasing
Only with tremendous difficulty.
Why not just use <iframe>?

How do you add resize functionality to flex components?

I'm creating a flex drag and drop interface of sorts that will have a range of different components. Is there a standard way of adding resize handlers to a component or does the component need to be overridden?
Do you mean front-end resizing?
Senocular wrote an excellent transform class for that:
http://www.senocular.com/flash/tutorials/transformtool/
http://www.senocular.com/demo/TransformToolAS3/TransformTool.html
I found quite a useful example that is easy to implement. It gives support for changing cursors, setting bounds, rotation and fixed aspect ratio. I think its worth a look for anyone needing to add resize support.
https://github.com/marc-hughes/ObjectHandles/tree/master/flex-object-handles
The above link is a flex project download. Import the flex project and run the MoveAndResize.mxml example.

Change DIV's properties depending on the browser

I'm looking for a way to distinguish which browser is used and then change properties of the DIV's background.
Right now I'm using a picture as a DIV's background and it has to have a fixed width and height. However, when the site is viewed from a mobile browser ( iOS, Android, etc..) I would like to use a simple color as a background and make it flexible in terms of the width and the height.
So.. I guess my question is if there is any good approach for distinguishing which browser is used and then changing DIV's propertied depending on the browser.
Thanks.
Michal
There's two ways to do it, one as Terrik said using Javascript and do it on the client-side, you could use this jQuery plugin to add a class into the body to do it: https://github.com/leopic/Simple-jQuery-UA-Spoofing
The other is actually doing on the server side, check the headers of the page in the request and change your content before the page even loads, for instance in PHP http://php.net/manual/en/function.get-browser.php
My recommendation is, don't do either, develop your page to be responsive and accomodate to different widths/resolutions and not browsers: http://www.alistapart.com/articles/responsive-web-design/
You could use CSS media queries
This needs to be done using client side, not server side. (i.e. JavaScript not PHP)
If you want to know more about it than just how to do it, go through this site: https://developer.mozilla.org/En/Browser_Detection_and_Cross_Browser_Support
If you just want some sample code and a quick explanation, I've used this before:
http://www.quirksmode.org/js/detect.html
Once you detect that, you can set up an if statement to determine which divs to display.
Well, there are several approach to do that.
AS Terrik said, you can use client side code to dynamic change the page but this is not necessary the best approach.
A mobile page is not only a background color change. It also can be a layout change. I suggest you to use the MVC pattern : same model, same controller but one view by "browser" (device seems to be a better term in your case). When the user thirst visit your site, send the device used to your server and display the good view (via a redirection). Don't forget to save the user agent in the user session to avoid this redirection process for next pages.
I suggest you to look at GWT, which is a powerful framework when you need multi device capabilities.

Screen-like interface in HTML

I have some 10 odd Silverlight based components. I wanted to create a screen like interface in HTML, each screen holding some number of components and the user can easily navigate between the screens and use the components.
Can anyone suggest me some way in which I could easily implement such an interface?
Thank You.
As I understand from your question you need Navigation Framework.
With it you can have any number of pages(screens in your case) and navigate between them.
You also can do that kind of things using behavios. Very good video is avaliable at silverlight.tv : Creating Rich Interactions Using Blend 4: Transition Effects, Fluid Layout, and Layout States