GWT & Visualisations API - ImageLineGraph display options - java

I'm displaying a ImageLineChart via my little GWT application and I just wanted to add some display options, namely:
chm=s,000000,0,1,7.5
Which is just a little black square node on series 1 (0) point number 2(1). I tried appending the above string onto one of my current ImageLineChart url's and hey presto, there appeared the black node.
In the GWT application I used:
options.set("chm", "s,000000,0,1,7.5");
As I couldn't find an actual method for setting "chm", so I tried a general-purpose set() method, as above.
This doesn't seem to be working and checking the URL in debug I can't find any mention of this chm parameter which I thought I'd have set.
Can anyone see where I've gone wrong?
Thanks in advance
Tony

Related

Trying to Change Dojogrid Rowcolor based on Content

I have a function that generates a Dgrid and fills it with content which it receives from Javaside.
I tried to do dojo-css to handle this like here:
Style Dojox Grid Row depending on data
After this didn´t work I tried to work with Dojo.connect to change the color of the row when the grid is being built and filled.
After that didn´t work I tried to use dojo.on or dojo.aspect.after but since I am a total Newbie in Dojo I have no clue where you can intersect in the code and do theses things.
with a code like so :
require(["dojo/request/xhr","dojo/dom-form", "dojo/dom", "dojo/_base/array", "dojo/json",'dgrid/Grid','dgrid/Selection',"dijit/registry","dojo/_base/declare","dojo/domReady!"],
function(xhr,domForm,dom, array, json, grid, selection,registry, declare){
..... Here the grid and data is declared java function called
}.then(function(data, array, grid, selection,registry, declare){
.....Here the dgrid is filled
}
Where/when should i use Dojo.Connect , Dojo.on or Dojo.after?
I´ve spent mutiple days trying to figure this out but the program either stops working or ignores my changes.
The link you mention above is for dojox grid, which is different to dgrid. Here is the link to css styling for dgrid.
It won't answer your question though which is about changing a row color based on content. The way I do this is cell by cell, using a custom renderCell function.
Documentation on renderCell can be found here, and an example can be found here.
ps: a bit of caution. The learning curve for dojo 1.x is quite steep. When looking for documentation, make sure you get the latest possible (1.10). If you find a link which is about version 1.6 or less, be careful: many 1.6 and before features have been deprecated in version 1.7.

Paste into text area

I tried to make my day easier making a program that will register my self into card game tournaments via selenium webdriver. I am beginner so I was thrilled even though it was just basics aka click here, confirm this, write that but at the end I ran into a problem that I am having trouble solving.
At the end you need to submit decks via deck code. The sendKeys function? (not sure if thats the correct wording) does not work since it actually needs to be pasted into the text area. Whenever you try to "just" write into the box it says its invalid deck code.
driver.findElement(By.xpath("//*[#id=\"react-root\"]/div/div/div[2]/div/div[2]/div/div[4]/div[1]/div/textarea")).click();
driver.findElement(By.xpath("//*[#id=\\\"react-root\\\"]/div/div/div[2]/div/div[2]/div/div[4]/div[1]/div/textarea")).sendKeys(Keys.chord(Keys.CONTROL + "v"));
I went with this, first line just clicking in to the text area and then trying to paste it in (while I copied the deck code manually, not sure how I will solve this since I need to paste 3 different ones, but that is issue for the future) but the code just wont paste and I have no idea where is the catch. I tried the paste function in different text area with the same settings meaning I have something copied in my clipboard and it worked just fine.
Example of the deck code is
" AAECAZICCiT3A94FrtICv/IC9fwC2KAD+KED9KID/KMDCkBWX/4BxAapogPIogPcogPvogPZqQMA "
I hope I provided everything I should have otherwise let me know and I will gladly post more :) Thanks in advance and I hope someone can help me
This might not work because I don't see you explicitly copying the deck code, as you mentioned you did it manually. I also modified your example to not use Keys.chord, as you might not need them here.
To copy the element:
deckCodeWebElement = driver.findElement(locatorToFindDeckCode);
deckCodeWebElement.send_keys(Keys.CONTROL+'a')
time.sleep(1)
deckCodeWebElement.send_keys(Keys.CONTROL+'c')
Then, to paste:
deckCodeWebElementToPaste = driver.findElement(locatorToFindDeckCodeToPaste);
deckCodeWebElementToPaste.send_keys(Keys.CONTROL+'v')
On another note, I recommend shortening your XPaths to relative notation, as the absolute notation you are using is very brittle and breaks very easy. You want to find elements irrespective of their location in the DOM tree.
You can change this:
//*[#id=\\\"react-root\\\"]/div/div/div[2]/div/div[2]/div/div[4]/div[1]/div/textarea
to just this:
//textarea
You may need to query on something like ID, class, or name if there are multiple textarea elements, but there is no need to start at the root node and use div[2] and div[4] unless absolutely necessary.

Printout problems on Bluej

I wanted to print a few programs for a school project on bluej. When I click the print button and set the paper size to A4 and give 'OK' the print comes in a weird small box. I tried increasing the font size. No changes happened. I also changed the page type to the different ones available, but no luck. Please tell me how to solve this problem.
There are two possible ways to solve your problem. The first is to copy-paste your code into another program, for example Word. The second way is to printscreen the code you want to print and then spread this picture across the A4. Maybe you should cut the edges off first.

Selenium WebDriver and Highchart testing

I know this question has been asked before on S.O. and other websites but I haven't found a definite answer -- most of them say its not easily done but I wanted to make sure that was the final verdict.
Here's my situation:
I'm testing a website that is using Highcharts (http://www.highcharts.com) using Selenium WebDriver (Java).
I basically want to grab the information that is displayed in a small tooltip pop-up that appears when you hover your mouse over each datapoint on the Highchart's line graph.
Looking at the web page's HTML code, I noticed there is <g class="highcharts-tooltip".... I also noticed that, as you move your mouse, the (X,Y) values in ...transform="translate(X,Y)"> change, which then changes the information displayed in the tool tip.
Knowing this, my approach would be to somehow grab all the (X,Y) values and plug them into the transform fields and grab the tooltip data. But I don't know how to programmatically grab all the (X,Y) values through Selenium.
Has anyone tackles this issue in the past or has a better way to grab the necessary information?
I started creating a library to work with HighCharts, what I currently have is available here:
https://github.com/Ardesco/Powder-Monkey/tree/master/src/main/java/com/lazerycode/selenium/graphs
It's quite hard to provide a generic library that deals with HighCharts as the customisation options on the individual charts can modify the SVG markup quite a bit. Hopefully the above will help to a degree.
As I do more it will be updated.
The Line Charts have to have a background to work. If the chart is created with .setBackgroundColour(null), then the "rect" is not added to the html.
I was able to to add the background colour back in set to the body background colour. However I'll try and figure out a way of doing it without the "rect".

Dynamically changing the shown form on tree selection

I'm currently learning the adf framework, and while doing this I found myself in a situation I am not able to solve.
I have a tree component that works fine. I also have different forms, corresponding to different levels of the tree. Rather than having all of the forms visible at one time, I would like to only show the one that corresponds to the selected item in the tree.
To solve this, I created af:switcher, created facets and moved the forms there. Here is where I am lost, how do I tell the switcher to change the form? I tried to link them together using the facetName on the switcher, but no success. I suspect I did not link the right thing there, but I could not find anything helpful from the tree either! I assume it has something to do with the selectionListener and a bean, but I could not figure out a way to do this. Any clues?
See Sample #50 of http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html#CodeCornerSamples
Frank

Categories