Some strings on Chinese locale are truncated in SWT Label in Eclipse RAP on the first dialog opening

82 Views Asked by At

After reloading this effect disappears and labels are in their suitable sizes. This repeats only if the application is reloaded. On English locale, this dialog shows normally. Chinese text truncation

Example of code containing problem label:

private void createDailyGroup(Composite composite)
{
    m_typePanels[DAILY] = new Composite(composite, SWT.NONE);
    Composite panel = m_typePanels[DAILY];
    panel.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).create());
    panel.setLayoutData(GridDataFactory.fillDefaults().create());

    addRunTime(panel, DAILY);
}
 private void addRunTime(Composite panel, int scheduleType)
{
    Label runTimeLabel = new Label(panel, SWT.NONE);
    runTimeLabel.setText(QmfResources.getString(IDS_RUNTIME_LABEL));
    runTimeLabel.setLayoutData(GridDataFactory.fillDefaults().
        align(SWT.BEGINNING, SWT.CENTER).grab(false, false).create());
    m_runTimes.put(Integer.valueOf(scheduleType), new DateTime(panel, SWT.TIME | SWT.BORDER | SWT.SHORT));
    DateTime runTime = m_runTimes.get(Integer.valueOf(scheduleType));
    runTime.addSelectionListener(m_parametersChangeListener);
    runTime.setLayoutData(GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).create());
}
1

There are 1 best solutions below

1
Shashwat On

Try below code, here I am considering runTimeLabel is label where you want to add Chinese locale string

runTimeLabel.getParent().requestLayout();
runTimeLabel.getParent().redraw();
runTimeLabel.getParent().getParent().update();