iText RadioCheckField tooltip issue - tooltip

I am trying to set tooltip (mouse over info) on Acroforms fields using itext. I have no issues with Textfields, Checkboxes and Listfields. But for some reason the tooltip is not getting shown in case of RadioCheckField. Following is the code snippet
RadioCheckField radio = new RadioCheckField(writer, new Rectangle(x, y - 4, x + 14, y - 14), name, exportValue);
PdfFormField field = radio.getRadioField();
field.setUserName(toolTip);
field.setName(name);
writer.addAnnotation(field);
radiogroup.addKid(field);
Invoking setUserName on PdfFormField sets the /TU flag in PDF. When I examined the generated PDF through Rups, I can see that /TU is set for RadioCheckField kids in the radioGroup. But still no tooltip is shown. For 508 (accessibility) compliance tooltip functionality is a must.
Here is a link to PDF file generated from above code http://www.docdroid.net/14son/output.pdf.html
Can anybody provide some information?

Related

Styling a vaadin Component (Dialog) with CSS file

I have a Dialog that retrieve informations from an endpoint (String of information) but I have a Problem with style this dialog, because all these informations appear untidily!
For example to be clear, I have this endpoint, that it helps me to retrieve a Data about Mobile, and want to show this Data in a Dialog (BUT the Style should like Screenshot Nr. 1), but my Problem is that the data appears as Preview (Screenshot 2).
You can use the Html component with a pre tag where you put the formatted JSON:
Html pre = new Html("<pre>" + formattedJson + "</pre>");
To format the JSON String you can use this:
String prettyJson = mapper.writerWithDefaultPrettyPrinter()
.writeValueAsString(mapper.readTree(inputJson));
Find more examples here: https://roytuts.com/how-to-pretty-print-json-in-java/

Vaadin 7 check if style name exists

In my Vaadin 7 application I can add a new style name to a component for example via following method:
panel.addStyleName("criteria-menu-active");
But right the next click on this component I need to check if this style was already added to this component and if so - remove it.
So, how to test the component for the presence of a certain style by its name ?
Did you try the following?
myLayout.addStyleName("custom-style");
System.out.println("Style = " + myLayout.getStyleName());
Output:
Style = custom-style

How can I display the Gerrit ID in the UI?

Gerrit used to show the ID as the first column in the UI. I'm on version 2.9 (yeah, I know, oldish, but we can't upgrade at the current time), and it's no longer visible. I know I can click on a change and see the ID or hover over a change and see it in the URL in the browser status line, but I really need to be able to see a bunch of them at a glance.
Is there any way to augment the URL I use to add it?
Go to your preferences (i.e. your-gerrit.com/#/settings/preferences) and check the Show Change Number In Changes Table option.
As I can see in this issue it was introduced in 2.10 but I remember using it earlier, if I'm not mistaken.
EDIT:
The change that itroduces it is here and it's included in 2.10. You will have to update in order to get the Change-Id column in the list.
EDIT 2:
I have created a simple JS script that will show the column with ChangeId. Just paste it to the URL bar when you are viewing the changes list:
javascript:var cols = document.getElementsByClassName("cSUBJECT"); for (var i = 0; i < cols.length; i++) { var id = cols[i].children[0].getAttribute('href').substr(cols[0].children[0].getAttribute('href').lastIndexOf('/') + 1); cols[i].insertAdjacentHTML('beforebegin', '<td>' + id + '</td>'); } document.getElementsByClassName("iconHeader")[0].insertAdjacentHTML('afterend', '<td class="iconHeader"></td>');
You can add it as bookmark if you wish and click it when you want change numbers displayed :-) Might need some tweaking, though.

Worklight - Enable Translation

From the Worklight tutorial - 05_05_Enabling_translation.pdf (Sample app), we can
1. Define the translated message in messages.js
2. Reference the message in HTML as the ID of an HTML element with class="translate" or as a JavaScript object property Messages.<ID>.
3. Implement a languageChanged function to set a new value of Messages.<ID> and update the content to selected language.
In the example - languageChanged(lang) function:
$("#sampleText").html(Messages.sampleText);
$("#headerText").html(Messages.headerText);
$("#actionsLabel").html(Messages.actionsLabel);
is used to update the content to selected language.
From my understanding, it is required to write the above line of codes to update the content to selected language.
Is there a better way to update the content if there are lots of elements?
You can easily iterate over all elements by using jQuery selectors and update text, e.g. something like
$(".translate").each(function(index, element){
element = $(element);
var elementId = element.attr("id");
element.text(Messages[elementId]);
});

Text URL in AIR iOS app not selectable

I'm using AIR 2.0 (soon will be updating to 3.3 with Flash CS6) to create an iPad app. We have textfields (Classic, dynamic) which sometimes contain one or multiple htmlText links which need to be clickable. In the desktop version of the program, all text is selectable and the links are easily accessed. My problem is that it takes me mashing the link like 20 times on the iPad before it will recognize that there's a link and navigate to it in Safari. The other strange thing is that none of the text appears to be selectable - I can't get the iPad cursor, copy/paste menu, etc. to show up.
I think, from reading other threads, that the hit area for the URL is only the stroke on the text itself... if that's true, what can I do to increase the hit area? Or make text selectable? It was suggested elsewhere to put movieclips behind the URLs but that's not really possible as this is all dynamic text from XML files.
I've read about StageText but I gather this is only used for input fields, which is not the case here.
I'm reasonably advanced in AS3 but I'd prefer an easy solution over re-writing large chunks of code. At the moment the only thing I can think to do is get the URL and make it so that as soon as you touch anywhere on the textfield, it navigates to the link. But this would break down if there were more than 1 URL in a given textfield.
Any ideas?
I had this exact same issue, and it's had me flummoxed for a while.
Here's what I did to get the desired behaviour:
1) Instead of using a listener for TextEvent.LINK, listen for MouseEvent.CLICK (or TouchEvent.TAP) on the TextField.
eg.
var tf:TextField = new TextField();
tf.addEventListener(MouseEvent.CLICK, linkClicked);
2) In the linkClicked() handler, you use getCharIndexAtPoint() to determine the index of the character that was clicked, and then from that determine the URL from the TextFormat of the character. This is adapted from a post by Colin Holgate on the Adobe Forums (http://forums.adobe.com/thread/231754)
public function linkClicked(e:MouseEvent):void {
var idx:int = e.target.getCharIndexAtPoint(e.localX, e.localY);
trace("Tapped:",idx);
var tf:TextFormat = e.target.getTextFormat(idx);
if(tf.url != "" && tf.url != null) {
var linkURL:String = tf.url;
trace(linkURL);
// Hyperlink processing code here
dispatchEvent(new UIEvent(UIEvent.LINK_TAPPED,tf.url));
}
}
3) The last line (dispatchEvent()) is sending a custom event to another function to process the link, but you could easily inline your code here.
I've tested on an iPad 3 running iOS6.1, building with AIR3.5. Links are much more responsive, and I don't find myself mashing the screen trying to hit the stroke of the text!

Resources