List of usage examples for org.eclipse.jface.layout RowLayoutFactory swtDefaults
public static RowLayoutFactory swtDefaults()
From source file:com.aptana.projects.wizards.ProjectTemplateSelectionPage.java
License:Open Source License
private Composite createTemplatesList(Composite parent) { Composite main = new Composite(parent, SWT.NONE); main.setLayout(GridLayoutFactory.fillDefaults().spacing(0, 0).numColumns(2).create()); Color background = main.getDisplay().getSystemColor(SWT.COLOR_WHITE); main.setBackground(background);/*w w w . ja va2 s . c om*/ // the left side is the list of template tags Composite templateTags = new Composite(main, SWT.BORDER); templateTags.setLayout(GridLayoutFactory.swtDefaults().create()); // If there are only the "All" tag and one other tag, don't both showing the left column. boolean exclude = templateTagsMap.size() <= 2; templateTags.setLayoutData( GridDataFactory.fillDefaults().grab(false, true).hint(150, SWT.DEFAULT).exclude(exclude).create()); templateTags.setBackground(background); List<String> tags = new ArrayList<String>(templateTagsMap.keySet()); Collections.sort(tags); tagsListViewer = new TableViewer(templateTags, SWT.SINGLE | SWT.FULL_SELECTION); tagsListViewer.setContentProvider(ArrayContentProvider.getInstance()); tagsListViewer.setLabelProvider(new LabelProvider() { @Override public Image getImage(Object element) { if (element instanceof String) { return getProjectTemplatesManager().getImageForTag((String) element); } return super.getImage(element); } }); tagsListViewer.setInput(tags); tagsListViewer.setComparator(new ViewerComparator() { @Override public int category(Object element) { // make sure the "All" tag appears at the bottom return TAG_ALL.equals(element) ? 1 : 0; } }); Table tagsList = tagsListViewer.getTable(); tagsList.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); tagsList.setBackground(background); FontData[] fontData = SWTUtils.resizeFont(tagsList.getFont(), 2); final Font tagFont = new Font(tagsList.getDisplay(), fontData); tagsList.setFont(tagFont); tagsList.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { tagFont.dispose(); } }); tagsListViewer.addSelectionChangedListener(tagSelectionChangedListener); // the right side has the list of templates for the selected tag and the details on the selected template Composite rightComp = new Composite(main, SWT.BORDER); rightComp.setLayout(GridLayoutFactory.fillDefaults().create()); rightComp.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); rightComp.setBackground(background); templatesListComposite = new Composite(rightComp, SWT.NONE); templatesListComposite.setLayout( RowLayoutFactory.swtDefaults().extendedMargins(5, 5, 5, 5).spacing(10).fill(true).create()); templatesListComposite .setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(450, 250).create()); templatesListComposite.setBackground(background); Label separator = new Label(rightComp, SWT.SEPARATOR | SWT.HORIZONTAL); separator.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); Composite descriptionComp = createTemplateDescription(rightComp); descriptionComp .setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT, 110).create()); return main; }
From source file:com.nokia.carbide.internal.discovery.ui.editor.TaskBar.java
License:Open Source License
public TaskBar(Composite parent, Composite backgroundParent, IActionBar actionBar) { super(parent, backgroundParent, parent.getDisplay().getSystemColor(SWT.COLOR_BLACK), parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); createTitle(actionBar);/*from www.ja va2 s. co m*/ createActions(actionBar); RowLayoutFactory.swtDefaults().type(SWT.VERTICAL).margins(5, 5).extendedMargins(7, 7, 7, 7).fill(true) .wrap(false).applyTo(this); }
From source file:eu.numberfour.n4js.ui.wizard.components.AccessModifierComponent.java
License:Open Source License
/** * Creates a new AccessModifierComponent. * * @param model/* ww w.ja va 2 s . c om*/ * The model to bind to * @param container * The parent to create the widgets in */ public AccessModifierComponent(AccessModifiableModel model, WizardComponentContainer container) { super(container); this.model = model; this.componentContainer = container; this.dataBindingContext = container.getDataBindingContext(); Label accessModifierLabel = new Label(componentContainer.getComposite(), SWT.NONE); accessModifierLabel.setLayoutData(fillLabelDefaults()); accessModifierLabel.setText("Access modifier:"); Composite accessModifiersComposite = new Composite(componentContainer.getComposite(), SWT.NONE); accessModifiersComposite.setLayout(RowLayoutFactory.swtDefaults().extendedMargins(0, 0, 0, 0).create()); GridData accessModifiersCompositeLayoutData = fillTextDefaults(); accessModifiersCompositeLayoutData.horizontalSpan = 2; accessModifiersComposite.setLayoutData(accessModifiersCompositeLayoutData); publicAccessModifierBox = new Button(accessModifiersComposite, SWT.RADIO); publicAccessModifierBox.setText("public"); projectAccessModifierBox = new Button(accessModifiersComposite, SWT.RADIO); projectAccessModifierBox.setText("project"); privateAccessModifierBox = new Button(accessModifiersComposite, SWT.RADIO); privateAccessModifierBox.setText("private"); internalAnnotationBox = new Button(accessModifiersComposite, SWT.CHECK); getInternalAnnotationBox().setText("@Internal"); setupBindings(); }
From source file:eu.numberfour.n4js.ui.wizard.components.OtherClassifierModifiersComponent.java
License:Open Source License
/** * Creates a new OtherClassModifiers component. * * @param model/* ww w . j a v a 2 s . c o m*/ * The model the bind it to * @param container * The container to put it in */ public OtherClassifierModifiersComponent(N4JSClassifierWizardModel model, WizardComponentContainer container, boolean createFinalButton) { super(container); this.model = model; Label otherModifiersLabel = new Label(getParentComposite(), SWT.NONE); otherModifiersLabel.setText("Other modifiers:"); Composite otherModifierComposite = new Composite(this.getParentComposite(), SWT.NONE); otherModifierComposite.setLayout(RowLayoutFactory.swtDefaults().extendedMargins(0, 0, 0, 0).create()); if (createFinalButton) { finalAnnotationBox = new Button(otherModifierComposite, SWT.CHECK); finalAnnotationBox.setText("@Final"); } else { finalAnnotationBox = null; } n4jsAnnotationBox = new Button(otherModifierComposite, SWT.CHECK); getN4jsAnnotationBox().setText("@N4JS"); WizardComponentUtils.emptyGridCell(getParentComposite()); setupBindings(); }
From source file:net.texo.USDLSecurityEditor.PageBuilder.java
License:Open Source License
/** * Creates the security mechanism group. * * @param parent the parent/* w w w .j a v a 2s.com*/ * @param aspect the aspect * @param action the action * @return the group */ public Group createSecurityMechanismGroup(final Composite parent, final SecurityAspect aspect, final SecurityMechanism action) { if (parent == null) return null; if (aspect == null) return null; if (action == null) return null; Group gAction = new Group(parent, SWT.NONE); GridLayoutFactory.swtDefaults().numColumns(2).applyTo(gAction); gAction.setText(action.getType().getLiteral()); Font font = gAction.getFont(); FontData[] fd = font.getFontData(); for (int i = 0; i < fd.length; ++i) { fd[i].setStyle(SWT.BOLD); } Font newFont = new Font(parent.getDisplay(), fd); gAction.setFont(newFont); toolkit.createLabel(gAction, "Requirement Level: "); Composite cReqLvlMarker = toolkit.createComposite(gAction); RowLayoutFactory.swtDefaults().applyTo(cReqLvlMarker); ComboViewer cvReqLevel = new ComboViewer(cReqLvlMarker, SWT.READ_ONLY); cvReqLevel.setContentProvider(ArrayContentProvider.getInstance()); ArrayList<String> list = new ArrayList<String>(); for (Iterator<SecurityRequirementLevel> j = SecurityRequirementLevel.VALUES.iterator(); j.hasNext();) { list.add(j.next().getLiteral()); } cvReqLevel.setInput(list); cvReqLevel.addSelectionChangedListener(new ReqLevelForActionListener(editor, aspect, action)); cvReqLevel.setSelection(new StructuredSelection( ((SecurityMechanism) editor.model.getRealizingAction(aspect.getType(), action.getType())).getLevel() .getName())); Label lMarker = toolkit.createLabel(cReqLvlMarker, ""); lMarker.setVisible(false); //lMarker.setImage(Activator.getImageDescriptor(ISharedImages.IMG_OBJS_WARN_TSK).createImage()); lMarker.setImage(Activator.getImageDescriptor("icons/warning.png").createImage()); toolkit.createLabel(gAction, "Supported Mechanisms: "); List lMechanisms = new List(gAction, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL); GridDataFactory.swtDefaults().hint(300, 45).applyTo(lMechanisms); lMechanisms.setEnabled(true); /** TODO **/ SecurityMechanismProxy pAction = new SecurityMechanismProxy(editor, aspect, (SecurityMechanism) action, gAction, cvReqLevel, lMarker, lMechanisms); editor.ActionProxies.put(action, pAction); /****/ return gAction; }
From source file:test.UITest.java
License:Open Source License
/** * Launch the application./*from w w w . jav a 2 s . c o m*/ * * @param args the arguments */ @SuppressWarnings("unused") public static void main(String[] args) { Display display = new Display(); shell = new Shell(display); toolkit = new FormToolkit(display); RowLayoutFactory.swtDefaults().type(SWT.VERTICAL).applyTo(shell); RowDataFactory.swtDefaults().applyTo(shell); //Composite c = buildPage(toolkit, shell, "Security", true); /****/ Composite c = new Composite(shell, SWT.NONE); GridLayoutFactory.swtDefaults().numColumns(2).applyTo(c); Label lOntology = new Label(c, SWT.NONE); lOntology.setText("Security Ontology: "); GridDataFactory.swtDefaults().span(2, 1).applyTo(lOntology); Text tOntology = new Text(c, SWT.BORDER); tOntology.setText("http://www.fokus.fraunhofer.de/texo/ontologies/security.owl"); GridDataFactory.swtDefaults().hint(350, 15).applyTo(tOntology); Button bOntology = new Button(c, SWT.PUSH | SWT.CENTER); bOntology.setText("Load..."); GridDataFactory.swtDefaults().applyTo(bOntology); /****/ Label lProfile = new Label(c, SWT.NONE); lProfile.setText("Security Profile: "); GridDataFactory.swtDefaults().span(2, 1).applyTo(lProfile); Text tProfile = new Text(c, SWT.BORDER); tProfile.setText("http://www.fokus.fraunhofer.de/texo/ontologies/security_profile.owl"); GridDataFactory.swtDefaults().hint(350, 15).applyTo(tProfile); Button bProfile = new Button(c, SWT.PUSH | SWT.CENTER); bProfile.setText("Load..."); GridDataFactory.swtDefaults().applyTo(bProfile); /****/ shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:test.UITest.java
License:Open Source License
/** * Builds the page./*ww w .j a v a 2 s. c o m*/ * * @param <T> the generic type * @param toolkit the toolkit * @param parent the parent * @param sectionName the section name * @param expanded the expanded * @return the composite */ public static <T extends EObject> Composite buildPage(FormToolkit toolkit, final Composite parent, final String sectionName, boolean expanded) { /**** Setup ****/ /**** Security ****/ final Section sSecurity = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE); RowLayoutFactory.swtDefaults().applyTo(sSecurity); sSecurity.setText(sectionName); sSecurity.setExpanded(true); sSecurity.setDescription("TODO"); final Composite cSecurity = toolkit.createComposite(sSecurity); RowLayoutFactory.swtDefaults().type(SWT.VERTICAL).applyTo(cSecurity); sSecurity.setClient(cSecurity); final Composite generalComp = toolkit.createComposite(cSecurity); RowLayoutFactory.swtDefaults().type(SWT.HORIZONTAL).applyTo(generalComp); /**** >>> General ****/ toolkit.createLabel(generalComp, "Security Profile: "); toolkit.createText(generalComp, "", SWT.NONE); toolkit.createButton(generalComp, "load", SWT.PUSH); /**** Security Aspects ****/ for (Iterator<SecurityAspectType> i = SecurityAspectType.VALUES.iterator(); i.hasNext();) { SecurityAspectType saType = i.next(); switch (saType) { case ADDRESSABILITY: continue; case PRIVACY: continue; case TRACEABILITY: continue; case OTHER: continue; case UNDEFINED: continue; } final ExpandableComposite saComp = toolkit.createExpandableComposite(cSecurity, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT); saComp.setText(saType.getLiteral()); saComp.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { UITest.changePage(); } }); final Composite secAsp0Composite; // if (saType == SecurityAspectType.ACCESS_PROTECTION) { // secAsp0Composite = createAccessProtectionComposite(toolkit, saComp, saType); // } else { secAsp0Composite = createSecurityAspectComposite(toolkit, saComp, saType); // } saComp.setClient(secAsp0Composite); } return sSecurity; }