public void handleEvent(Event e) { if (e.widget.equals(iscRotation)) { fdCurrent.setRotation(iscRotation.getValue()); ascRotation.setAngle(iscRotation.getValue()); ascRotation.redraw(); // TODO: Enable this if support for rotated text is added to // fontcanvas updatePreview(); } else if (e.widget.equals(fccColor)) { if (e.type == FillChooserComposite.FILL_CHANGED_EVENT) { cdCurrent = (ColorDefinition) fccColor.getFill(); // if ( cdCurrent == null ) // { // cdCurrent = ColorDefinitionImpl.TRANSPARENT( ); // } fcPreview.setColor(cdCurrent); fcPreview.redraw(); } } }
protected Control createDialogArea(Composite parent) { GridLayout glContent = new GridLayout(); glContent.verticalSpacing = 5; glContent.horizontalSpacing = 5; glContent.marginHeight = 7; glContent.marginWidth = 7; glContent.numColumns = 9; cmpContent = new Composite(parent, SWT.NONE); cmpContent.setLayout(glContent); cmpContent.setLayoutData(new GridData(GridData.FILL_BOTH)); Label lblFont = new Label(cmpContent, SWT.NONE); GridData gdLFont = new GridData(); lblFont.setLayoutData(gdLFont); lblFont.setText(Messages.getString("FontDefinitionDialog.Lbl.Font")); // $NON-NLS-1$ cmbFontNames = new Combo(cmpContent, SWT.DROP_DOWN | SWT.READ_ONLY); GridData gdCMBFontNames = new GridData(GridData.FILL_HORIZONTAL); gdCMBFontNames.horizontalSpan = 8; cmbFontNames.setLayoutData(gdCMBFontNames); cmbFontNames.addSelectionListener(this); cmbFontNames.setVisibleItemCount(30); Label lblSize = new Label(cmpContent, SWT.NONE); GridData gdLSize = new GridData(); lblSize.setLayoutData(gdLSize); lblSize.setText(Messages.getString("FontDefinitionDialog.Lbl.Size")); // $NON-NLS-1$ cmbFontSizes = new Combo(cmpContent, SWT.NONE); { cmbFontSizes.setItems(FONT_SIZE); cmbFontSizes.setText( fdCurrent.isSetSize() ? String.valueOf((int) fdCurrent.getSize()) : ChartUIUtil.FONT_AUTO); GridData gdISCFontSizes = new GridData(GridData.FILL_HORIZONTAL); gdISCFontSizes.horizontalSpan = 3; cmbFontSizes.setLayoutData(gdISCFontSizes); cmbFontSizes.addSelectionListener(this); cmbFontSizes.addFocusListener(this); cmbFontSizes.setVisibleItemCount(30); } Label lblForeground = new Label(cmpContent, SWT.NONE); GridData gdLForeground = new GridData(); gdLForeground.horizontalSpan = 2; gdLForeground.horizontalIndent = 40; lblForeground.setLayoutData(gdLForeground); lblForeground.setText(Messages.getString("FontDefinitionDialog.Lbl.Color")); // $NON-NLS-1$ fccColor = new FillChooserComposite( cmpContent, SWT.NONE, wizardContext, cdCurrent, false, false, true, false, false, false); { GridData gdFCCColor = new GridData(GridData.FILL_HORIZONTAL); gdFCCColor.horizontalSpan = 3; fccColor.setLayoutData(gdFCCColor); fccColor.addListener(this); } createFontStylePanel(); if (isAlignmentEnabled) { createAlignmentPanel(); } createRotationPanel(); populateLists(); updatePreview(); return cmpContent; }