How to adjust the width of master details screen ratio in Eclipse RCP? - eclipse

I am using MasterDetailsBlock on my FormPage. I would like to adjust the screen width for the master and details part of the form. I had been searching around and haven't found a way to do it. The documentation seems to suggest it is doable through the SashForm, but I do not see how.
It will be great if I can use percentage ratio, like the FormAttachment style, but if that is not possible..I'm ok to fix the master and details to specific pixel also.

Just use SashForm.setWeights(int[]) to modify the weights of the master and the detail in the MasterDetailsBlock.
The weights describe the size ratio of the SashForm's parts. {1, 2} for examble would make the detail twice as wide as the master.

In your MasterDetailBlock class, override the registerPage() method, set your all detail pages, then call sashform.setweights(int [])
Example:
protected void registerPages(DetailsPart part) {
part.registerPage(MemoryBudgetImpl.class, new MemoryBudgetDetailPage());
sashForm.setWeights(new int[]{1,3});
}

Related

How to prevent TextField widget's cursor from jittering? - Flutter

https://imgur.com/X2gEMqO
Check out the video to see what I'm talking about ⤴
Before I start making custom widgets I wanted to see if anyone knew a way to fix this with vanilla Flutter. It seems to be something related to the TextEditingController but I'm not entirely sure.
When the TextField is set to centre or right align it seems to work just fine, but when on left / start / justify it always seems to have that slight jitter.
Thanks in advance! ~ I may post this to the Github repository as well
Edit: You can see that the cursor jitters only when it moves to the left of the textfield. When it is moving within the string it does not jitter at all. I was testing this on a simulated iPhone 11
This problem has two parts to it. First, the cursorOffset of the text_field.dart for whatever reason has a negative x value.
This causes the cursor to be jammed into it's container making the width look weird. Second, the TextStyle.height property causes the cursor to jump.
I figured out how to fix this thanks to Pavel!
TextField - Font Size 50.0 / Height 1.30
https://imgur.com/gallery/G9bkcIf
TextField - Font Size 20.0 / Height 1.30
https://imgur.com/gallery/x7a5nzM
Fix Cursor Offset
The cursorOffset value is stored within the text_field.dart file. In
order to edit it, you should probably create a duplicate of the
text_field.dart file to customize. Here's how to do that,
although you might find better answers with a Google
Once you have the file ready to edit navigate to cursorOffset
within TargetPlatform.iOS. It should be around line 924-ish if
your file is unmodified.
Change the values of Offset(...) to 0 & 0 (x, y) respectively or
whatever you think is appropriate.
If you duplicated the text_field.dart file correctly then it should
be working right away!
Fix Cursor Jump
This fix is a lot less work. Simply add in a TextStyle widget to the
style: property of a TextField widget.
Then, just fill in the height property of your TextStyle widget
with whatever you think! I found 1.3 was a good median but pick the
best height for your fontSize. Here's some information on
height:
Github Issue Regarding This
https://github.com/flutter/flutter/issues/31661

Unity ScrollView with multiline string Content height adaption

So, I have a growing string with many "\n". Every app start I will load the total string and every app use some new lines will be added.
The string is inside the Content of a ScrollView. But the Content size is not scaling with the string length. I want the Content to be exactly as high as the text lines go and be scrollable.
I can think of calculating the line count and set the content height manually. But maybe there is a more simple way? Please tell me your solutions.
I found a convenient non-code answer myself. You put the Text-Component directly on your Content GameObject. Then you use a ContentSizeFitter and set Vertical: Preferred. Also the Content anchors have to be set for variable height.
This enables me to dynamically set and scroll through a different text length with a ScrollView. (The font size is kept, to still fit the rest of the GUI)
I am still open for other answers.

Is there way to set detailRowHeight prop to 100% in ag-grid?

Recently started working on a master detail structure angular ag-grid. The structure has two levels of master-detail nesting. I need to fix the heights of inner - 2 grids such that they occupy all available real estate on the screen. Currently, ag-grid defaults it to 300 px and a lot of whitespace or unused space appears on a 1920x1200 screen resolution monitor. I also need to have fixed headers for all grids.
Any ideas or pointers would be appreciated...
Update: Referring to a forked version of plunker example from ag-grid here - https://next.plnkr.co/edit/yUzo4EqONEmgCmIw This is simple and basic set up for master-detail grid.
Note that: I haven't set any detail row height and have setup just one record to show up in the grid to test for the issue.
If you run the plunker code and view the result in separate window, notice that the inner / child grid doesn't occupy all the space available below it. In other words, it doesn't take as much as space/height available from parent container (master's detail row). The default 300px master detailRowHeight is making height fixed for inner grid. Also, from documentation, detailRowHeight prop doesn't seem to take something similar as 100% or 100vh and only takes fixed pixels number. Added a picture of the example below and the height / unused space I referred
We have different resolutions that users use to view data in grid and the heights of inner grids need to auto-adjust taking max. available space to show most information in the grids.
You could try something like this, I pulled it from the documentation:
In your component.ts file add this method. If it's a detail row it will apply different calculations than the other rows.
public rowHeight(params) {
if (params.node && params.node.detail) {
var offset = 80;
var allDetailRowHeight = params.data.callRecords.length * 28;
return allDetailRowHeight + offset;
} else {
// otherwise return fixed master row height
return 25;
}
};
In your template add the following: [getRowHeight]="rowHeight"
<ag-grid-angular
#agGrid
style="width: 100%; height: 100%;"
id="myGrid"
class="ag-theme-balham"
[columnDefs]="columnDefs"
[masterDetail]="true"
[detailCellRendererParams]="detailCellRendererParams"
[getRowHeight]="rowHeight"
[rowData]="rowData"
(gridReady)="onGridReady($event)"
></ag-grid-angular>
Hopefully this will get you moving forward. Good Luck!
https://www.ag-grid.com/javascript-grid-master-detail/#detail-row-height
So I don't have a great, full solution for you but as a starting point I would use CSS to override the styles ag-grid is setting - I don't think detailRowHeight is going to help.
Here's my plunk getting close to what you want with some simple CSS I put in index.html. You can use !important to override ag-grid styles, or you could use javascript to set the CSS after ag-grid does. I prefer !important in this case and don't have to worry about timing.
https://next.plnkr.co/edit/mmXBBJE5Wa1JrX7v
The problem I wasn't going to get into is getting it to dynamically fill up available space, depending on the row selected, scroll position, etc. I can't think of any simple way to achieve that - I do this type of thing in grid often and end up writing javascript to calculate the available space, and then set the CSS in javascript.
In ag-grid you have the possibility to set auto height for details.
Set grid property detailRowAutoHeight=true to have the detail grid to dynamically change it's height to fit it's rows.
const gridOptions = {
// dynamically set row height for all detail grids
detailRowAutoHeight: true,
// other grid options ...
}
However if you are providing your own detail component...
detailCellRenderer: 'MyOwnDetailsComponent',
then, it might not work and you will still need to provide an grid options height detail content through...
detailRowHeight: 560,
Please see the ag-grid documentation here

Mapbox - mapbox-gl-compare options

Does the mapbox-gl-compare plugin have any options for controlling the initial position of div.mapboxgl-compare? By default it is a split view 50/50. But I would like it load full position to the left? Hiding the second map.
Or does someone know to approach this?
GitHub - mapbox-gl-compare
If you take a look at the source, function o(t, e, n) { } (which initialises the plugin) contains the following setting: this._setPosition(this._bounds.width / 2).
You'll be able to edit this to fit your needs.

stretch a textField to a max height in jasper reports

I think this is more of a general issue. I would like to use a textfield that gets dynamic data and doesn't stretch more than a given max height. For instance, I have a textfield that, if it gets text that fits in one line, the textfield will be one line height, and i have other elements under it, that will move up with float positioning. Or, if I want a 3 line max height and if the text exceeds that space, then the rest will be trimmed.
I don't want to use java expressions to trim that text, as it is not always accurate. I am new to jasper and I am trying to know if there is any way to do this. I did a lot of searches, but maybe there is something that i missed, and i hope someone can help me. Thank you
I managed to solve this by extending net.sf.jasperreports.engine.fill.TextMeasurer and overriding initialize() method; also I had to extend net.sf.jasperreports.engine.util.AbstractTextMeasurerFactory and override the createMeasurer() method.
Now, whenever I want to have max # of lines, with no overflow, I add a property to that text field (e.g. maxLines) which is being passed to my custom TextMeasurerFactory. I hope this helped you.
We had a similar problem at work with JASPER Reports 4.5, where we had an invoice with a header and a table. We wanted the header to have dynamic height based on the lengths of certain fields (like address, partner name, etc,), but not more than a critical limit, otherwise the header will push the table and thus making a mess by splitting it across multiple pages. Also, the invoice shouldn't exceed 1 page.
We eventually had to move the header in the background section, where we also put a background for the table consisting of vertical lines (so it will extend to the end of an A4 page) and a white opaque square.
This way, if the header exceeds the max height it will go underneath the table's background, cropping the text. This was the desired effect we were looking for.
Sounds crazy, but it worked ...