use of org.eclipse.swt.graphics.FontData in project ACS by ACS-Community.
the class AlarmsView method sortCategoryList.
public void sortCategoryList(String name) {
_ffCategoryList.removeAll();
List<Category> catList = _categoryManager.getAllCategories();
List<String> sortedCatList = new ArrayList<String>();
for (Category cat : catList) sortedCatList.add(cat.getPath().toLowerCase());
Collections.sort(sortedCatList);
for (String sc : sortedCatList) {
Category cat = null;
for (Category c : catList) if (c.getPath().toLowerCase().compareTo(sc) == 0)
cat = c;
if (cat == null)
return;
if (cat.getAlarms() == null) {
TableItem t = new TableItem(_ffCategoryList, SWT.None);
t.setText(cat.getPath());
if (cat.getIsDefault()) {
FontData fd = t.getFont().getFontData()[0];
fd.setStyle(SWT.BOLD);
t.setFont(new Font(_shell.getDisplay(), fd));
}
} else {
String[] ffs = cat.getAlarms().getFaultFamily();
TableItem t = new TableItem(_ffCategoryList, SWT.None);
t.setText(cat.getPath());
if (cat.getIsDefault()) {
FontData fd = t.getFont().getFontData()[0];
fd.setStyle(SWT.BOLD);
t.setFont(new Font(_shell.getDisplay(), fd));
}
for (int i = 0; i < ffs.length; i++) {
if (ffs[i].compareTo(name) == 0)
t.setImage(Activator.getDefault().getImageRegistry().get(Activator.IMG_TICKET));
}
}
}
}
use of org.eclipse.swt.graphics.FontData in project cubrid-manager by CUBRID.
the class ERDirectEditManager method initCellEditor.
protected void initCellEditor() {
getCellEditor().setValue(label.getText());
getCellEditor().setValidator(validator);
FontData fontData = label.getFont().getFontData()[0];
Dimension fontSize = new Dimension(0, fontData.getHeight());
label.translateToAbsolute(fontSize);
fontData.setHeight(fontSize.height);
Text text = (Text) getCellEditor().getControl();
text.setFont(new Font(null, fontData));
text.setRedraw(true);
text.setVisible(true);
}
use of org.eclipse.swt.graphics.FontData in project cubrid-manager by CUBRID.
the class QueryPropertyComposite method createContent.
/**
* create the content.
*
*/
private void createContent() {
setLayout(new GridLayout());
setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
final Group autocommitGroup = new Group(this, SWT.NONE);
final GridData gdAutocommitGroup = new GridData(SWT.FILL, SWT.CENTER, true, false);
autocommitGroup.setLayoutData(gdAutocommitGroup);
autocommitGroup.setLayout(new GridLayout());
autocommitBtn = new Button(autocommitGroup, SWT.CHECK);
final GridData gdAutocommitBtn = new GridData(SWT.FILL, SWT.CENTER, true, false);
autocommitBtn.setLayoutData(gdAutocommitBtn);
autocommitBtn.setText(Messages.autoCommitLabel);
final Group groupFirst = new Group(this, SWT.NONE);
groupFirst.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
final GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
groupFirst.setLayout(gridLayout);
searchUnitBtn = new Button(groupFirst, SWT.CHECK);
final GridData gdSearchUnitBtn = new GridData(SWT.LEFT, SWT.CENTER, true, false);
searchUnitBtn.setLayoutData(gdSearchUnitBtn);
searchUnitBtn.setText(Messages.searchUnitInstances);
searchUnitBtn.addSelectionListener(new SelectionAdapter() {
/**
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
* @param event an event containing information about the selection
*/
public void widgetSelected(SelectionEvent event) {
unitCountSpinner.setEnabled(searchUnitBtn.getSelection());
}
});
unitCountSpinner = new Spinner(groupFirst, SWT.BORDER);
unitCountSpinner.setMaximum(2147483647);
final GridData gdUnitCountSpinner = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
gdUnitCountSpinner.widthHint = 129;
unitCountSpinner.setLayoutData(gdUnitCountSpinner);
unitCountSpinner.setIncrement(100);
final Label label = new Label(groupFirst, SWT.NONE);
label.setText(Messages.pageUnitInstances);
pageUnitCountSpinner = new Spinner(groupFirst, SWT.BORDER);
pageUnitCountSpinner.setMaximum(2147483647);
final GridData gdPageUnitSpinner = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
gdPageUnitSpinner.widthHint = 129;
pageUnitCountSpinner.setLayoutData(gdPageUnitSpinner);
pageUnitCountSpinner.setIncrement(10);
final Label lobSizeLabel = new Label(groupFirst, SWT.NONE);
lobSizeLabel.setText(Messages.lblLobLoadSize);
loadSizeSpinner = new Spinner(groupFirst, SWT.BORDER);
loadSizeSpinner.setMaximum(1024 * 1024);
final GridData gdlobSizeSpinner = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
gdlobSizeSpinner.widthHint = 129;
loadSizeSpinner.setLayoutData(gdPageUnitSpinner);
loadSizeSpinner.setIncrement(8);
multiPageConfirmBtn = new Button(groupFirst, SWT.CHECK);
multiPageConfirmBtn.setText(Messages.showMultiPageConfirm);
{
final GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
multiPageConfirmBtn.setLayoutData(gd);
}
keywordLowerBtn = new Button(groupFirst, SWT.CHECK);
keywordLowerBtn.setText(Messages.btnKeywordLowercase);
final GridData gdKeywordBtn = new GridData(GridData.FILL_HORIZONTAL);
gdKeywordBtn.horizontalSpan = 2;
keywordLowerBtn.setLayoutData(gdKeywordBtn);
autoNoUppercaseKeywordBtn = new Button(groupFirst, SWT.CHECK);
autoNoUppercaseKeywordBtn.setText(Messages.btnNoAutoUppercase);
final GridData gdAutoUppercaseKeywordBtn = new GridData(GridData.FILL_HORIZONTAL);
gdAutoUppercaseKeywordBtn.horizontalSpan = 2;
autoNoUppercaseKeywordBtn.setLayoutData(gdAutoUppercaseKeywordBtn);
withoutPromptSaveBtn = new Button(groupFirst, SWT.CHECK);
withoutPromptSaveBtn.setText(Messages.btnWithoutPromptSave);
final GridData gdPromptSaveBtn = new GridData(GridData.FILL_HORIZONTAL);
gdPromptSaveBtn.horizontalSpan = 2;
withoutPromptSaveBtn.setLayoutData(gdPromptSaveBtn);
useScientificNotationBtn = new Button(groupFirst, SWT.CHECK);
useScientificNotationBtn.setText(Messages.btnUseScientificNotation);
useScientificNotationBtn.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 2, 1, -1, -1));
final Group changeFontGroup = new Group(this, SWT.NONE);
changeFontGroup.setText(Messages.changeFont);
final GridData gdChangeFontGroup = new GridData(SWT.FILL, SWT.FILL, true, true);
changeFontGroup.setLayoutData(gdChangeFontGroup);
changeFontGroup.setLayout(new GridLayout());
final Group exampleGroup = new Group(changeFontGroup, SWT.NONE);
exampleGroup.setText(Messages.fontExample);
final GridData gdExmplaeGroup = new GridData(SWT.FILL, SWT.FILL, true, true);
exampleGroup.setLayoutData(gdExmplaeGroup);
exampleGroup.setLayout(new GridLayout());
fontExampleTxt = new Text(exampleGroup, SWT.CENTER | SWT.BORDER);
fontExampleTxt.setEditable(false);
fontExampleTxt.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, 30));
fontExampleTxt.setText("CUBRID");
Menu menu = new Menu(getShell(), SWT.POP_UP);
fontExampleTxt.setMenu(menu);
final Composite btnComposite = new Composite(changeFontGroup, SWT.NONE);
btnComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));
final GridLayout gridLayoutBtnComposite = new GridLayout();
gridLayoutBtnComposite.numColumns = 2;
btnComposite.setLayout(gridLayoutBtnComposite);
Button changeBtn = new Button(btnComposite, SWT.PUSH);
final GridData gdChangeBtn = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
changeBtn.setLayoutData(gdChangeBtn);
changeBtn.setText(Messages.change);
changeBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
FontDialog dlg = new FontDialog(getShell());
FontData fontdata = null;
if (fontString == null || fontString.trim().length() == 0) {
fontdata = new FontData();
String[] fontStr = QueryOptions.getDefaultFont();
fontdata.setName(fontStr[0]);
fontdata.setHeight(Integer.parseInt(fontStr[1]));
fontdata.setStyle(Integer.parseInt(fontStr[2]));
} else {
fontdata = new FontData(fontString);
}
FontData[] fontList = new FontData[1];
fontList[0] = fontdata;
dlg.setRGB(new RGB(fontColorRed, fontColorGreen, fontColorBlue));
dlg.setFontList(fontList);
fontdata = dlg.open();
if (fontdata != null) {
fontString = fontdata.toString();
RGB rgb = dlg.getRGB();
if (rgb != null) {
fontColorRed = rgb.red;
fontColorBlue = rgb.blue;
fontColorGreen = rgb.green;
}
changeExampleFont();
}
}
});
Button restoreBtn = new Button(btnComposite, SWT.PUSH);
restoreBtn.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
restoreBtn.setText(Messages.restoreDefault);
restoreBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
fontString = "";
FontData[] fData = Display.getDefault().getSystemFont().getFontData();
if (fData != null && fData.length > 0) {
fontString = fData[0].toString();
}
fontColorRed = 0;
fontColorGreen = 0;
fontColorBlue = 0;
changeExampleFont();
}
});
}
use of org.eclipse.swt.graphics.FontData in project ow by vtst.
the class SoyLabelProvider method getModifiedFontData.
private static FontData[] getModifiedFontData(FontData[] originalData, int additionalStyle) {
FontData[] styleData = new FontData[originalData.length];
for (int i = 0; i < styleData.length; i++) {
FontData base = originalData[i];
styleData[i] = new FontData(base.getName(), base.getHeight(), base.getStyle() | additionalStyle);
}
return styleData;
}
use of org.eclipse.swt.graphics.FontData in project dbeaver by serge-rider.
the class EmptyPresentation method createPresentation.
@Override
public void createPresentation(@NotNull final IResultSetController controller, @NotNull Composite parent) {
super.createPresentation(controller, parent);
UIUtils.createHorizontalLine(parent);
placeholder = new Canvas(parent, SWT.NONE);
placeholder.setLayoutData(new GridData(GridData.FILL_BOTH));
placeholder.setBackground(controller.getDefaultBackground());
final Font normalFont = parent.getFont();
FontData[] fontData = normalFont.getFontData();
fontData[0].setStyle(fontData[0].getStyle() | SWT.BOLD);
fontData[0].setHeight(18);
final Font largeFont = new Font(normalFont.getDevice(), fontData[0]);
placeholder.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
UIUtils.dispose(largeFont);
}
});
placeholder.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
if (controller.isRefreshInProgress()) {
return;
}
e.gc.setFont(largeFont);
UIUtils.drawMessageOverControl(placeholder, e, "No Data", -10);
e.gc.setFont(normalFont);
if (controller.getDataContainer() instanceof SQLEditor.QueryResultsContainer) {
String execQuery = ActionUtils.findCommandDescription(CoreCommands.CMD_EXECUTE_STATEMENT, controller.getSite(), true);
String execScript = ActionUtils.findCommandDescription(CoreCommands.CMD_EXECUTE_SCRIPT, controller.getSite(), true);
UIUtils.drawMessageOverControl(placeholder, e, "Execute query (" + execQuery + ") or script (" + execScript + ") to see results", 20);
}
}
});
trackPresentationControl();
}
Aggregations