List of usage examples for org.eclipse.jface.viewers ComboViewer ComboViewer
public ComboViewer(Composite parent, int style)
From source file:gov.redhawk.ui.port.nxmblocks.SddsNxmBlockControls.java
License:Open Source License
public void createControls(final Composite container) { container.setLayout(new GridLayout(2, false)); Label label;/*www . java2 s.c o m*/ // === data byte order === label = new Label(container, SWT.NONE); label.setText("Data Byte Order:"); this.dataByteOrderField = new ComboViewer(container, SWT.READ_ONLY); this.dataByteOrderField.getCombo().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); this.dataByteOrderField.getCombo() .setToolTipText("Custom data byte order to override value in SDDS packets."); this.dataByteOrderField.setContentProvider(ArrayContentProvider.getInstance()); // ArrayContentProvider does not store any state, therefore can re-use instances this.dataByteOrderField.setLabelProvider(new LabelProvider()); this.dataByteOrderField.setInput(new ByteOrder[] { ByteOrder.BIG_ENDIAN, ByteOrder.LITTLE_ENDIAN }); addDataBindings(); }
From source file:gov.redhawk.ui.port.playaudio.controls.PlaybackInfo.java
License:Open Source License
public PlaybackInfo(final Composite parent, final int style) { super(parent, style); this.setLayout(new GridLayout(4, false)); // SUPPRESS CHECKSTYLE MagicNumber Label label = new Label(this, SWT.NONE); label.setText("Encoding:"); label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 1, 1)); this.encodingBox = new Text(this, SWT.SINGLE | SWT.BORDER); this.encodingBox.setText(""); this.encodingBox.setEnabled(false); this.encodingBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); label = new Label(this, SWT.NONE); label.setText("Channels:"); label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 1, 1)); this.channelsBox = new Text(this, SWT.SINGLE | SWT.BORDER); this.channelsBox.setText(""); this.channelsBox.setEnabled(false); this.channelsBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); label = new Label(this, SWT.NONE); label.setText("Sample Rate:"); label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 1, 1)); this.sampleRateBox = new Text(this, SWT.SINGLE | SWT.BORDER); this.sampleRateBox.setText(""); this.sampleRateBox.setEnabled(false); this.sampleRateBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); label = new Label(this, SWT.NONE); label.setText("Size (bits):"); label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 1, 1)); this.sampleSizeBox = new Text(this, SWT.SINGLE | SWT.BORDER); this.sampleSizeBox.setText(""); this.sampleSizeBox.setEnabled(false); this.sampleSizeBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); label = new Label(this, SWT.NONE); label.setText("Frame Rate:"); label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 1, 1)); this.frameRateBox = new Text(this, SWT.SINGLE | SWT.BORDER); this.frameRateBox.setText(""); this.frameRateBox.setEnabled(false); this.frameRateBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); label = new Label(this, SWT.NONE); label.setText("Size (bytes):"); label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 1, 1)); this.frameSizeBox = new Text(this, SWT.SINGLE | SWT.BORDER); this.frameSizeBox.setText(""); this.frameSizeBox.setEnabled(false); this.frameSizeBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); label = new Label(this, SWT.NONE); label.setText("Gain Multiplier:"); label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 1, 1)); this.gainBox = new Text(this, SWT.SINGLE | SWT.BORDER); this.gainBox.setText(""); this.gainBox.setEnabled(false); this.gainBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); label = new Label(this, SWT.NONE); label.setText("Blocking:"); label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 1, 1)); this.blockingField = new ComboViewer(this, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); this.blockingField.setContentProvider(new ArrayContentProvider()); this.blockingField.setLabelProvider(new LabelProvider()); this.blockingField.setInput(new Object[] { true, false }); this.blockingField.getControl().setEnabled(false); this.blockingField.getControl().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); this.pauseButton = new Button(this, SWT.TOGGLE); this.pauseButton.setText("Play"); this.pauseButton.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 2, 1)); this.pauseButton.setEnabled(false); this.pauseButton.addSelectionListener(new SelectionAdapter() { @Override/* w ww . j av a 2 s . com*/ public void widgetSelected(final SelectionEvent e) { if (receiver.isPlaying()) { receiver.pause(); } else { try { receiver.play(); } catch (LineUnavailableException e1) { Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to play audio", e1); StatusManager.getManager().handle(status, StatusManager.SHOW | StatusManager.LOG); } } } }); this.disconnectButton = new Button(this, SWT.PUSH); this.disconnectButton.setText("Disconnect"); this.disconnectButton.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 2, 1)); this.disconnectButton.setEnabled(false); this.disconnectButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { AudioReceiver oldValue = receiver; setInput(null); oldValue.dispose(); } }); }
From source file:gov.redhawk.ui.views.domainbrowser.view.DomainBrowserView.java
License:Open Source License
@Override public void createPartControl(final Composite parent) { parent.setLayout(new GridLayout(3, false)); final Label label = new Label(parent, SWT.NONE); label.setText("Domain:"); label.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1)); this.domainCombo = new ComboViewer(parent, SWT.BORDER); this.domainCombo.getCombo().setToolTipText( "Valid input: \n <DOMAIN_NAME> ie: REDHAWK_DEV \n <DOMAIN_NAME>@<HOST:PORT> ie: REDHAWK_DEV@localhost:2809"); this.domainCombo.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); this.domainCombo.setContentProvider(ArrayContentProvider.getInstance()); // Creating a comparator so that the objects within the ComboViewer will be sorted correctly. this.domainCombo.setComparator(new ViewerComparator() { @Override/*from w w w.j av a 2 s.c o m*/ public int compare(Viewer viewer, Object e1, Object e2) { String s1 = null, s2 = null; if (e1 instanceof String) { s1 = (String) e1; } if (e1 instanceof ScaDomainManager) { ScaDomainManager dom = ((ScaDomainManager) e1); String[] tokens = dom.getConnectionProperties().get(ScaDomainManager.NAMING_SERVICE_PROP) .split("::"); s1 = ((ScaDomainManager) e1).getName() + "@" + tokens[1]; } if (e2 instanceof String) { s2 = (String) e2; } if (e2 instanceof ScaDomainManager) { ScaDomainManager dom = ((ScaDomainManager) e2); String[] tokens = dom.getConnectionProperties().get(ScaDomainManager.NAMING_SERVICE_PROP) .split("::"); s2 = dom.getName() + "@" + tokens[1]; } if (s1 != null && s2 != null) { return s1.compareToIgnoreCase(s2); } else { return 0; } } }); this.domainCombo.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { if (element instanceof String) { return (String) element; } else if (element instanceof ScaDomainManager) { String[] tokens; ScaDomainManager domain = (ScaDomainManager) element; tokens = domain.getConnectionProperties().get(ScaDomainManager.NAMING_SERVICE_PROP).split("::"); if (tokens.length == 2) { return domain.getName() + "@" + tokens[1]; // Is this a safe way of doing this? } else { return domain.getName(); } } return super.getText(element); } }); // If there are any domains within the domain registry we want to set them onto our combo list this.domainCombo.setInput(ScaPlugin.getDefault() .getDomainManagerRegistry(domainCombo.getControl().getDisplay()).getDomains()); // If the domain register logs any new domains or removes any we want to add / remove them from the combo ScaPlugin.getDefault().getDomainManagerRegistry(domainCombo.getControl().getDisplay()).eAdapters() .add(domainChangeAdapter); // Now to make it so that the text box in the combo will have an auto-complete like feel to it. final ComboContentAdapter controlAdapter = new ComboContentAdapter(); final ContentProposalAdapter contentProposalAdapter = CompatibilityFactory.createContentProposalAdapter( this.domainCombo.getCombo(), controlAdapter, this.proposalProvider, null); contentProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); // We want to connect when there is a selection of when the user hits enter. this.domainCombo.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { connect(); } }); createDomainViewer(parent); final MenuManager menuManager = new MenuManager(); final Menu menu = menuManager.createContextMenu(this.domainTree.getTree()); this.domainTree.getTree().setMenu(menu); getSite().registerContextMenu(DomainBrowserView.ID + ".popupMenu", menuManager, this.domainTree); getSite().setSelectionProvider(this.domainTree); final AdvancedPropertiesAction action = new AdvancedPropertiesAction("Advanced Properties", IAction.AS_CHECK_BOX); final IActionBars actionBars = getViewSite().getActionBars(); final IMenuManager dropDownMenu = actionBars.getMenuManager(); dropDownMenu.add(action); }
From source file:io.mapzone.arena.analytics.graph.SingleSourceNodeGraphFunction.java
License:Open Source License
@Override public void createContents(final MdToolkit tk, final Composite parent, final Graph graph) { try {/*from w w w . j av a2s.c o m*/ super.createContents(tk, parent, graph); final FeaturePropertySelectorUI sourcePropertiesUI = new FeaturePropertySelectorUI(tk, parent, prop -> { this.selectedSourcePropertyDescriptor = prop; EventManager.instance().publish(new GraphFunctionConfigurationChangedEvent( SingleSourceNodeGraphFunction.this, "sourcePropertyDescriptor", prop)); }); final FeatureSourceSelectorUI sourceFeaturesUI = new FeatureSourceSelectorUI(tk, parent, fs -> { this.selectedSourceFeatureSource = fs; EventManager.instance().publish(new GraphFunctionConfigurationChangedEvent( SingleSourceNodeGraphFunction.this, "sourceFeatureSource", fs)); sourcePropertiesUI.setFeatureSource(fs); }); final TreeMap<String, EdgeFunction> edgeFunctions = Maps.newTreeMap(); for (Class<EdgeFunction> cl : availableFunctions) { try { EdgeFunction function = cl.newInstance(); function.init(this); edgeFunctions.put(function.title(), function); } catch (Exception e) { throw new RuntimeException(e); } } final Composite edgeFunctionContainer = tk.createComposite(parent, SWT.NONE); edgeFunctionContainer.setLayout(FormLayoutFactory.defaults().create()); final ComboViewer edgeFunctionsUI = new ComboViewer(parent, SWT.SINGLE | SWT.BORDER | SWT.DROP_DOWN | SWT.READ_ONLY); edgeFunctionsUI.setContentProvider(new ArrayContentProvider()); edgeFunctionsUI.setInput(edgeFunctions.keySet()); edgeFunctionsUI.addSelectionChangedListener(ev -> { String selected = SelectionAdapter.on(ev.getSelection()).first(String.class).get(); EdgeFunction function = edgeFunctions.get(selected); // FormDataFactory.on( edgeFunctionContainer ).top( // edgeFunctionsUI.getCombo(), 4 ) // .height( function.preferredHeight() ).left( COLUMN_2 ).right( 100 // ); FormDataFactory.on(edgeFunctionContainer).height(function.preferredHeight()); UIUtils.disposeChildren(edgeFunctionContainer); // create panel function.createContents(tk, edgeFunctionContainer, selectedSourceFeatureSource); // FormDataFactory.on( edgeFunctionContainer ).fill(); // resize also the top container // XXX depends on the parent structure ((FormData) parent.getParent().getParent().getLayoutData()).height = preferredHeight() + function.preferredHeight(); parent.getParent().getParent().getParent().layout(); this.selectedEdgeFunction = function; }); final Label selectSourceTableLabel = tk.createLabel(parent, i18n.get("selectSourceTable"), SWT.NONE); FormDataFactory.on(selectSourceTableLabel).top(15).left(1); FormDataFactory.on(sourceFeaturesUI.control()).top(selectSourceTableLabel, 2).left(1); final Label selectSourcePropertiesLabel = tk.createLabel(parent, i18n.get("selectSourceProperties"), SWT.NONE); FormDataFactory.on(selectSourcePropertiesLabel).top(sourceFeaturesUI.control(), 4).left(COLUMN_2); FormDataFactory.on(sourcePropertiesUI.control()).top(selectSourcePropertiesLabel, 2).left(COLUMN_2); final Label selectEdgeFunctionLabel = tk.createLabel(parent, i18n.get("selectEdgeFunction"), SWT.NONE); FormDataFactory.on(selectEdgeFunctionLabel).top(sourcePropertiesUI.control(), 6).left(1); FormDataFactory.on(edgeFunctionsUI.getCombo()).top(selectEdgeFunctionLabel, 2).left(1); FormDataFactory.on(edgeFunctionContainer).fill().top(edgeFunctionsUI.getCombo(), 4).left(COLUMN_2); // event listener EventManager.instance().subscribe(this, ifType(EdgeFunctionConfigurationDoneEvent.class, ev -> ev.status.get() == Boolean.TRUE && ev.getSource().equals(selectedEdgeFunction))); EventManager.instance().subscribe(this, ifType(GraphFunctionConfigurationChangedEvent.class, ev -> ev.getSource().equals(SingleSourceNodeGraphFunction.this))); } catch (Exception e) { StatusDispatcher.handleError("", e); } }
From source file:io.mapzone.arena.analytics.graph.ui.GraphPanel.java
License:Open Source License
@Override public void createContents(final Composite parent) { try {/*w ww . ja v a 2 s. com*/ if (!featureLayer.isPresent()) { tk().createFlowText(parent, i18n.get("noFeatures")); return; } // this.parent = parent; parent.setLayout(FormLayoutFactory.defaults().create()); MdToolbar2 toolbar = tk().createToolbar(parent, SWT.TOP); new NodeStylerItem(toolbar); new EdgeStylerItem(toolbar); final TreeMap<String, GraphFunction> functions = Maps.newTreeMap(); for (Class<GraphFunction> cl : AVAILABLE_FUNCTIONS) { try { GraphFunction function = cl.newInstance(); functions.put(function.title(), function); } catch (Exception e) { throw new RuntimeException(e); } } final Composite functionContainer = tk().createComposite(parent, SWT.NONE); final ComboViewer combo = new ComboViewer(parent, SWT.SINGLE | SWT.BORDER | SWT.DROP_DOWN | SWT.READ_ONLY); combo.setContentProvider(new ArrayContentProvider()); combo.setInput(functions.keySet()); combo.addSelectionChangedListener(ev -> { String selected = SelectionAdapter.on(ev.getSelection()).first(String.class).get(); GraphFunction function = functions.get(selected); FormDataFactory.on(functionContainer).top(combo.getCombo(), 5).height(function.preferredHeight()) .left(0).right(100); UIUtils.disposeChildren(functionContainer); // create panel // Section section = tk().createSection( functionContainer, function.description(), ExpandableComposite.TREE_NODE, Section.SHORT_TITLE_BAR, Section.FOCUS_TITLE, SWT.BORDER ); // section.setBackground( UIUtils.getColor( 235, 235, 235) ); // ((Composite)section.getClient()).setLayout( FormLayoutFactory.defaults().create() ); IPanelSection section = tk().createPanelSection(functionContainer, function.description(), SWT.Expand, IPanelSection.EXPANDABLE); section.getControl().setBackground(UIUtils.getColor(235, 235, 235)); section.getBody().setBackground(UIUtils.getColor(235, 235, 235)); section.setExpanded(true); section.getBody().setLayout(FormLayoutFactory.defaults().create()); // graph.clear(); function.createContents(tk(), section.getBody(), graph); if (!section.isExpanded()) { section.setExpanded(true); } FormDataFactory.on(section.getBody()).fill(); // functionContainer.layout(); parent.layout(); }); // // mapContainer mapContainer = tk().createComposite(parent, SWT.NONE); mapContainer.setLayout(new FillLayout()); if (mapViewer != null) { mapViewer.dispose(); } createMapViewer(); // layout on(toolbar.getControl()).left(0, 3).right(100, -3).top(0, 5); final Label selectLabel = tk().createLabel(parent, i18n.get("selectFunction"), SWT.NONE); on(selectLabel).top(toolbar.getControl(), 8).left(1); on(combo.getCombo()).top(selectLabel, 2).left(1); on(functionContainer).top(combo.getCombo(), 5).height(0).left(0).right(100); on(mapContainer).fill().top(functionContainer, 5); } catch (Exception e) { StatusDispatcher.handleError("", e); } }
From source file:it.rcpvision.emf.components.binding.FormControlFactory.java
License:Open Source License
protected ControlObservablePair createControlAndObservableWithPredefinedProposals(List<?> proposals) { ComboViewer combo = new ComboViewer(parent, SWT.READ_ONLY); toolkit.adapt(combo.getCombo());//from w ww . j av a 2 s .co m combo.setContentProvider(new ArrayContentProvider()); combo.setLabelProvider(labelProviderProvider.get()); combo.setInput(proposals); ControlObservablePair retValAndTargetPair = new ControlObservablePair(); retValAndTargetPair.setControl(combo.getCombo()); retValAndTargetPair.setObservableValue(ViewersObservables.observeSingleSelection(combo)); return retValAndTargetPair; }
From source file:it.rcpvision.emf.components.old.ui.binding._EmfSwtBindingFactory.java
License:Open Source License
protected ControlObservablePair createControlAndObservableWithPredefinedProposals(List<?> proposals) { ComboViewer combo = new ComboViewer(parent, SWT.READ_ONLY); toolkit.adapt(combo.getCombo());/*from ww w . ja va 2 s . c o m*/ combo.setContentProvider(new ArrayContentProvider()); combo.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); combo.setInput(proposals); ControlObservablePair retValAndTargetPair = new ControlObservablePair(); retValAndTargetPair.setControl(combo.getCombo()); retValAndTargetPair.setObservableValue(ViewersObservables.observeSingleSelection(combo)); return retValAndTargetPair; }
From source file:madcow.magic.ui.application.MagicApplicationGUI.java
License:Open Source License
/** * Create contents of the window./*from w w w .j a v a 2 s . c o m*/ */ protected void createContents() { shlMagicCollectionBuilder = new Shell(); shlMagicCollectionBuilder.setSize(800, 850); shlMagicCollectionBuilder.setText(MagicLocales.MagicApplicationGUI_shlMagicCollectionBuilder_text); shlMagicCollectionBuilder.setLayout(new BorderLayout(0, 0)); Composite composite = new Composite(shlMagicCollectionBuilder, SWT.NONE); composite.setLayoutData(BorderLayout.NORTH); composite.setLayout(new GridLayout(8, false)); Label lblNumberOfCards = new Label(composite, SWT.NONE); lblNumberOfCards.setText(MagicLocales.MagicApplicationGUI_lblNumberOfCards_text); dbTotal = new Label(composite, SWT.NONE); GridData gd_dbTotal = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_dbTotal.widthHint = 46; dbTotal.setLayoutData(gd_dbTotal); dbTotal.setText("0"); Label lblLoadedCollection = new Label(composite, SWT.NONE); lblLoadedCollection.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblLoadedCollection.setText(MagicLocales.MagicApplicationGUI_lblLoadedCollection_text); collName = new Label(composite, SWT.NONE); GridData gd_collName = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_collName.widthHint = 74; collName.setLayoutData(gd_collName); collName.setText(MagicLocales.MagicApplicationGUI_label_text); Label lblowner = new Label(composite, SWT.NONE); lblowner.setText(MagicLocales.MagicApplicationGUI_lblowner_text); owner = new Label(composite, SWT.NONE); GridData gd_owner = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_owner.widthHint = 57; owner.setLayoutData(gd_owner); owner.setText(MagicLocales.MagicApplicationGUI_label_text_2); Label lblDescription = new Label(composite, SWT.NONE); lblDescription.setText(MagicLocales.MagicApplicationGUI_lblDescription_text); desc = new Label(composite, SWT.NONE); GridData gd_desc = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_desc.widthHint = 133; desc.setLayoutData(gd_desc); desc.setText(MagicLocales.MagicApplicationGUI_label_text_3); Composite composite_1 = new Composite(shlMagicCollectionBuilder, SWT.NONE); composite_1.setLayoutData(BorderLayout.SOUTH); composite_1.setLayout(new FillLayout(SWT.HORIZONTAL)); Label lblMad = new Label(composite_1, SWT.NONE); lblMad.setAlignment(SWT.RIGHT); lblMad.setText(MagicLocales.MagicApplicationGUI_lblMad_text); Menu menu = new Menu(shlMagicCollectionBuilder, SWT.BAR); shlMagicCollectionBuilder.setMenuBar(menu); MenuItem mntmFile = new MenuItem(menu, SWT.CASCADE); mntmFile.setText(MagicLocales.MagicApplicationGUI_mntmFile_text); Menu menu_1 = new Menu(mntmFile); mntmFile.setMenu(menu_1); MenuItem mntmNew_1 = new MenuItem(menu_1, SWT.CASCADE); mntmNew_1.setText(MagicLocales.MagicApplicationGUI_mntmNew_1_text); Menu menu_4 = new Menu(mntmNew_1); mntmNew_1.setMenu(menu_4); MenuItem mntmDatabase = new MenuItem(menu_4, SWT.NONE); mntmDatabase.addSelectionListener(new NewDatabaseSelectionAdapter()); mntmDatabase.setText(MagicLocales.MagicApplicationGUI_mntmNew_text); MenuItem mntmBlock = new MenuItem(menu_4, SWT.NONE); mntmBlock.addSelectionListener(new NewBlockSelectionAdapter()); mntmBlock.setText(MagicLocales.MagicApplicationGUI_mntmContainer_text); MenuItem mntmSet = new MenuItem(menu_4, SWT.NONE); mntmSet.addSelectionListener(new NewSetSelectionAdapter()); mntmSet.setText(MagicLocales.MagicApplicationGUI_mntmSet_text); MenuItem mntmCollection = new MenuItem(menu_4, SWT.NONE); mntmCollection.addSelectionListener(new NewCollectionSelectionAdapter()); mntmCollection.setText(MagicLocales.MagicApplicationGUI_mntmCollection_text); MenuItem mntmDeck = new MenuItem(menu_4, SWT.NONE); mntmDeck.addSelectionListener(new NewDeckSelectionAdapter()); mntmDeck.setText(MagicLocales.MagicApplicationGUI_mntmDeck_text); MenuItem mntmOpen = new MenuItem(menu_1, SWT.NONE); mntmOpen.addSelectionListener(new OpenFileSelectionAdapter()); mntmOpen.setText(MagicLocales.MagicApplicationGUI_mntmOpen_text); MenuItem mntmSave = new MenuItem(menu_1, SWT.NONE); mntmSave.addSelectionListener(new SaveSelectionAdapter()); mntmSave.setText(MagicLocales.MagicApplicationGUI_mntmSave_text); MenuItem mntmExit = new MenuItem(menu_1, SWT.NONE); mntmExit.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { shlMagicCollectionBuilder.dispose(); } }); mntmExit.setText(MagicLocales.MagicApplicationGUI_mntmExit_text); MenuItem mntmOptions = new MenuItem(menu, SWT.CASCADE); mntmOptions.setText(MagicLocales.MagicApplicationGUI_mntmOptions_text); Menu menu_3 = new Menu(mntmOptions); mntmOptions.setMenu(menu_3); MenuItem mntmPreferences = new MenuItem(menu_3, SWT.NONE); mntmPreferences.addSelectionListener(new PreferencesSelectionAdapter()); mntmPreferences.setText(MagicLocales.MagicApplicationGUI_mntmLanguage_text); online = new MenuItem(menu_3, SWT.CHECK); online.setText(MagicLocales.MagicApplicationGUI_mntmOnline_text); MenuItem mntmHelp = new MenuItem(menu, SWT.CASCADE); mntmHelp.setText(MagicLocales.MagicApplicationGUI_mntmHelp_text); Menu menu_2 = new Menu(mntmHelp); mntmHelp.setMenu(menu_2); MenuItem mntmHelpContents = new MenuItem(menu_2, SWT.NONE); mntmHelpContents.setText(MagicLocales.MagicApplicationGUI_mntmHelpContents_text); MenuItem mntmAbout = new MenuItem(menu_2, SWT.NONE); mntmAbout.setText(MagicLocales.MagicApplicationGUI_mntmAbout_text); Composite composite_5 = new Composite(shlMagicCollectionBuilder, SWT.NONE); composite_5.setLayoutData(BorderLayout.EAST); composite_5.setLayout(new GridLayout(3, false)); new Label(composite_5, SWT.NONE); Label lblName = new Label(composite_5, SWT.NONE); lblName.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblName.setText(MagicLocales.MagicApplicationGUI_lblName_text); cardName = new Text(composite_5, SWT.BORDER); GridData gd_cardName = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); gd_cardName.widthHint = 114; cardName.setLayoutData(gd_cardName); new Label(composite_5, SWT.NONE); Label lblNumber = new Label(composite_5, SWT.NONE); lblNumber.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblNumber.setText(MagicLocales.MagicApplicationGUI_lblNumber_text); manaCost = new Text(composite_5, SWT.BORDER); manaCost.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); new Label(composite_5, SWT.NONE); Label lblType = new Label(composite_5, SWT.NONE); lblType.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.NORMAL)); GridData gd_lblType = new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1); gd_lblType.heightHint = 15; lblType.setLayoutData(gd_lblType); lblType.setText(MagicLocales.MagicApplicationGUI_lblType_text); convertedManaCost = new Text(composite_5, SWT.BORDER); GridData gd_convertedManaCost = new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1); gd_convertedManaCost.widthHint = 28; convertedManaCost.setLayoutData(gd_convertedManaCost); new Label(composite_5, SWT.NONE); Label lblTypes = new Label(composite_5, SWT.NONE); lblTypes.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblTypes.setText(MagicLocales.MagicApplicationGUI_lblTypes_text); types = new Text(composite_5, SWT.BORDER); types.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); new Label(composite_5, SWT.NONE); Label lblSubtypes = new Label(composite_5, SWT.NONE); lblSubtypes.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblSubtypes.setText(MagicLocales.MagicApplicationGUI_lblSubtypes_text); subTypes = new Text(composite_5, SWT.BORDER); subTypes.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); new Label(composite_5, SWT.NONE); Label lblCardText = new Label(composite_5, SWT.NONE); lblCardText.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblCardText.setText(MagicLocales.MagicApplicationGUI_lblCardText_text); cardText = new Text(composite_5, SWT.BORDER | SWT.MULTI); cardText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); new Label(composite_5, SWT.NONE); new Label(composite_5, SWT.NONE); new Label(composite_5, SWT.NONE); new Label(composite_5, SWT.NONE); Label lblFlavorText = new Label(composite_5, SWT.NONE); lblFlavorText.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblFlavorText.setText(MagicLocales.MagicApplicationGUI_lblFlavorText_text); flavorText = new Text(composite_5, SWT.BORDER); flavorText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); new Label(composite_5, SWT.NONE); Label lblPt = new Label(composite_5, SWT.NONE); lblPt.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblPt.setText(MagicLocales.MagicApplicationGUI_lblPt_text); Composite composite_7 = new Composite(composite_5, SWT.NONE); composite_7.setLayout(new RowLayout(SWT.HORIZONTAL)); GridData gd_composite_7 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_composite_7.widthHint = 127; gd_composite_7.heightHint = 24; composite_7.setLayoutData(gd_composite_7); power = new Text(composite_7, SWT.BORDER); power.setLayoutData(new RowData(20, SWT.DEFAULT)); Label label_2 = new Label(composite_7, SWT.NONE); label_2.setText("/"); toughness = new Text(composite_7, SWT.BORDER); toughness.setLayoutData(new RowData(20, SWT.DEFAULT)); new Label(composite_5, SWT.NONE); Label lblExpansion = new Label(composite_5, SWT.NONE); lblExpansion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblExpansion.setText(MagicLocales.MagicApplicationGUI_lblExpansion_text); expansion = new Text(composite_5, SWT.BORDER); expansion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); new Label(composite_5, SWT.NONE); Label lblRarity = new Label(composite_5, SWT.NONE); lblRarity.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblRarity.setText(MagicLocales.MagicApplicationGUI_lblRarity_text); rarityViewer = new ComboViewer(composite_5, SWT.NONE); Combo rarity = rarityViewer.getCombo(); rarity.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); new Label(composite_5, SWT.NONE); Label lblOtherSets = new Label(composite_5, SWT.NONE); lblOtherSets.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblOtherSets.setText(MagicLocales.MagicApplicationGUI_lblOtherSets_text); otherSetsViewer = new ListViewer(composite_5, SWT.BORDER | SWT.V_SCROLL); List otherSets = otherSetsViewer.getList(); otherSets.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); new Label(composite_5, SWT.NONE); Label lblNumber_1 = new Label(composite_5, SWT.NONE); lblNumber_1.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblNumber_1.setText(MagicLocales.MagicApplicationGUI_lblNumber_1_text); number = new Text(composite_5, SWT.BORDER); number.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Label label = new Label(composite_5, SWT.NONE); GridData gd_label = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_label.widthHint = 54; label.setLayoutData(gd_label); label.setText(MagicLocales.MagicApplicationGUI_label_text_4); Label lblArtist = new Label(composite_5, SWT.NONE); lblArtist.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblArtist.setText(MagicLocales.MagicApplicationGUI_lblArtist_text); artist = new Text(composite_5, SWT.BORDER); artist.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); image = new Label(composite_5, SWT.NONE); image.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); image.setText(MagicLocales.MagicApplicationGUI_image_text); Image i = ResourceManager.getPluginImage("madcow.magic.ui", "images/back.jpg"); empty = CardFactory.eINSTANCE.createCard(); card2imageMap.put(empty, i); Composite composite_8 = new Composite(shlMagicCollectionBuilder, SWT.NONE); composite_8.setLayoutData(BorderLayout.CENTER); composite_8.setLayout(new BorderLayout(0, 0)); TabFolder tabFolder = new TabFolder(composite_8, SWT.NONE); tabFolder.addSelectionListener(new TabSelectionAdapter()); tabFolder.setLayoutData(BorderLayout.NORTH); TabItem tbtmDatabase = new TabItem(tabFolder, SWT.NONE); tbtmDatabase.setText(MagicLocales.MagicApplicationGUI_tbtmDatabase_text); Composite composite_2 = new Composite(tabFolder, SWT.NONE); tbtmDatabase.setControl(composite_2); composite_2.setLayout(new BorderLayout(0, 0)); Composite composite_4 = new Composite(composite_2, SWT.NONE); composite_4.setLayoutData(BorderLayout.CENTER); composite_4.setLayout(new GridLayout(2, false)); Label lblSet = new Label(composite_4, SWT.NONE); lblSet.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblSet.setText(MagicLocales.MagicApplicationGUI_lblSet_text); blockViewer = new ComboViewer(composite_4, SWT.NONE); Combo blockCombo = blockViewer.getCombo(); GridData gd_blockCombo = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_blockCombo.widthHint = 151; blockCombo.setLayoutData(gd_blockCombo); blockCombo.addSelectionListener(new BlockSelectionAdapter()); Label lblSet_1 = new Label(composite_4, SWT.NONE); lblSet_1.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblSet_1.setText(MagicLocales.MagicApplicationGUI_lblSet_1_text); setViewer = new ComboViewer(composite_4, SWT.NONE); Combo setCombo = setViewer.getCombo(); GridData gd_setCombo = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_setCombo.widthHint = 151; setCombo.setLayoutData(gd_setCombo); setCombo.addSelectionListener(new SetSelectionAdapter()); TabItem tbtmCollections = new TabItem(tabFolder, SWT.NONE); tbtmCollections.setText(MagicLocales.MagicApplicationGUI_tbtmCollections_text); Composite composite_3 = new Composite(tabFolder, SWT.NONE); tbtmCollections.setControl(composite_3); composite_3.setLayout(new BorderLayout(0, 0)); Composite composite_9 = new Composite(composite_3, SWT.NONE); composite_9.setLayoutData(BorderLayout.CENTER); composite_9.setLayout(new GridLayout(7, false)); Label lblContainers = new Label(composite_9, SWT.NONE); lblContainers.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblContainers.setText(MagicLocales.MagicApplicationGUI_lblContainers_text); containers = new ComboViewer(composite_9, SWT.NONE); Combo combo = containers.getCombo(); combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); new Label(composite_9, SWT.NONE); new Label(composite_9, SWT.NONE); new Label(composite_9, SWT.NONE); Label lblNumbername = new Label(composite_9, SWT.NONE); lblNumbername.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblNumbername.setText(MagicLocales.MagicApplicationGUI_lblNumbername_text); insertNum = new Text(composite_9, SWT.BORDER); GridData gd_insertNum = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_insertNum.widthHint = 50; insertNum.setLayoutData(gd_insertNum); Label lblExpansion_1 = new Label(composite_9, SWT.NONE); lblExpansion_1.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblExpansion_1.setText(MagicLocales.MagicApplicationGUI_lblExpansion_1_text); insertSetId = new Text(composite_9, SWT.BORDER); insertSetId.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); cbFoil = new Button(composite_9, SWT.CHECK); cbFoil.setText(MagicLocales.MagicApplicationGUI_cbFoil_text); Composite composite_10 = new Composite(composite_9, SWT.NONE); composite_10.setLayout(new GridLayout(1, false)); cbProxy = new Button(composite_10, SWT.CHECK); cbProxy.setText(MagicLocales.MagicApplicationGUI_cbProxy_text); Button btnInsert = new Button(composite_9, SWT.NONE); btnInsert.addSelectionListener(new InsertSelectionAdapter()); btnInsert.setText(MagicLocales.MagicApplicationGUI_btnInser_text); Composite composite_6 = new Composite(composite_8, SWT.NONE); composite_6.setLayoutData(BorderLayout.CENTER); composite_6.setLayout(new GridLayout(1, false)); cardViewer = new TableViewer(composite_6, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI); cardViewer.setColumnProperties(new String[] {}); cardViewer.addSelectionChangedListener(new CardSelectionChangedListener()); table = cardViewer.getTable(); table.setHeaderVisible(true); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); TableViewerColumn tableViewerColumn = new TableViewerColumn(cardViewer, SWT.NONE); new CardTableColumnSorter(tableViewerColumn); TableColumn tblclmnName = tableViewerColumn.getColumn(); tblclmnName.setWidth(226); tblclmnName.setText(MagicLocales.MagicApplicationGUI_tblclmnName_text); TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(cardViewer, SWT.NONE); new CardTableColumnSorter(tableViewerColumn_1); TableColumn tblclmnNumber = tableViewerColumn_1.getColumn(); tblclmnNumber.setWidth(47); tblclmnNumber.setText(MagicLocales.MagicApplicationGUI_tblclmnNumber_text); TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(cardViewer, SWT.NONE); new CardTableColumnSorter(tableViewerColumn_2); TableColumn tblclmnType = tableViewerColumn_2.getColumn(); tblclmnType.setWidth(147); tblclmnType.setText(MagicLocales.MagicApplicationGUI_tblclmnType_text); Menu menu_5 = new Menu(table); table.setMenu(menu_5); MenuItem mDelete = new MenuItem(menu_5, SWT.NONE); mDelete.addSelectionListener(new DeleteSelectionAdapter()); mDelete.setText(MagicLocales.MagicApplicationGUI_mDelete_text); mntmMoveTo = new MenuItem(menu_5, SWT.NONE); mntmMoveTo.addSelectionListener(new MoveSelectionAdapter()); mntmMoveTo.setText(MagicLocales.MagicApplicationGUI_mntmMoveTo_1_text); MenuItem mntmDuplicate = new MenuItem(menu_5, SWT.NONE); mntmDuplicate.addSelectionListener(new DuplicateSelectionAdapter()); mntmDuplicate.setText(MagicLocales.MagicApplicationGUI_mntmDuplicate_text); }
From source file:net.geoprism.oda.driver.ui.editors.GeoprismDataSetEditorPage.java
License:Open Source License
/** * Create page for the geodashbaord dataset definition * //ww w . j a v a2 s . c o m * @param parent * @return */ private Control createPageControl(Composite parent) { // Group for selecting the Tables etc // Searching the Tables and Views GridLayout groupLayout = new GridLayout(); groupLayout.numColumns = 3; groupLayout.verticalSpacing = 10; GridData selectTableData = new GridData(GridData.FILL_HORIZONTAL); Group selectTableGroup = new Group(parent, SWT.FILL); selectTableGroup.setLayout(groupLayout); selectTableGroup.setLayoutData(selectTableData); try { LabelValuePair[] queries = this.provider.getQueries(TIME_OUT_LIMIT * 1000); LabelValuePair[] entities = this.provider.getEntitySuggestions("", TIME_OUT_LIMIT * 1000); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; /* * Create a combo viewer to select the query */ Label schemaLabel = new Label(selectTableGroup, SWT.LEFT); schemaLabel.setText(GeoprismPlugin.getResourceString("dashboardpage.label.selectdashboard")); //$NON-NLS-1$ this.queryCombo = new ComboViewer(selectTableGroup, SWT.READ_ONLY); this.queryCombo.getControl().setLayoutData(gd); this.queryCombo.setContentProvider(new ArrayContentProvider()); this.queryCombo.setLabelProvider(new DataSetTypeLabelProvider()); this.queryCombo.setInput(queries); this.queryCombo.addSelectionChangedListener(this); /* * Create a combo viewer to select the geo node */ Label geoNodeLabel = new Label(selectTableGroup, SWT.LEFT); geoNodeLabel.setText(GeoprismPlugin.getResourceString("dashboardpage.label.geoNode")); //$NON-NLS-1$ this.nodeCombo = new ComboViewer(selectTableGroup, SWT.READ_ONLY); this.nodeCombo.getControl().setLayoutData(gd); this.nodeCombo.setContentProvider(new ArrayContentProvider()); this.nodeCombo.setLabelProvider(new DataSetTypeLabelProvider()); /* * Create a combo viewer to select the aggregation level */ Label aggregationLabel = new Label(selectTableGroup, SWT.LEFT); aggregationLabel.setText(GeoprismPlugin.getResourceString("dashboardpage.label.aggregation")); //$NON-NLS-1$ this.aggregationCombo = new ComboViewer(selectTableGroup, SWT.READ_ONLY); this.aggregationCombo.getControl().setLayoutData(gd); this.aggregationCombo.setContentProvider(new ArrayContentProvider()); this.aggregationCombo.setLabelProvider(new DataSetTypeLabelProvider()); /* * Create a combo viewer to select the default geo id */ Label entityLabel = new Label(selectTableGroup, SWT.LEFT); entityLabel.setText(GeoprismPlugin.getResourceString("dashboardpage.label.defaultGeoId")); //$NON-NLS-1$ this.entityCombo = new ComboViewer(selectTableGroup, SWT.READ_ONLY); this.entityCombo.getControl().setLayoutData(gd); this.entityCombo.setContentProvider(new ArrayContentProvider()); this.entityCombo.setLabelProvider(new DataSetTypeLabelProvider()); this.entityCombo.setInput(entities); /* * Initialize all of the combo views with the first selection. This must be done after the viewers have been * created because setting the selection will invoke any selection handler. */ if (queries.length > 0) { this.queryCombo.setSelection(new StructuredSelection(queries[0])); } if (entities.length > 0) { this.entityCombo.setSelection(new StructuredSelection(entities[0])); } this.initialized = true; } catch (ConnectionException ex) { Shell shell = parent.getShell(); String label = GeoprismPlugin.getResourceString("dataset.error"); //$NON-NLS-1$ String message = GeoprismPlugin.getResourceString("dashboardpage.label.connectionerror"); //$NON-NLS-1$ // String message = ex.getLocalizedMessage(); ExceptionHandler.showException(shell, label, message, ex); Text exceptionLabel = new Text(selectTableGroup, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY); exceptionLabel.setLayoutData(new GridData(GridData.FILL_BOTH)); exceptionLabel.setText(message); return null; } return selectTableGroup; }
From source file:net.geoprism.shapefile.locatedIn.LocatedInPage.java
License:Open Source License
@Override public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NULL); composite.setLayout(new GridLayout(2, false)); new Label(composite, SWT.NULL).setText(Localizer.getMessage("ALGORITHM") + ": "); option = new ComboViewer(composite, SWT.BORDER | SWT.READ_ONLY); option.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); option.setContentProvider(new OptionContentProvider()); option.setLabelProvider(new LabelProvider()); option.setInput(bean);//from w w w. j a v a 2 s . co m new Label(composite, SWT.NULL).setText(Localizer.getMessage("OVERLAP_PERCENT") + ": "); overlapPercent = new Scale(composite, SWT.HORIZONTAL); overlapPercent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); overlapPercent.setMinimum(0); overlapPercent.setMaximum(100); overlapPercent.setIncrement(1); overlapPercent.setPageIncrement(10); currentPercent = new Label(composite, SWT.LEFT | SWT.FILL); currentPercent.setText(this.bean.getOverlapPercent() + "% "); overlapPercent.addListener(SWT.Selection, new OverlapListener()); this.setControl(composite); this.bind(option, "option"); this.bind(overlapPercent, "overlapPercent"); }