spanlabel component does not display all the text - codenameone

I'm trying to show text with SpanLabel, but this component does not display all the text if there is line break. I then try it with TextArea and Label UIID, but the result is the same. Can someone help me on this issue? Thanks

I am having the same problem here. I use the SpanLabel inside a Dialog and the last one or two lines are always cut off.
It only happens when I use the setPreferredW property:
spanLabelDialog.setPreferredW(Display.getInstance().getDisplayWidth()-300);
Is this intended?
Somehow the setMargin property doesn't work for the dialog, neither hard-coded, nor in CSS.
Here is my code:
private void dialolg () {
String longText = "'There should be the whole text displayed here, but it seems the last one or two lines always get cut off'";
spanLabelDialog.setText(longText);
dialogExplain.add(BorderLayout.CENTER, spanLabelDialog);
spanLabelDialog.setUIID("SpanLabelDialog");
spanLabelDialog.setTextUIID("SpanLabelDialog");
spanLabelDialog.setPreferredW(Display.getInstance().getDisplayWidth()-300);
dialogExplain.show();
}

Related

React with tinyMCE - how to output HTML without seeing balises in front-end?

I'm a new user of TinyMCE, and i'm trying to incorporate it in my React App. But i'ma actually getting an output problem. When try "format:text" in the tiny component, and try to create a post in my blog using bold and italic options, when the post is posted, the displayed text is just normal, without bold or italic properties. So, I've tried the "format:html" but in this case, I get my text without any styles at all, AND we see the <p> balises.
So, it can looks like a stupid question but, how do we output the posted text correctly ?
As always, thx in advance !
This happened to me as well. If you do not want to see the attributes on your output then go to the React Component which is responsible for output and in your React component when you use the return() keyword you should create a div use the
dangerouslySetInnerHTML attribute inside.
Example:
Here's [a link] (https://blog.logrocket.com/using-dangerouslysetinnerhtml-in-a-react-application/)

How to get WebDriver using Python to delete an existing value in the table of a confluence page?

Here's what the HTML code looks like for a confluence page:
tbody
tr
td
some text here
tr
td some text here
tr
td
<span>some text here</span>
If I click on a element and then do a send_keys("XYZ") then all that goes into the middle of the existing text. For example, it can result in any of the following:
soXYZme text here
some tXYZext here
soXYZme text hXYZere
I've also tried double-clicking on the element but that doesn't work properly either. That deletes some part of the existing text only.
How do I clear the existing value in the td element knowing that there's no "input" tag anywhere here. Hence, I cannot use WebDriver's clear() method.
Edit: Please note that sometimes the cells will have a blank value too.
I was editing confluence cells using ActionChains. And ActionChains, for some reason doesn't provide the clear() method.
However, I was able to solve this problem by directly calling the webdriver instance's clear function. So my code looks something like this for confluence:
actions = ActionChains(driver)
#ACTIONCHAINS DOES NOT HAVE A CLEAR FUNCTION
driver.find_element_by_xpath("(//td[contains(#class, 'confluenceTd')])[{0}]".format(i) ).clear()
actions.move_to_element(driver.find_element_by_xpath("(//td[contains(#class, 'confluenceTd')])[{0}]".format(i)))
actions.double_click()
actions.send_keys("SOME DATA")
actions.perform()

How can I wrap text of TextArea hint

How can I wrap the text of TextArea hint and also how can I align the hint to the top?
I tried subclassing of TextArea didn't help. I didn't find any relevant method of TextAre to achieve relevant result.
You can't. A hint is a label subclass and those are single line. Unfortunately we implemented it in a way that doesn't make this simple.
However, you can workaround it using code like this:
TextArea actualTa = ...;
TextArea hint = new TextArea("My long hint text");
hint.setEditable(false);
hint.setUIID("TextHint");
Container textAreaWithHint = LayeredLayout.enclose(actualTa, hint);
if(actualTa.getText().getLength() > 0) {
hint.setVisible(false);
}
// I'll leave that as an exercise for you...
textAreaWithHint.addFocusListener(...);

Displaying spacial characters in combobox on select extjs4

I want to display special spanish characters like á,Á,ã,Ã in combobox.SO, I wrote the code for it in locale file, Inglés and Español,etc. When I open the dropdown, it displays the word correctly but when I select it, it displays the code in the box. Similar thing happens with boxLabels, it shows the code instead of the special character. Can anyone suggest me a solution for it?
Thank you.
The problem occurs because elements on list are rendered as divs (so html entities works) while value box is rendered as input (entities dosen't work). Easiest way is to display national characters is to replace entities with actual unicode chars. You can do that by overriding setRawValue method:
Ext.define('Ext.ux.form.ComboBox', {
extend: 'Ext.form.ComboBox',
setRawValue: function(value) {
this.callParent([ decodeEntities(value) ]);
}
});
Fiddle: http://jsfiddle.net/9mjbf96o/2/

Selenium wait until textbox value change

I came across a situation, on selecting combobox value textbox value changes. I need to wait until textbox change to a particular value. I have tried wait.Until, please help me in solving this issue.
If you already knows the value, which going to reflect in the text box after the combo box change. Then you could create a xPath like.
//*[contains(text(),'Expectedvalue']
Then create a method for checking whether that xPath is available or not.
public boolean isElementPresent(String xPath)`
{
try
{
this.driver.findElement(By.xpath(xPath);
return true;
}
catch()
{
return false;
}
}
Then you can check using while loop
`//Do the code for changing combo box value
while(isElementPresent("//*[contains(text(),'Expectedvalue']")
{//do the necessary actions}`
//Assume the Combo box is edited also the Text box is visible
while(! driver.findElement(By.xpath("textboxXpath")).getText().equalsIgnoreCase("expected value"))
{
System.out.println("waiting for text to be loaded");
}
end of this loop, the text box must be loaded with expected value
Caution:
This may lead you to infinite execution. implement with a limitation.
while(! driver.findElement(By.id("id_of_combo_box")).getAttribute("value").equals("Expected Value"))
{/*Loops till value is written*/}
Here we loops till the value of the combo box equals expected value.

Resources