GWT text with different colors - gwt

I had a label that receives a text, example 12 Status 3
I need to put the numbers with a different color.
What is the best way to manage that?
thanks for the help

Every piece of text that you want to be a different color will need its own <Span> tag. This is how StackOverflow and other sites have formatted text inline. You could still use a single <Label> element though, and insert a series of tags.
For example:
/* CSS */
label { color:black; }
.red { color:red; }
.blue { color:blue; }
GWT:
myLabel.setInnerHTML("<span class='red'>12</span> Status <span class='blue'>3</span>");

You can't do this with a single label. You have to use three separate labels, and color each one independently. You probably want to use InlineLabel to keep them all on the same line - I think InlineLabel works just like a <span> tag.
The best way to color a label is with css or CssResource.

Related

How can I make the grid cells show the whole input text in ag-grid?

I hope you're having a good day.
So I am using ag-grid in my project to transform a bunch of excel tools(files) in one unified web-application.
So far so good.
However, I couldn't find a way to make the grid cells show the whole input text with the ag-grid framework.
In Excel:
In ag-grid:
I hope I have made my point clear.
I have searched in the ag-grid documentation but with no result. This also seems to be the default input text cell rendering in all of their projects examples.
https://www.ag-grid.com/javascript-grid-cell-editing/
Any help is welcome :)
This one is similar to one I already answered: AG-Grid - How to increase row height dynamically?
Provide a CSS class for the column
{
header: 'Address',
field: 'address',
cellClass: "cell-wrap-text",
}
CSS class - keep it in your root level styles.
.cell-wrap-text {
white-space: normal !important;
}

cannot find css element in protractor

How do I locate the element with the following html, I have 4 Start buttons each in different color. I tried using css by class and is not working. There are no unique ids as well. Pls help
Start
As Ben Mohorc points out, you really need to give us a bit more to go on. But if you are saying there are multiple start buttons, but only one of each color, it ought to look like this. For now I assume all they say is "Start". If that is only part of what they say, use partial buttontext.If it is background color that differs, you may need to adapt that, too.
var coloredButton = element.all(by.buttonText('Start')).filter(function(elem) {
return elem.getCssValue('color').then(function(color) {
return (color == '#00ff00')//fill in the desired color here, in this format
})
});
Then do your stuff on coloredButton.first(), which will be the only one, according to what you are saying.
For more on the format to expect from the color, see http://www.protractortest.org/#/api?view=webdriver.WebElement.prototype.getCssValue

change part of the text color in UiBinder

I have a text:
<g:Label ui:field="titleLabel">text RedText someMoreText</g:Label>
Now I'd like to make RedText red. I can't set any widget inside <g:Label> tags, or html elements. But how is this done then?
One way is that you can use <g:InlineLable> inside your <g:Lable> and then style the InlineLable with color Red. Or you can use <span> element with an id/class as per requirement and style it accordingly to red color.

css nth-child and classes

I've got a problem with the css nth-child selector.
I have a grid of 3x3 elemtens inside a container. Those elements have a class called .square.
With .square:nth-child(3n+1) I select every first element of the row and color it green.
With .square:nth-child(3n+3) I select every last element of the row and color it red.
This works fine, until there is any element(<br> for example) that is outputted before the grid. With every new <br>, the order moves up by one, as is the <br> was considered a .square.
As I understand the .nth-child, it should select every third element of the .square class. Why does it apply that to any element, and how can I achieve my inital goal?
Thanks in advance
http://www.hier-krieg-ich-alles.de/shop.php?cat=26491127728
The problem occurs on the boxes in the middle.
Sounds like you want nth-of-type.
Related selectors which you may find useful are :first-of-type, :last-of-type, :nth-last-of-type and :only-of-type.
nth-child working only with html element, nth-child css don't know class and id, if you want set nth-child for class, add some custom attribute for that class using jquery..
like
jQuery('.square:nth-child(3n+3)').attr("act","dummy");
then use css
div[act='dummy']{
border : 1px solid red;}

disable block selection in uIWebview

sometimes in a webview , a user has to catch partial selection in a para. I am trying to do a partial selection, but instead it selects the entire para with that blue box. Is there a way to get around this ?
Regards
Harikant Jammi
Try to change the paragraph css property display to inline-block. This allows partial text select, but can break the layout, so isn't a solution for all cases.
P {
display:inline-block;
}