GWT, RichTextArea, set selected text size in pixels - gwt

There is a function that sets size of the selected text: RichTextArea.BasicFormatter.setFontSize(RichTextArea.FontSize fontSize))
It takes an absolute font size argument (1-7). But I need to set size in pixels. Is it possible to do somehow?
Any suggestions or ideas are welcomed =)

You have to implement your own control (i.e. a ListBox) which on selection would insert tags like
<span style="font-size: 12px;"> ... </span>
around the selected text.
A good implementation will also remove unnecessary tags if a user applies font sizes to overlapping portions of the text.
You can add this control to the toolbar that you use with your RichTextArea.

Related

How to keep Material-ui select's width to the widest menuItem?

Material-ui Select adapts the select's width according to selected MenuItem's width. I would like to keep it as large as the largest possible menu item: It looks a bit unfinished when the form modifies its size. I couldn't find any reference to that in the doc.
I can fix the width in css, but it's not adaptative to option
edition.
I can use JS to multiply the number of characters of the menu item and multiply it by the maximum width of one letter and apply this width to the select.
Is there a simpler solution I didn't find?
Thanks

Trying to reduce the size of boxes on screen

I am trying to setup a style based on bootstrap3.
Basically I want to try and reduce the size of the input elements which I have done, getting a decent proportion of 'box' vs 'text'.
However if I use the same font-size in a select box with the same size then I get a situation where the text is masked along the bottom edge...
I think there is a tiny bit more margin at the top of the select box, but for the life of me I cant find where that is set in BootStrap to change it (if at all).
I think all I need to do is move the text in the 'select' element up by a couple of pixels and it will align with those bits of text in standard text boxes....
Can anyone point me in the right direct please?
Found the associated CSS in the bootstrap, with a bit of trial and error....
Mainly in the 'form-control' section.
but now also using Bootstrap 4, with a couple of additional styles.

TreeViewer no longer sizes properly when using StyledCellLabels

I was using a JFace TreeViewer perfectly well for a while.
It has a bunch of branches of varying lengths, but at the end of the day, the entire tree stretched to the size of its longest string. This was great.
Recently, I decided that the TreeItems labels should have some style to them fonts and highlights.
The trouble, is that the new fonts are a bit larger and stretch the size of the overall string. It seems that the Tree or TreeViewer doesn't recognize this expansion and still judges the size of the label by the amount of small characters in it. The result is that I get a TreeViewer with a horizontal scrollbar, which is highly inconvenient because now my users will have to scroll across each tree, rather than just being to quickly glance at the data.
Does anyone know how to get the Tree to properly fit the length of the longest string, and take into account the added length of the styling, etc?
Thanks!
While this is not a complete answer, I hope it will help jogs someone's memory who has more advanced knowledge on this:
When I set the font to the ViewerCell object to a font that is wide, the entire row properly resizes. It seems that the Tree measures its width by checking the length of the text and the font, but disregards the Style Ranges.

How to set automatically min width of fields by longest text in some group

I use iReport to create reports, and I would like to know if there is a way to set the width of "optically grouped fields". They should be set to the minimal size that still displays longest text. I have Static Text on left side and Text Field right of them. This Text Fields are set to the width 150 and alignment to right, but I'd like to set smaller size to wipe out white spaces.
Consider some thing like this
Name: Paul
Surname: Smither
And want automatically to
Name: Paul
Surname: Smither
etc. can be smaller then preset size but no bigger.
Is there a way?? even some component
You cannot change the element width dynamically without using Java frameworks.
The quote from JasperReports Ultimate Guide:
ELEMENT SIZE
The width and height attributes are mandatory and represent the size
of the report element measured in pixels. Other element stretching
settings may instruct the reporting engine to ignore the specified
element height. Even in this case, the attributes remain mandatory
since even when the height is calculated dynamically, the element will
not be smaller than the originally specified height.
You can read this article for better understanding the mechanism of changing the element size.
If it's genuinely just a couple of fields that come from the same row in the dataset, then you could hack something together.
Use a monospace font
Define your maximum field length with a String set to N spaces. For example:
$P{MaxLengthString} default value is 10 spaces: " "
Change your field text from $F{FirstName} to this:
$P{MaxLengthString}.substring(
$P{MaxLengthString}.length() + $F{FirstName}.length() - java.lang.Math.max($F{FirstName}.length(), $F{LastName}.length())
) + $F{FirstName}
That is... er... a bit more complex. And it only works with monospace fonts. And I can't believe I really suggested this. Don't do it. (But it ought to work.)

define height of tine mce

I want to set height of tiny mce depending on the type of element it is initialized for. For example, I want to set height 200px for headings and use mce's default size for for paragraph and ordered and unordered lists. Also, I want to adjust height of the mce instance with the content. Instead of adding vertical scrolls, it should increase with content.
Help APPRECIATED.
For this you need to specify editor_css in the tinimce init.
There you should change the desired values.