How to show complete header label name in Select Columns header menu dialog(Column Chooser),when header column labels contain new line character? - eclipse

I've header menu configuration added in my nat table as follows,where I've included "Select Columns" menu as well:
// Popup menu
this.natTable.addConfiguration(new HeaderMenuConfiguration(this.natTable) {
#Override
protected PopupMenuBuilder createColumnHeaderMenu(NatTable natTable) {
return super.createColumnHeaderMenu(natTable) .withColumnChooserMenuItem(); }
});
// Column chooser
DisplayColumnChooserCommandHandler columnChooserCommandHandler = new DisplayColumnChooserCommandHandler( bodyLayer.getSelectionLayer(), bodyLayer.getColumnHideShowLayer(), columnHeaderLayer.getColumnHeaderLayer(), columnHeaderLayer.getColumnHeaderDataLayer(), columnHeaderLayer.getColumnGroupHeaderLayer(), columnGroupModel);
//If header name consists of multiple words then I've used ("\n") as a separator between words in
//the header column name ,so that some space could be saved
// In that case on opening "Select Columns" context menu dialog only first word of column is visible
Can it be fixed by replacing all "\n" and white space character by single white space(" ") character in
In org.eclipse.nebula.widgets.nattable.columnChooser.gui.ColumnChooserDialog
//code to replace extra white spaces or new line character from column label with single space so that //header name is completely visible in populate tree method
treeItem.setText(columnEntry.getLabel());
In that case can fix be provided to replace extra space with single space in column header name or is there any other alternative to fix it?
Image with header names having multiple words For eg:"Issue Date",if header name is dispalyed as "Issue\nDate",only Issue is visible in "Select Columns" context menu dialog

IIRC you add the line breaks to save some space. They are not needed for any semantical reason. I would suggest to configure the TextPainter that renders the column header cell content to wrap automatically if not enough space is available. This could look like this for example:
configRegistry.registerConfigAttribute(
CellConfigAttributes.CELL_PAINTER,
new BeveledBorderDecorator(new TextPainter(true, false, false, true)),
DisplayMode.NORMAL,
GridRegion.COLUMN_HEADER);

Related

How can I add text to a document footer using OpenXML?

I have a document template that I want to append some text to the footer. I've seen ways of deleting the footer to replace it, and ways to replace text in the footer, but I want to keep the footer as is from the template and just add to it. I have code to add text to the main doc., but unfortunately, main doc. parts are not setup the same way as footer parts. This is easily accomplished in Interop by a range.InsertAfter(text), but end users need this to work sans Word.
FooterPart footer = _doc.MainDocumentPart.FooterParts.ElementAtOrDefault(0);
string rid = _doc.MainDocumentPart.GetIdOfPart(footer);
footer = _doc.MainDocumentPart.AddNewPart<FooterPart>(rid);
Paragraph para = footer.AddPart(new Paragraph(), rid);
Run run = para.AppendChild(new Run());
// get the last footer of the document
FooterPart footerPart = _doc.MainDocumentPart.FooterParts.LastOrDefault();
// create your paragraph. i created simple, but you will need to add style properties to the run or text class
Paragraph pr = new Paragraph(new Run(new Text("hello")));
// Insert the Paragraph to the end of the footer in footerPart.Footer
footerPart.Footer.AppendChild(pr);
Other way as you said would be putting a text to replace like "txttoreplace" and then you will find it and replace
IEnumerable<FooterPart> footerPartsList = Documento.MainDocumentPart.FooterParts.ToList();
foreach (FooterPart hp in footerPartsList)
foreach (Text text in hp.RootElement.Descendants<Text>())
{
if (text.Text.Contains("txttoreplace"))
{
text.Text = text.Text.Replace("txttoreplace", "new text");
}
}
And another way and the hardest would be, you inser the whole footer, with open xml productivity tools you get the c# code of the footer.xml, and then you delete the footer of the document and you insert.

TinyMCE 6 - How remove selected text from TinyMCE editor

Goal: Get selected element into another element and remove selected text from existing element then place the new element where the text previously existed but as a new element.
Get the selected text:
selectedText = tinymce.activeEditor.selection.getContent()
Create new element with selected text:
newTextNode = tinymce.activeEditor.dom.create('span', {class: value}, selectedText);
Now i need to remove the selected text from the element and place it as the new element exactly where it was before.
How do i do that?

How to put variable text and custom text together in flutter

If there is an inherited variable called id, I would like to display widget.index and ": problem number" together on one line on the screen.
ex)
problem(text) 1(list variable)
problem(text) 2(list variable)
Is there a way to get a variable in a list like the one above and display it on the screen along with text?
You can use $ in a string
String someString = 'problem id: ${problem(text)} and widget index :${widget.index}';

Check value of last line selected - vscode-api

I'm trying to figure out how to see if the active editor's last line that's selected contains any characters/text excluding spaces. The purpose of this is to identify if there are any text highlighted and if not then to go back up a number in the editor and not include that line.
I know that you can do this
const editor = vscode.window.activeTextEditor
const lastLineSelected = editor.selection.end
in order to get the last line number, but how can I evaluate the text that's highlighted in that line?
If I understand correctly, you want to get the text of the last line of a selection which may be multi-line. The below does that, with a check in case the only selected line is partially selected.
const editor = vscode.window.activeTextEditor;
const selection = editor.selection;
if (selection && !selection?.isEmpty) {
// is more than one line selected, if so use 0 as the start of the selection on the last line
// otherwise use the actual first character selected on that line
const firstSelectedCharacterOnLastLine = (selection.start.line < selection.end.line) ? 0 : selection.start.character;
// make a Range to use with getText(<some Range>)
const lastLineOfSelectionRange = new vscode.Range(selection.end.line, firstSelectedCharacterOnLastLine, selection.end.line, selection.end.character);
const text = editor.document.getText(lastLineOfSelectionRange);
// do your testing on the text using javascript String methods
// like text.search(/[^\s]/) search for any non-whitespace character
}

How to implement text wrapping in group by column header layer in nattable

I want to implement text wrapping in heading titles.I also have group by layer added on top column header layer
Text wrapping is not working in group by header region with below configuration.How to implement text wrapping in this scenario
// Column header layer
this.colGrpModel = new ColumnGroupModel();
this.colHeaderLayr =
new ColumnHeaderLayer(this.colHeaderDataLayr, this.bodyLayr, this.bodyLayr.getSelectionLayer());
this.colGrpHeaderLayer =
new ColumnGroupHeaderLayer(this.colHeaderLayr,
this.bodyLayr.getSelectionLayer(), this.colGrpModel, false);
this.colGrpHeaderLayer.setCalculateHeight(true);
// Composite layer
CompositeLayer compositeGridLayer = new CompositeLayer(1, 2);
//Group by header layer
this.groupByHeaderLayer = new GroupByHeaderLayer(groupByModel, this.paramFilterGridLayer,
this.filterGridLayer.getColumnHeaderDataProvider());
compositeGridLayer.setChildLayer(GroupByHeaderLayer.GROUP_BY_REGION, this.groupByHeaderLayer, 0, 0);
compositeGridLayer.setChildLayer("Grid", this.filterGridLayer, 0, 1);
This is the groupBy configuration:
configRegstry.registerConfigAttribute(
GroupByConfigAttributes.GROUP_BY_CHILD_COUNT_PATTERN, "[{0}] - ({1})");
configRegstry.registerConfigAttribute(
GroupByConfigAttributes.GROUP_BY_HINT, "Drag columns here");
// To implement text wrapping in group by header region
configRegstry.registerConfigAttribute(
CellConfigAttributes.CELL_PAINTER,
new TextPainter(true, true, 2),
DisplayMode.NORMAL,
GroupByHeaderLayer.GROUP_BY_REGION);
Short answer: This is currently not supported.
Long answer:
You are misunderstanding several things.
Text wrapping means that a new line is added dynamically if there is not enough space in a cell. Since the GroupByHeader is actually one cell that spans the whole width, the cell width will never exceed to force text wrapping.
The TextPainter is a ICellPainter, so it is used to render cells.
The GroupByHeader (although a spanned cell) does not use the default cell painter. It uses the special GroupByHeaderPainter as it needs to inspect the GroupByModeland render fragments for each entry. That painter does currently not support line wrapping. And it does not use other ICellPainter internally.
That means, if you need to support line wrapping in the GroupByHeader you need to extend the GroupByHeaderPainter. As an open source project we like contributions. :)
If you want to add some sort of text wrapping in the GroupByHeader, you somehow need to specify when a text should be wrapped.