Search in sources :

Example 36 with Font

use of org.eclipse.swt.graphics.Font in project tdi-studio-se by Talend.

the class FontProviderMapper method releaseFonts.

/**
     * DOC amaumont Comment method "release".
     */
public static void releaseFonts() {
    Collection<Font> fonts = fontsCache.values();
    for (Font font : fonts) {
        if (!font.isDisposed()) {
            font.dispose();
        }
    }
    fontsCache.clear();
}
Also used : Font(org.eclipse.swt.graphics.Font)

Example 37 with Font

use of org.eclipse.swt.graphics.Font in project tdi-studio-se by Talend.

the class LoginAgreementPage method createControl.

@Override
public void createControl(Composite parentCtrl) {
    Composite container = new Composite(parentCtrl, SWT.NONE);
    container.setLayout(new FormLayout());
    Label titleLabel = new Label(container, SWT.WRAP);
    titleLabel.setFont(LoginDialogV2.fixedFont);
    //$NON-NLS-1$
    titleLabel.setText(Messages.getString("LoginAgreementPage.title"));
    FormData titleLabelFormData = new FormData();
    titleLabelFormData.left = new FormAttachment(0, 0);
    titleLabelFormData.top = new FormAttachment(0, 0);
    titleLabel.setLayoutData(titleLabelFormData);
    acceptButton = new Button(container, SWT.CENTER);
    acceptButton.setBackground(backgroundColor);
    acceptButton.setFont(LoginDialogV2.fixedFont);
    //$NON-NLS-1$
    acceptButton.setText(Messages.getString("LoginAgreementPage.accept"));
    FormData acceptButtonFormLayoutData = new FormData();
    acceptButtonFormLayoutData.bottom = new FormAttachment(100, 0);
    acceptButtonFormLayoutData.right = new FormAttachment(100, 0);
    acceptButtonFormLayoutData.left = new FormAttachment(100, -1 * LoginDialogV2.getNewButtonSize(acceptButton).x);
    acceptButton.setLayoutData(acceptButtonFormLayoutData);
    boolean haveHtmlDesc = false;
    FileInputStream licenseInputStream = null;
    String licenseFileBasePath = Platform.getInstallLocation().getURL().getPath();
    if (Boolean.parseBoolean(System.getProperty("USE_BROWSER"))) {
        //$NON-NLS-1$
        File htmlFile = new File(licenseFileBasePath + LICENSE_FILE_PATH_HTML);
        if (htmlFile.exists()) {
            try {
                licenseInputStream = new FileInputStream(htmlFile);
                if (licenseInputStream != null) {
                    haveHtmlDesc = true;
                }
            } catch (FileNotFoundException e) {
                CommonExceptionHandler.process(e);
            }
        }
    }
    if (licenseInputStream == null) {
        try {
            licenseInputStream = new FileInputStream(licenseFileBasePath + LICENSE_FILE_PATH);
        } catch (FileNotFoundException e) {
            CommonExceptionHandler.process(e);
        }
    }
    FormData clufLayoutData = new FormData();
    clufLayoutData.top = new FormAttachment(titleLabel, LoginDialogV2.TAB_VERTICAL_PADDING_LEVEL_1, SWT.BOTTOM);
    clufLayoutData.left = new FormAttachment(0, 0);
    clufLayoutData.right = new FormAttachment(100, 0);
    clufLayoutData.bottom = new FormAttachment(acceptButton, -1 * LoginDialogV2.TAB_VERTICAL_PADDING_LEVEL_1, SWT.TOP);
    if (haveHtmlDesc) {
        clufBrowser = new Browser(container, SWT.BORDER);
        clufBrowser.setText(getLicense(licenseInputStream));
        clufBrowser.setLayoutData(clufLayoutData);
    } else {
        clufText = new Text(container, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL | SWT.LEFT | SWT.BORDER);
        clufText.setBackground(new Color(null, 255, 255, 255));
        //$NON-NLS-1$
        Font font = new Font(DisplayUtils.getDisplay(), "courier", 10, SWT.NONE);
        clufText.setFont(font);
        clufText.setEditable(false);
        clufText.setText(getLicense(licenseInputStream));
        clufText.setLayoutData(clufLayoutData);
    }
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) Color(org.eclipse.swt.graphics.Color) Label(org.eclipse.swt.widgets.Label) FileNotFoundException(java.io.FileNotFoundException) Text(org.eclipse.swt.widgets.Text) FileInputStream(java.io.FileInputStream) Font(org.eclipse.swt.graphics.Font) Button(org.eclipse.swt.widgets.Button) File(java.io.File) FormAttachment(org.eclipse.swt.layout.FormAttachment) Browser(org.eclipse.swt.browser.Browser)

Example 38 with Font

use of org.eclipse.swt.graphics.Font in project tdi-studio-se by Talend.

the class LibSelectionComposite method createControl.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
     */
public void createControl(Composite parent) {
    Font font = parent.getFont();
    // Composite comp = new Composite(parent, SWT.NONE);
    GridLayout topLayout = new GridLayout();
    topLayout.numColumns = 2;
    this.setLayout(topLayout);
    GridData gd;
    // Label label = new Label(this, SWT.NONE);
    // label.setText("Libraries Selection:");
    // gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    // gd.horizontalSpan = 2;
    // label.setLayoutData(gd);
    libListViewer = new LibListViewer(this);
    libListViewer.getControl().setFont(font);
    gd = new GridData(GridData.FILL_BOTH);
    // gd.horizontalSpan = 7;
    gd.heightHint = 100;
    gd.widthHint = 240;
    libListViewer.getControl().setLayoutData(gd);
    LibListProvider provider = new LibListProvider();
    libListViewer.setLabelProvider(provider);
    libListViewer.setContentProvider(provider);
    Composite pathButtonComp = new Composite(this, SWT.NONE);
    GridLayout pathButtonLayout = new GridLayout();
    pathButtonLayout.marginHeight = 0;
    pathButtonLayout.marginWidth = 0;
    pathButtonComp.setLayout(pathButtonLayout);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    // gd.horizontalSpan = 2;
    pathButtonComp.setLayoutData(gd);
    pathButtonComp.setFont(font);
    createPathButtons(pathButtonComp);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) LibListProvider(org.talend.componentdesigner.ui.composite.provider.LibListProvider) Font(org.eclipse.swt.graphics.Font)

Example 39 with Font

use of org.eclipse.swt.graphics.Font 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));
            }
        }
    }
}
Also used : Category(alma.acs.alarmsystem.generated.Category) TableItem(org.eclipse.swt.widgets.TableItem) FontData(org.eclipse.swt.graphics.FontData) ArrayList(java.util.ArrayList) Font(org.eclipse.swt.graphics.Font) Point(org.eclipse.swt.graphics.Point)

Example 40 with Font

use of org.eclipse.swt.graphics.Font 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);
}
Also used : FontData(org.eclipse.swt.graphics.FontData) Text(org.eclipse.swt.widgets.Text) Dimension(org.eclipse.draw2d.geometry.Dimension) Font(org.eclipse.swt.graphics.Font)

Aggregations

Font (org.eclipse.swt.graphics.Font)235 FontData (org.eclipse.swt.graphics.FontData)93 GridData (org.eclipse.swt.layout.GridData)52 Point (org.eclipse.swt.graphics.Point)51 Composite (org.eclipse.swt.widgets.Composite)50 GridLayout (org.eclipse.swt.layout.GridLayout)47 Color (org.eclipse.swt.graphics.Color)45 Label (org.eclipse.swt.widgets.Label)38 Test (org.junit.Test)26 GC (org.eclipse.swt.graphics.GC)22 Image (org.eclipse.swt.graphics.Image)22 Rectangle (org.eclipse.swt.graphics.Rectangle)22 Button (org.eclipse.swt.widgets.Button)19 Display (org.eclipse.swt.widgets.Display)19 SelectionEvent (org.eclipse.swt.events.SelectionEvent)17 Text (org.eclipse.swt.widgets.Text)16 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)15 StyledText (org.eclipse.swt.custom.StyledText)13 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)12 StyleRange (org.eclipse.swt.custom.StyleRange)11