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(); } } }
/* * (non-Javadoc) * * @see org.eclipse.birt.chart.ui.swt.composites.IAngleChangeListener#angleChanged(int) */ public void angleChanged(int iNewAngle) { iscRotation.setValue(iNewAngle); fdCurrent.setRotation(iNewAngle); updatePreview(); }
private void createRotationPanel() { Composite cmpRotation = new Composite(cmpContent, SWT.NONE); { GridLayout layout = new GridLayout(3, false); layout.verticalSpacing = 5; layout.horizontalSpacing = 5; layout.marginHeight = 7; layout.marginWidth = 7; cmpRotation.setLayout(layout); GridData gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 3; gd.heightHint = 150; cmpRotation.setLayoutData(gd); } Label lblRotation = new Label(cmpRotation, SWT.NONE); { lblRotation.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); lblRotation.setText(Messages.getString("FontDefinitionDialog.Lbl.Rotation")); // $NON-NLS-1$ } ascRotation = new AngleSelectorComposite( cmpRotation, SWT.BORDER, ChartUIUtil.getFontRotation(fdCurrent), Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); GridData gdASCRotation = new GridData(GridData.FILL_BOTH); gdASCRotation.horizontalSpan = 2; ascRotation.setLayoutData(gdASCRotation); ascRotation.setAngleChangeListener(this); Label lblDegree = new Label(cmpRotation, SWT.NONE); { lblDegree.setLayoutData(new GridData()); lblDegree.setText(Messages.getString("FontDefinitionDialog.Label.Degree")); // $NON-NLS-1$ } iscRotation = new IntegerSpinControl(cmpRotation, SWT.NONE, ChartUIUtil.getFontRotation(fdCurrent)); GridData gdISCRotation = new GridData(GridData.FILL_HORIZONTAL); gdISCRotation.horizontalSpan = 2; iscRotation.setLayoutData(gdISCRotation); iscRotation.setMinimum(-90); iscRotation.setMaximum(90); iscRotation.setIncrement(1); iscRotation.addListener(this); Label lblPreview = new Label(cmpContent, SWT.NONE); { lblPreview.setText(Messages.getString("FontDefinitionDialog.Lbl.Preview")); // $NON-NLS-1$ lblPreview.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); } FillLayout flPreview = new FillLayout(); flPreview.marginHeight = 2; flPreview.marginWidth = 3; Composite grpPreview = new Composite(cmpContent, SWT.NONE); GridData gdGRPPreview = new GridData(GridData.FILL_BOTH); gdGRPPreview.horizontalSpan = 4; grpPreview.setLayoutData(gdGRPPreview); grpPreview.setLayout(flPreview); fcPreview = new FontCanvas(grpPreview, SWT.BORDER, fdCurrent, cdCurrent, true, true, true); }