private Composite buildUIForSpecific(Composite parent) { Composite container = new Composite(parent, SWT.NONE); container.setLayoutData(new GridData(GridData.FILL_BOTH)); GridLayout layout = new GridLayout(3, false); container.setLayout(layout); ReportEngine engine = new ReportEngine(new EngineConfig()); String[] typeInfo = engine.getSupportedFormats(); specCheckButtons = new HashMap(); specExpressions = new HashMap(); for (int i = 0; i < typeInfo.length; i++) { Button btn = FormWidgetFactory.getInstance().createButton(container, SWT.CHECK, isFormStyle()); btn.setText(typeInfo[i]); btn.setSelection(false); Label label = FormWidgetFactory.getInstance().createLabel(container, isFormStyle()); label.setText(Messages.getString("VisibilityPage.Label.Expression")); // $NON-NLS-1$ ExpressionComposite expression = new ExpressionComposite(container, isFormStyle()); GridData data = new GridData(); data.grabExcessHorizontalSpace = true; data.horizontalAlignment = GridData.FILL; expression.setLayoutData(data); specCheckButtons.put(typeInfo[i], btn); specExpressions.put(typeInfo[i], expression); btn.addSelectionListener(listener); expression.addListener( SWT.Modify, new Listener() { public void handleEvent(Event event) { saveHideInfo(); } }); } return container; }
private Composite buildUIForAlloutput(Composite parent) { Composite container = new Composite(parent, SWT.NONE); container.setLayoutData(new GridData(GridData.FILL_BOTH)); GridLayout layout = new GridLayout(2, false); container.setLayout(layout); Label label = FormWidgetFactory.getInstance().createLabel(container, isFormStyle()); label.setText(Messages.getString("VisibilityPage.Label.Expression")); // $NON-NLS-1$ allExpression = new ExpressionComposite(container, isFormStyle()); allExpression.addListener( SWT.Modify, new Listener() { public void handleEvent(Event event) { saveHideInfo(); } }); GridData data = new GridData(); data.grabExcessHorizontalSpace = true; data.horizontalAlignment = GridData.FILL; allExpression.setLayoutData(data); return container; }
public Control createControl(Composite parent) { listener = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (!specCheckButtons.containsValue(e.getSource())) { setOutputEnable(hideCheckbox.getSelection()); } if (hideCheckbox.getSelection()) { saveHideInfo(); } else { try { outputDescriptorProvider.clearProperty(); } catch (Exception e1) { ExceptionHandler.handle(e1); } } } }; container = new Composite(parent, SWT.NONE); container.setLayout(WidgetUtil.createGridLayout(4)); hideCheckbox = FormWidgetFactory.getInstance().createButton(container, SWT.CHECK, isFormStyle()); hideCheckbox.setText(Messages.getString("VisibilityPage.Check.HideElement")); // $NON-NLS-1$ GridData data = new GridData(); // data.verticalSpan = 4; data.verticalAlignment = GridData.BEGINNING; hideCheckbox.setLayoutData(data); hideCheckbox.addSelectionListener(listener); WidgetUtil.createGridPlaceholder(container, 3, true); WidgetUtil.createHorizontalLine(container, 4); allRadio = FormWidgetFactory.getInstance().createButton(container, SWT.RADIO, isFormStyle()); allRadio.setText(Messages.getString("VisibilityPage.Radio.AllOutputs")); // $NON-NLS-1$ allRadio.addSelectionListener(listener); WidgetUtil.createGridPlaceholder(container, 3, true); specRadio = FormWidgetFactory.getInstance().createButton(container, SWT.RADIO, isFormStyle()); specRadio.setText(Messages.getString("VisibilityPage.Radio.SpecificOutputs")); // $NON-NLS-1$ WidgetUtil.createGridPlaceholder(container, 3, true); if (isFormStyle()) group = FormWidgetFactory.getInstance().createGroup(container, ""); // $NON-NLS-1$ else group = new Group(container, SWT.NONE); group.setLayout(new GridLayout()); data = new GridData(); data.verticalSpan = 4; data.verticalAlignment = GridData.FILL; data.grabExcessHorizontalSpace = true; data.horizontalAlignment = GridData.FILL; group.setLayoutData(data); allContainer = buildUIForAlloutput(group); specContainer = buildUIForSpecific(group); // sets default output type allRadio.setSelection(true); setOutputInfo(); return container; }