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

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

Introduction

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

Prototype

String DEFAULT_FONT

To view the source code for org.eclipse.jface.resource JFaceResources DEFAULT_FONT.

Click Source Link

Document

The symbolic font name for the standard font (value "org.eclipse.jface.defaultfont").

Usage

From source file:eu.esdihumboldt.hale.ui.style.editors.MarkEditor.java

License:Open Source License

/**
 * Creates a {@link Mark} editor/* ww w.j a  v  a2  s .  c  om*/
 * 
 * @param parent the parent composite
 * @param mark the initial mark
 */
public MarkEditor(Composite parent, Mark mark) {
    if (mark == null) {
        mark = styleBuilder.createMark(StyleBuilder.MARK_SQUARE);
    }

    page = new Composite(parent, SWT.NONE);

    RowLayout layout = new RowLayout(SWT.VERTICAL);
    page.setLayout(layout);

    // mark
    Composite markComp = new Composite(page, SWT.NONE);
    markComp.setLayout(new GridLayout(2, false));

    Label markLabel = new Label(markComp, SWT.NONE);
    markLabel.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
    markLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    markLabel.setText(Messages.MarkEditor_MarkLabel);

    Combo markCombo = new Combo(markComp, SWT.READ_ONLY);
    markCombo.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    markView = new ComboViewer(markCombo);
    markView.add(MARKS);
    markView.setSelection(new StructuredSelection(mark.getWellKnownName().toString()));
    markView.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            changed = true;
        }
    });

    // stroke
    Label strokeLabel = new Label(page, SWT.NONE);
    strokeLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    strokeLabel.setText(Messages.MarkEditor_StrokeLabel);
    strokeEditor = new StrokeEditor(page, mark.getStroke());

    // fill
    Label fillLabel = new Label(page, SWT.NONE);
    fillLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    fillLabel.setText(Messages.MarkEditor_FillLabel);
    fillEditor = new FillEditor(page, mark.getFill());
}

From source file:eu.esdihumboldt.hale.ui.style.editors.PointGraphicEditor.java

License:Open Source License

/**
 * Creates a {@link Graphic} editor//from   w w w .  j a  va  2s . c  om
 * 
 * @param parent the parent composite
 */
public PointGraphicEditor(Composite parent) {
    page = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    page.setLayout(layout);

    Label graphLabel = new Label(page, SWT.NONE);
    graphLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    graphLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    graphLabel.setText(Messages.PointGraphicEditor_UrlTextField);

    path = new TextViewer(page, SWT.SINGLE | SWT.BORDER);
    path.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    path.setDocument(new Document());

    dialogButton = new Button(page, SWT.PUSH);
    dialogButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    dialogButton.setText(Messages.PointGraphicEditor_FileDialogButton);
    dialogButton.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            openFileDialog();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            // ignore
        }
    });

    Label supportLabel = new Label(page, SWT.NONE);
    supportLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    supportLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    supportLabel.setText("\n" + Messages.PointGraphicEditor_SupportedTypes);

    supportText = new Text(page, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
    supportText.setLayoutData(new GridData(SWT.BOTTOM, SWT.CENTER, false, false, 2, 1));
    supportText.setText(new HashSet<String>(Arrays.asList(ImageIO.getReaderMIMETypes())).toString());
}

From source file:eu.esdihumboldt.hale.ui.style.editors.PolygonSymbolizerEditor.java

License:Open Source License

/**
 * Creates a {@link PolygonSymbolizer} editor
 * //w w w .  j  a  va2s.c o  m
 * @param parent the parent composite
 * @param poly the initial {@link PolygonSymbolizer}
 */
public PolygonSymbolizerEditor(Composite parent, PolygonSymbolizer poly) {
    super();

    page = new Composite(parent, SWT.NONE);

    RowLayout layout = new RowLayout(SWT.VERTICAL);
    page.setLayout(layout);

    // stroke
    Label strokeLabel = new Label(page, SWT.NONE);
    strokeLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    strokeLabel.setText(Messages.PolygonSymbolizerEditor_StrokeLabel);
    strokeEditor = new StrokeEditor(page, poly.getStroke());

    // fill
    Label fillLabel = new Label(page, SWT.NONE);
    fillLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    fillLabel.setText(Messages.PolygonSymbolizerEditor_FillLabel);
    fillEditor = new FillEditor(page, poly.getFill());
}

From source file:eu.esdihumboldt.hale.ui.style.editors.RuleEditor.java

License:Open Source License

/**
 * Creates a {@link Rule} editor/*from   w ww. ja v  a  2  s .c o  m*/
 * 
 * @param parent the parent composite
 * @param typeDefinition the type Definition
 * @param filter the initial {@link Filter}
 * @param symbolizerType the {@link Symbolizer} type
 * @param symbolizer the initial {@link Symbolizer}
 * @param symbolizerFactory a {@link Symbolizer} editor factory
 */
public RuleEditor(Composite parent, TypeDefinition typeDefinition, Filter filter, Class<T> symbolizerType,
        T symbolizer, EditorFactory<T> symbolizerFactory) {
    super();

    page = new Composite(parent, SWT.NONE);
    page.setLayout(new GridLayout(1, false));

    // filter
    Label filterLabel = new Label(page, SWT.NONE);
    filterLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
    filterLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    filterLabel.setText(Messages.RuleEditor_FilterLabel);

    filterEditor = new FilterEditor(page, typeDefinition, filter);
    filterEditor.getControl().setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, true, false));

    // symbolizer
    Label symbolLabel = new Label(page, SWT.NONE);
    symbolLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
    symbolLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    symbolLabel.setText(symbolizerType.getSimpleName());

    symbolizerEditor = symbolizerFactory.createEditor(page, symbolizer);
    symbolizerEditor.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
}

From source file:fr.lip6.move.coloane.core.ui.editpart.AttributeEditPart.java

License:Open Source License

/**
 * Refresh view side according model information.
 *///from   w w w  .j  a  v  a2s  .  co m
@Override
protected final void refreshVisuals() {
    IAttribute attribut = (IAttribute) getModel();
    Label attributeFigure = (Label) getFigure();

    // Update graphical representation
    getFigure().setForegroundColor(attribut.getGraphicInfo().getForeground());
    getFigure().setBackgroundColor(attribut.getGraphicInfo().getBackground());

    // Select state (attribute only or parent ?)
    // TODO: Should be set in a property page
    if (this.select || this.elementSelect) {
        getFigure().setForegroundColor(ColorConstants.blue);
    }
    // Highlight state (mouseover event)
    // TODO: Should be set in a property page
    if (this.highlight) {
        getFigure().setBackgroundColor(ColorConstants.lightGray);
    }
    // Special state (coming from problem view)
    if (special) {
        getFigure().setForegroundColor(ColorConstants.red);
    }

    // Font update
    if (this.font == null || this.font.isDisposed()) {
        this.font = JFaceResources.getDefaultFont();
        if (attribut.getAttributeFormalism().isBold()) {
            this.font = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT);
        }
        if (attribut.getAttributeFormalism().isItalic()) {
            this.font = JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT);
        }
        attributeFigure.setFont(this.font);
    }

    // The label is filled with the attribute value !
    attributeFigure.setText(attribut.getValue());

    // Graphical space (i.e. bounds) for the attribute is set here.
    Rectangle bounds = new Rectangle(attribut.getGraphicInfo().getLocation(), new Dimension(
            attributeFigure.getTextBounds().width + EXTRA_SPACE, attributeFigure.getTextBounds().height));
    if (getParent() != null) {
        ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), bounds);
    }
}

From source file:fr.lip6.move.coloane.core.ui.figures.nodes.CircularDelegate.java

License:Open Source License

/**
 * {@inheritDoc}//from www.  ja v a2s.  c  o  m
 */
@Override
protected final void outlineShape(final Graphics graphics) {
    Rectangle r = getBounds();

    boolean isPublic = getModel().getAttribute("visibility").getValue().equals("public");

    int lineWidth = getLineWidth();
    int x = r.x + lineWidth / 2;
    int y = r.y + lineWidth / 2;
    int w = r.width - Math.max(1, lineWidth);
    int h = r.height - Math.max(1, lineWidth);
    graphics.drawRectangle(x, y, w, h);

    // double the line for public transition : gives a "bold" effect.
    if (isPublic) {
        int ix = x + 2;
        int iy = y + 2;
        int iw = Math.max(1, w - 4);
        int ih = Math.max(1, h - 4);
        graphics.drawRectangle(ix, iy, iw, ih);
    }

    String type = "CIRC";
    graphics.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    graphics.drawText(type, getBounds().getTopLeft().translate(5, 3));

}

From source file:fr.lip6.move.coloane.core.ui.figures.nodes.InstanceNode.java

License:Open Source License

private void setTitle() {
    FrameBorder tb = new FrameBorder(instanceName);
    tb.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    setBorder(tb);
}

From source file:fr.lip6.move.coloane.core.ui.figures.nodes.PlaceNode.java

License:Open Source License

/**
 * {@inheritDoc}/* w w w. j  a v  a2 s . co  m*/
 */
@Override
protected final void outlineShape(Graphics graphics) {
    Rectangle r = Rectangle.SINGLETON;
    r.setBounds(getBounds());
    r.width--;
    r.height--;
    int lineWidth = getLineWidth();
    r.shrink((lineWidth - 1) / 2, (lineWidth - 1) / 2);
    graphics.drawOval(r);

    if (toshow > 0 && toshow < 10) {
        switch (toshow) {
        case 0:
            return;
        case 1: {
            drawToken(0.52, 0.52, graphics);
            return;
        }
        case 2: {
            drawToken(0.2, 0.40, graphics);
            drawToken(0.65, 0.50, graphics);
            return;
        }
        case 3: {
            drawToken(0.2, 0.3, graphics);
            drawToken(0.4, 0.6, graphics);
            drawToken(0.6, 0.3, graphics);
            return;
        }
        default: {
            Point x = getBounds().getLeft().translate(6, -7);
            graphics.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
            graphics.drawString("" + toshow, x);
            return;
        }
        }
    }

}

From source file:fr.lip6.move.coloane.core.ui.figures.nodes.ScalarDelegate.java

License:Open Source License

/**
 * {@inheritDoc}//ww  w .ja  v  a2 s.  c  o m
 */
@Override
protected final void outlineShape(final Graphics graphics) {
    Rectangle r = getBounds();

    boolean isPublic = getModel().getAttribute("visibility").getValue().equals("public");

    int lineWidth = getLineWidth();
    int x = r.x + lineWidth / 2;
    int y = r.y + lineWidth / 2;
    int w = r.width - Math.max(1, lineWidth);
    int h = r.height - Math.max(1, lineWidth);
    graphics.drawRectangle(x, y, w, h);

    // double the line for public transition : gives a "bold" effect.
    if (isPublic) {
        int ix = x + 2;
        int iy = y + 2;
        int iw = Math.max(1, w - 4);
        int ih = Math.max(1, h - 4);
        graphics.drawRectangle(ix, iy, iw, ih);
    }

    String type = getModel().getAttribute("kind").getValue();
    graphics.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    graphics.drawText(type, getBounds().getTopLeft().translate(5, 3));

}

From source file:fr.lip6.move.coloane.extensions.exporttosvg.ExportToSVG.java

License:Open Source License

/**
 * Create attribute figures//from   w  w  w .j av  a2  s .c  o  m
 * 
 * @param attributes
 *            list of attribute
 * @return list of figure for each attributes
 */
private Collection<IFigure> createAttributeFigures(Collection<IAttribute> attributes) {
    List<IFigure> list = new ArrayList<IFigure>();
    for (IAttribute attr : attributes) {
        if (attr.getAttributeFormalism().isDrawable()
                && !attr.getValue().equals(attr.getAttributeFormalism().getDefaultValue())) {
            final Point location = attr.getGraphicInfo().getLocation();
            Label label = new Label() {
                @Override
                public void paint(Graphics graphics) {
                    graphics.setFont(getFont());
                    graphics.setForegroundColor(getForegroundColor());
                    graphics.setBackgroundColor(getBackgroundColor());
                    graphics.fillText(getText(), location);
                }
            };
            label.setOpaque(true);
            label.setText(attr.getValue());
            label.setLocation(attr.getGraphicInfo().getLocation());
            label.setForegroundColor(attr.getGraphicInfo().getForeground());
            label.setBackgroundColor(attr.getGraphicInfo().getBackground());

            Font font = JFaceResources.getDefaultFont();
            if (attr.getAttributeFormalism().isBold()) {
                font = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT);
            } else if (attr.getAttributeFormalism().isItalic()) {
                font = JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT);
            }
            label.setFont(font);
            label.setBounds(label.getTextBounds());

            list.add(label);
        }
    }
    return list;
}