I use GWT 2.4.
I have a log of widgets on my web page, there are a huge tab panel with 13 elements, each element of tab has a panel. I use GWT framework. I have to make some logic when one of those elements is visible for user, how to implement it ???
I use Timer for "some logic" and to check whether the panel is visible or not.
I check :
if (somePanel.isVisible()) { do smth}
but it's not working because I also have other links and another elements and when I switch to another element it works but if I click on link - does not.
Thank you in advance :)
I suppose you're using MVP,
You should do the display logic on page load through a model that you write to the place url. links change place so your views are reinitialized (if you don't have a clientFactory)
Anyway, you don't give any details on why it doesn't work with links and what means
when I switch to another element it works
Related
I'm writing a test when you get all the links from the website and click them. But I need to click some links that in the beginning are hidden or some links that appear only in other pages. Till now, I'm only got to the point that test gets all the active links from homepage and clicks them. I'm new to Selenium webdriver and java, so can you suggest how should I write the test that checks for new appearing links after clicking one or something similar?
I usually write my Selenium tests much more specifically, but were I to attempt this I suspect I would start by making use of findElements(By.tagName("a")) to get all currently available anchors, probably put them into a data object which included if that anchor as been clicked yet and put those data objects into a Set. Map that Set to the currentUrl to keep track of what links were found on what pages. After a click (and recording that you clicked that anchor in its data object) you could check the currentUrl (without any #s) with the last one (without any #s) to determine if that click loaded a new page. If the urls match, I would call findElements again and add those to the existing Set. If they don't match repeat the process for the new currentUrl. Some additional things to be aware of would be handling new Windows and frames, which would require a switchTo and iterating through all the frames (and nested frames).
How to verify if Tab on Web Page is selected using Selenium RC
I wanted to one very simple thing. Does anyone know using selenium RC Python Client how I can know if a Tab is selected on web page?
By tab I mean the following examples from the following link-
http://esdi.excelsystems.com/wsexmp/DIVTAB.pgm?wsnum=00096
I have used focus(), isSomethingSelected(), isVisible() but didn't get the solution.
I need to verify that the specific tab is selected by default after webpage opens. Isn't there a method like is_tab_selected(tab_locator)??
please provide the clear solution pls..
I have used focus(), isSomethingSelected(), isVisible() but didn't get
the solution.
These methods use the common HTML element terminology.
focus() is for elements that are focused, meant as when you click a focusable element, it has a focus on it. To see what I mean, you can loop through the focusable elements on your page via pressing the Tab key repeatedly. This changes focus.
is_something_selected() is for selecatble <option> elements (which are the children of a <select> element)
is_visible() tells you whether an element is actually visible on the page or whether it is hidden via CSS.
Anyway, there's no is_tab_selected(tab_locator) method, because there's no such thing as a tab. In your case, your "tabs" are just simple clickable <a> elements which have a class attribute tab-active or tab-disabled based on their state.
Therefore, if you wanted, for example, to know whether the second tab is active, you would do
is_element_present("css=#tab2.tab-active")
This will return either true or false based on whether the tab is selected or not.
Or the other way around, if you wanted to know which tab is currently active, you would do:
get_attribute("css=.tab-active#id")
This will return the id of the selected tab.
You have to find a unique tag in your webpage. You can do
driver.findElement(By.xpath(".//tagname"))
If the above line doesn't throw any exception, you can confirm that you are located in your webpage.
I'm trying to write a GWT app that reuses the same template for every "page" (place). There are 4 main "pages" of the app:
Dashboard page (http://www.mywebapp.com/#dashboard)
Calculator page (http://www.mywebapp.com/#calc)
Configurator page (http://www.mywebapp.com/#config)
Login page (http://www.mywebapp.com/#login)
Each "page" has the same templated look-and-feel: (1) a header section that contains the logo and the navigation menu, (2) a content section that contains "page"-specific content (i.e. will be different for the #dashboard place, #login place, etc.), and (3) a footer section that contains some links. So you see, the only thing that changes from page-to-page is the content section. Just like an ordinary, templated web site.
The thing is, each "page" (place) is actually a fairly complicated UI with many different panels consisting of lots of widgets. As the user interacts with the app, these panels will come into and out of existence and the display will be changing all the time. For instance, on the #calc page, the user can select which "mode" to display a calculator in: either as Basic or as Advanced. When the user selects Advanced, several additional panels will display (in addition to the Basic panel).
It would be nice to be able to keep such actions in history, so that the user can bookmark the app in either Basic or Advanced mode, so something like:
http://www.mywebapp.com/#calc/basic; or
http://www.mywebapp.com/#calc/advanced
Here's the problem:
We already have several "levels" of activities/places going on here. At the "app"-level, we have the template that needs to be displayed to the user when the MyWebAppModule implements EntryPoint downloads. This TemplatePlace is the default/initial place that is registered with the HistoryHandler before calling:
public class MyWebAppModule implements EntryPoint {
#Override
public void onModuleLoad() {
// ...
// The first place we go to when this module downloads.
TemplatePlace templatePlace = getSomehow();
historyHandler.register(placeController, eventBus, templatePlace);
historyHandler.handleCurrentHistory();
}
}
Next, we have all the different "pages": DashboardPlace, CalculatorPlace, etc. that all have their own unique views/displays. For instance when the user clicks the Calculator link to go to CalculatorPlace, it should render a different view than when the identify that they want to use the calculator in Basic or Advanced mode.
Finally, we have the different display regions, panels, etc. inside each page/place, such as the BasicCalculatorPlace and AdvancedCalculatorPlace. This is what I mean by different "levels" of navigation:
Application-level (a template to apply to all pages/places)
Page- or place-level
Display- or panel-level
The question:
I want to achieve bookmarkable URLs (places) for when the user does all of the following:
Goes to the home page (http://www.mywebapp.com)
Goes to any of the "pages" (http://www.mywebapp.com/#calc, etc.)
Uses the pages/places which cause page-specific panel or display configurations (http://www.mywebapp.com\#calc\#advanced, etc.)
How many Activities and Places do I create? How many ActivityManagers? I guess I'm asking for how granular Activities/Places need to be for each "level" of bookmarkable UI. Thanks in advance!
I think you only need one ActivityManager and one Activity per "page". You can make your "header" and "footer" into widgets that can be reused in each page.
You can bookmark different states of the same page by using tokens. For example, you can set a token to "basic" - it would tell the CalculatorActivity to show basic calculator panel. The URL will look like:
www.myApp.com/?#Calculator:basic
When a user clicks on a widget to select an advanced option, you do
PlaceController.goTo(new CalculatorPlace("advanced"));
The CalculatorActivity will get the CalculatorView (which is already displayed), it will see that the token is set to "advanced" and it will instruct this view to show advanced panels.
Note that you can make your tokens as detailed as necessary and then parse them in Activity. For example, you can have something like
www.myApp.com/?#Calculator:option=basic&position=top&theme=pink
I need to provide context sensitive help in my GWT application. For this every GWT view will have many help links each of which will open a dialog box with appropriate help text (different for each link). The problem is I cannot have so many ui:field elements each with unique name and click listener in my view classes as the number of help links may be very large. What I need is to have many Anchor elements in my UI binder xml file and all the anchors should have the same click listener. The click listener will decide based on some parameter which help text to display in the dialog box.
I tried to use Hyperlink element with different history tokens for all links, but it changes the history which is not desirable. I just want to show a dialog box with appropriate help message without modifying history.
Is it possible in GWT?
Thanks for your help.
You can obviously use <g:Anchor href="javascript:;"> in your UiBinder and later add handler in your code.
But, since you have a lot of this all around your app I'd use gwtQuery:
$(".help-link").click(new Function(){
public void f(Element element) {
// do something here
// `element` tells you which element triggered the event
});
then I'd just add css class .help-link to all relevant anchors.
I am using Liferay 6.0.4 and I have a page which is available to all users including guests. The page is called "Information". The page has already been created.
Right now its an empty page.
I want to add these four links to that page on the left hand side:
1. Calender
2. Forums
3. Blogs
4. Docs
I have created that page with 30:70 layout so that I can place one Web Content showing these four url's on the left side and corresponding link content on the right side. The default content to show is the content of the link Calender.
I am not able to figure out how to achieve it as I am really new to Liferay. Please guide to me to the proper direction and if possible write some steps to follow...
If I understand correctly, you want a menu on the left hand side that updates the right hand side.
For this, you should use the Navigation Portlet on the left hand side, and create 4 child pages "Calendar", "Forums", "Blogs" and "Docs". On each of these pages, just drop the appropriate portlet and you're set.