Example usage for org.eclipse.jface.resource JFaceResources getHeaderFont

List of usage examples for org.eclipse.jface.resource JFaceResources getHeaderFont

Introduction

In this page you can find the example usage for org.eclipse.jface.resource JFaceResources getHeaderFont.

Prototype

public static Font getHeaderFont() 

Source Link

Document

Returns the JFace's header font.

Usage

From source file:com.bdaum.zoom.ui.internal.dialogs.CategorizeDialog.java

License:Open Source License

protected void createImageArea() {
    Composite imageArea = new Composite(comp, SWT.NONE);
    imageArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    imageArea.setLayout(new GridLayout(1, false));
    Label imageLabel = new Label(imageArea, SWT.NONE);
    imageLabel.setFont(JFaceResources.getHeaderFont());
    imageLabel.setText(Messages.CategorizeDialog_image);
    imageCanvas = new Canvas(imageArea, SWT.BORDER);
    GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
    layoutData.widthHint = 350;//from ww w.  j ava 2  s .c  o m
    layoutData.heightHint = 450;
    imageCanvas.setLayoutData(layoutData);
    imageCanvas.addPaintListener(new PaintListener() {
        @Override
        public void paintControl(PaintEvent e) {
            Image image = imageCache.getImage(currentAsset);
            imageBounds = image.getBounds();
            int imageSize = Math.max(imageBounds.width, imageBounds.height);
            Rectangle clientArea = imageCanvas.getClientArea();
            GC gc = e.gc;
            gc.fillRectangle(clientArea);
            int canvasSize = Math.max(10, Math.min(clientArea.width, clientArea.height) - 2 * MARGINS);
            double factor = (double) Math.min(320, canvasSize) / imageSize;
            int destWidth = (int) (imageBounds.width * factor);
            int destHeight = (int) (imageBounds.height * factor);
            int destX = (clientArea.width - destWidth) / 2;
            int destY = (Math.min(350, clientArea.height) - destHeight) / 2;
            gc.drawImage(image, 0, 0, imageBounds.width, imageBounds.height, destX, destY, destWidth,
                    destHeight);
            currentRegions = null;
            if (showRegions > 0) {
                Color color = gc.getForeground();
                currentRegions = UiUtilities.drawRegions(gc, currentAsset, destX, destY, destWidth, destHeight,
                        true, showRegions, true, null);
                gc.setForeground(color);
            }
            if (newFaces != null) {
                Color color = gc.getForeground();
                gc.setForeground(e.display.getSystemColor(SWT.COLOR_GREEN));
                for (Rectangle rectangle : newFaces) {
                    int fWidth = (int) (rectangle.width * factor);
                    int fHeight = (int) (rectangle.height * factor);
                    int fx = (int) (rectangle.x * factor);
                    int fy = (int) (rectangle.y * factor);
                    gc.drawRectangle(fx + destX, fy + destY, fWidth, fHeight);
                }
                gc.setForeground(color);
            }
            StringBuilder sb = new StringBuilder();
            String title = currentAsset.getTitle();
            if (title == null || title.isEmpty())
                title = currentAsset.getName();
            sb.append(title).append('\n');
            String headline = currentAsset.getHeadline();
            if (headline != null && !headline.isEmpty())
                sb.append(headline).append('\n');
            String description = currentAsset.getImageDescription();
            if (description != null && !description.isEmpty())
                sb.append(description).append('\n');
            String[] keyword = currentAsset.getKeyword();
            if (keyword != null && keyword.length > 0)
                sb.append(Core.toStringList(keyword, ", ")).append('\n'); //$NON-NLS-1$
            sb.append("\n\n").append(NLS.bind(Messages.CategorizeDialog_x_of_y, current + 1, size)); //$NON-NLS-1$
            textLayout.setWidth(destWidth);
            textLayout.setText(sb.toString());
            textLayout.draw(gc, destX, destY + destHeight + MARGINS, -1, -1, null, null);
            String safety = QueryField.SAFETY.value2text(QueryField.SAFETY.obtainFieldValue(currentAsset), ""); //$NON-NLS-1$
            Point tx = gc.textExtent(safety);
            gc.drawText(safety, clientArea.width - tx.x - 5, clientArea.height - tx.y - 5, true);

        }
    });
    imageCanvas.addKeyListener(this);
    CGroup subImageArea = UiUtilities.createGroup(imageArea, 2, Messages.CategorizeDialog_settings);
    if (aiService != null)
        faceButton = WidgetFactory.createCheckButton(subImageArea, Messages.CategorizeDialog_use_new_faces,
                new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    new Label(subImageArea, SWT.NONE).setText(Messages.CategorizeDialog_new_description);
    descriptionField = new CheckedText(subImageArea, SWT.WRAP);
    GridData ldata = new GridData(SWT.FILL, SWT.CENTER, true, false);
    ldata.heightHint = 30;
    descriptionField.setLayoutData(ldata);
    new Label(subImageArea, SWT.NONE).setText(Messages.CategorizeDialog_privacy);
    newPrivacyGroup = new RadioButtonGroup(subImageArea, null, SWT.HORIZONTAL, Messages.CategorizeDialog_public,
            Messages.CategorizeDialog_medium, Messages.CategorizeDialog_private);
    newPrivacyGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
}

From source file:com.bdaum.zoom.ui.internal.dialogs.CollectionEditDialog.java

License:Open Source License

private Control createGeneralGroup(Composite parent) {
    Composite generalComp = new Composite(parent, SWT.NONE);
    generalComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    if (!adhoc) {
        generalComp.setLayout(new GridLayout(2, false));
        if (isSystem) {
            nameField = new Label(generalComp, SWT.NONE);
            nameField.setFont(JFaceResources.getHeaderFont());
            GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1);
            data.widthHint = 150;/*w  ww .  j av a  2  s  .  c o  m*/
            nameField.setLayoutData(data);
            if (current != null)
                ((Label) nameField).setText(current.getName());
        } else {
            new Label(generalComp, SWT.NONE).setText(Messages.CollectionEditDialog_name);
            nameField = new Text(generalComp, SWT.BORDER);
            GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false);
            data.widthHint = 150;
            nameField.setLayoutData(data);
            if (current != null)
                ((Text) nameField).setText(current.getName());
            ((Text) nameField).addModifyListener(new ModifyListener() {
                public void modifyText(ModifyEvent e) {
                    updateButtons();
                }
            });
            nameField.setEnabled(!readonly);
        }
        if (current == null || !isSystem || current.getAlbum()
                || current.getStringId().equals(Constants.LAST_IMPORT_ID)
                || current.getStringId().startsWith(IDbManager.IMPORTKEY)) {
            boolean showDescription = current == null
                    || current.getDescription() != null && !current.getDescription().isEmpty();
            if (isSystem) {
                if (showDescription) {
                    if (album) {
                        descriptionField = new StyledText(generalComp, SWT.READ_ONLY | SWT.MULTI | SWT.WRAP);
                        ((StyledText) descriptionField).setText(current.getDescription());
                        descriptionField.addMouseListener(new MouseAdapter() {
                            @Override
                            public void mouseDoubleClick(MouseEvent e) {
                                detectAndHandleHyperlink();
                            }
                        });
                    } else
                        ((Label) (descriptionField = new Label(generalComp, SWT.WRAP)))
                                .setText(current.getDescription());
                }
            } else {
                if (!readonly || showDescription) {
                    new Label(generalComp, SWT.NONE).setText(Messages.CollectionEditDialog_description);
                    descriptionField = new CheckedText(generalComp,
                            SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
                    if (current != null)
                        ((CheckedText) descriptionField).setText(current.getDescription());
                    descriptionField.setEnabled(!readonly);
                }
            }
            if (descriptionField != null) {
                GridData data = new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1);
                data.widthHint = 240;
                data.heightHint = 50;
                descriptionField.setLayoutData(data);
            }
        }
        new Label(generalComp, SWT.NONE).setText(Messages.CollectionEditDialog_color_code);
        colorCodeButton = new Button(generalComp, SWT.PUSH);
        if (current != null)
            colorCode = current.getColorCode() - 1;
        colorCodeButton.setImage(Icons.toSwtColors(colorCode));
        colorCodeButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                ColorCodeDialog dialog = new ColorCodeDialog(getShell(), colorCode);
                dialog.create();
                dialog.getShell().setLocation(colorCodeButton.toDisplay(0, 0));
                int code = dialog.open();
                if (code >= Constants.COLOR_UNDEFINED)
                    colorCodeButton.setImage(Icons.toSwtColors(colorCode = code));
            }
        });
    } else {
        generalComp.setLayout(new GridLayout());
        new Label(generalComp, SWT.NONE).setText(Messages.CollectionEditDialog_adhoc_hint);
        Composite findComp = new Composite(generalComp, SWT.NONE);
        findComp.setLayout(new GridLayout());
        findWithinGroup = new FindWithinGroup(findComp);
        findWithinGroup.addListener(new Listener() {
            @Override
            public void handleEvent(Event event) {
                collectionEditGroup.prepare(findWithinGroup.getParentCollection());
            }
        });
    }
    if (networkPossible) {
        Composite netComp = new Composite(generalComp, SWT.NONE);
        netComp.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 2, 1));
        netComp.setLayout(new GridLayout());
        findInNetworkGroup = new FindInNetworkGroup(netComp);
        if (current != null)
            findInNetworkGroup.setSelection(current.getNetwork());
        findInNetworkGroup.addListener(new Listener() {
            @Override
            public void handleEvent(Event event) {
                collectionEditGroup.setNetworked(findInNetworkGroup.getSelection());
            }
        });
    }
    return generalComp;
}

From source file:com.bdaum.zoom.ui.internal.dialogs.EditMetaDialog.java

License:Open Source License

private void createWelcomeGroup(CTabFolder folder) {
    final Composite composite = createTabPage(folder, Messages.EditMetaDialog_welcome,
            Messages.EditMetaDialog_welcome_tooltip, 1);
    Composite comp = new Composite(composite, SWT.NONE);
    comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    GridLayout layout = new GridLayout(1, false);
    layout.marginWidth = 50;/* w w w . j a  va 2s.c  o m*/
    layout.marginHeight = 100;
    comp.setLayout(layout);
    Label label = new Label(comp, SWT.WRAP);
    label.setFont(JFaceResources.getHeaderFont());
    label.setAlignment(SWT.CENTER);
    label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    label.setText(Messages.EditMetaDialog_you_have_opted);
    if (previousMeta != null) {
        initButtonGroup = new RadioButtonGroup(comp, Messages.EditMetaDialog_initial_values, SWT.NONE,
                Messages.EditMetaDialog_default_values, Messages.EditMetaDialog_copy_values);
        initButtonGroup.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
        initButtonGroup.setSelection(1);
    }
}

From source file:com.bdaum.zoom.ui.internal.dialogs.StartupDialog.java

License:Open Source License

@SuppressWarnings("unused")
@Override/*from   ww w. j  a v a  2 s . c  o  m*/
protected Control createDialogArea(Composite parent) {
    getShell().setText(Messages.StartupDialog_Catalog_selection);
    Composite composite = (Composite) super.createDialogArea(parent);
    Label noActiveCatalogLabel = new Label(composite, SWT.WRAP);
    noActiveCatalogLabel.setFont(JFaceResources.getHeaderFont());
    noActiveCatalogLabel
            .setText(withPrompt ? Messages.StartupDialog_please_select : Messages.StartupDialog_No_active_cat);
    noActiveCatalogLabel.setLayoutData(new GridData(SWT.CENTER, SWT.BEGINNING, true, false));
    new Label(composite, SWT.NONE);
    return composite;
}

From source file:com.drgarbage.bytecodevisualizer.editors.NoSourceViewer.java

License:Apache License

public void propertyChange(PropertyChangeEvent event) {

    for (Label l : fBannerLabels) {
        l.setFont(JFaceResources.getBannerFont());
    }/* w  w  w . j  a  v  a2  s .c  o m*/

    for (Label l : fHeaderLabels) {
        l.setFont(JFaceResources.getHeaderFont());
    }

    fComposite.layout(true);
    fComposite.redraw();
}

From source file:com.drgarbage.bytecodevisualizer.editors.NoSourceViewer.java

License:Apache License

private Label createTitleLabel(Composite parent, String text) {
    Label label = new Label(parent, SWT.NONE);
    if (text != null)
        label.setText(text);/*from   w  w  w. ja v a  2 s  .  c o m*/
    label.setBackground(fBackgroundColor);
    label.setForeground(fForegroundColor);
    label.setFont(JFaceResources.getHeaderFont());
    fHeaderLabels.add(label);
    return label;
}

From source file:com.ibm.xsp.extlib.designer.bluemix.manifest.editor.AbstractManifestEditorPage.java

License:Open Source License

public AbstractManifestEditorPage(Composite parent, FormToolkit toolkit, ManifestMultiPageEditor mpe) {
    super(parent, SWT.NONE);
    _mpe = mpe;/*from www . j a v  a 2  s  .  c o m*/
    _toolkit = toolkit;
    _errorImage = getDisplay().getSystemImage(SWT.ICON_ERROR);
    _errorFont = JFaceResources.getDefaultFont();
    _titleFont = JFaceResources.getHeaderFont();
    initialize();
}

From source file:com.ibm.xsp.extlib.designer.xspprops.XSPEditorUtil.java

License:Open Source License

static public CLabel createCLabel(Composite parent, String label, int hSpan) {
    CLabel pgTitle = new CLabel(parent, SWT.NONE);
    pgTitle.setText(label);/*from  ww  w. jav  a2s  . c  o  m*/
    pgTitle.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    pgTitle.setFont(JFaceResources.getHeaderFont());
    GridData titleGridData = new GridData();
    titleGridData.grabExcessHorizontalSpace = true;
    titleGridData.horizontalSpan = hSpan;
    pgTitle.setLayoutData(titleGridData);
    return pgTitle;
}

From source file:com.nokia.carbide.internal.discovery.ui.editor.NavigationBar.java

License:Open Source License

NavigationBar(PortalEditor portalEditor, Composite parent) {
    super(parent, portalEditor.getBackgroundParent(), null, null);
    this.portalEditor = portalEditor;
    buttonToPageMap = new LinkedHashMap<Button, PortalPage>();
    FillLayout layout = new FillLayout(SWT.HORIZONTAL);
    layout.spacing = BUTTON_SPACING;//w  w w  .ja  v  a 2 s  . c  om
    layout.marginHeight = BUTTON_SPACING;
    layout.marginWidth = BUTTON_SPACING;
    setLayout(layout);
    listener = new ButtonListener();
    selectedButtonFont = JFaceResources.getHeaderFont();
    FontData[] fontData = selectedButtonFont.getFontData();
    for (FontData fd : fontData) {
        fd.setStyle(SWT.NORMAL);
    }
    FontDescriptor desc = FontDescriptor.createFrom(fontData);
    buttonFont = portalEditor.createFont(desc);
}

From source file:com.windowtester.eclipse.ui.updater.UpdateDialog.java

License:Open Source License

@SuppressWarnings("deprecation")
@Override/*  w ww . j ava 2 s.  c o m*/
protected void createFormContent(IManagedForm mform) {
    ScrolledForm form = mform.getForm();
    Composite body = form.getBody();

    FormToolkit toolkit = mform.getToolkit();
    TableWrapLayout layout = new TableWrapLayout();
    layout.numColumns = 2;
    layout.horizontalSpacing = 15;
    layout.topMargin = 10;

    Image image = getImage();
    Label imageLabel = new Label(body, SWT.NULL);
    imageLabel.setImage(image);
    imageLabel.setBackground(form.getBackground());

    FormText formText = toolkit.createFormText(body, true);

    body.setLayout(layout);
    formText.setText(getFormText(), true, true);
    formText.addHyperlinkListener(new HyperlinkAdapter() {
        public void linkActivated(HyperlinkEvent e) {
            hrefPressed(e.getHref());
            //            helpPressed();
        }
    });
    formText.setColor("header", toolkit.getColors().getColor(FormColors.TITLE));
    formText.setFont("header", JFaceResources.getHeaderFont());
}