private Text createAttributeText ( final String attribute ) { final Text t = new Text ( this, SWT.BORDER ); final Fields field = Fields.byField ( attribute ); if ( field == null ) { t.setEditable ( true ); t.setMessage ( Messages.custom_field ); } else { t.setEditable ( false ); t.setText ( field.getName () ); } t.addKeyListener ( new KeyAdapter () { @Override public void keyReleased ( final KeyEvent e ) { AssertionComposite.this.orCondition.updateFilter (); }; } ); final RowData rowData = new RowData (); rowData.width = 132; t.setLayoutData ( rowData ); return t; }
private Combo createAssertionCombo () { final Combo c = new Combo ( this, SWT.NONE ); for ( final Assertion assertion : Assertion.values () ) { c.add ( assertion.toString () ); } c.select ( 0 ); c.addSelectionListener ( new SelectionAdapter () { @Override public void widgetSelected ( final SelectionEvent e ) { AssertionComposite.this.orCondition.updateFilter (); } } ); final RowData rowData = new RowData (); rowData.width = 75; c.setLayoutData ( rowData ); return c; }
private Text createValueText () { final Text t = new Text ( this, SWT.BORDER ); t.setMessage ( Messages.argument ); t.addKeyListener ( new KeyAdapter () { @Override public void keyReleased ( final KeyEvent e ) { AssertionComposite.this.orCondition.updateFilter (); } } ); final RowData rowData = new RowData (); rowData.width = 132; t.setLayoutData ( rowData ); return t; }
protected Control createDialogArea(Composite parent) { Composite area = (Composite) super.createDialogArea(parent); Composite container = new Composite(area, SWT.NONE); RowLayout layout = new RowLayout(SWT.HORIZONTAL); container.setLayout(layout); // container.setLayoutData(new GridData(GridData.FILL_BOTH)); // TitleArea中的Title setTitle("属性文件更新"); // TitleArea中的Message setMessage("输入正确的url地址,以更新文件。\n可提示的属性数量会根据当前项目存在的jar包,对已有属性增加或者删除!"); Label label = new Label(container, SWT.NONE); label.setText("项目URL: "); combo = new Combo(container, SWT.DROP_DOWN); String[] items = new String[getUrlMap().size()]; getUrlMap().values().toArray(items); combo.setItems(items); String url = getPreferedUrl(projectName); combo.setText(url); combo.setLayoutData(new RowData(400, 30)); return area; }
public GenericResourceLoadControl(Composite parent, SaveLoadConfig<T> config) { super(parent, SWT.NONE); this.config = config; setLayout(new RowLayout()); Button loadButton = new Button(this, SWT.PUSH); loadButton.setText(config.getLoadLabel()); loadButton.setLayoutData(new RowData()); loadButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleLoad(); } }); }
public GenericResourceSaveControl(Composite parent, SaveLoadConfig<T> config) { super(parent, SWT.NONE); this.config = config; setLayout(new RowLayout()); Button saveButton = new Button(this, SWT.PUSH); saveButton.setText(config.getSaveLabel()); saveButton.setLayoutData(new RowData()); saveButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleSave(); } }); }
private void refreshSelected() { int selected = menu.getSelectionIndex(); adjustSelectedElement(); for (int i=0; i<elements.size(); i++) { if (i != selected) { ListPaneElement element =(ListPaneElement)elements.get(i); element.getComposite().setVisible(false); RowData dt = new RowData(); dt.exclude = true; element.getComposite().setLayoutData(dt); } } panes.layout(true); }
public Composite addElement(String key, String label) { Composite composite = new Composite(panes, SWT.NONE); RowData dt = new RowData(); dt.exclude = elements.size() != 0; composite.setLayoutData(dt); GridLayout lyt = new GridLayout(1, false); lyt.marginHeight = 0; lyt.marginWidth = 0; composite.setLayout(lyt); if (showTitles) { Label lbl = new Label(composite, SWT.NONE); lbl.setText(label); lbl.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); } menu.add(label + " "); Composite content = new Composite(composite, style); content.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); elements.add(new ListPaneElement(key, label, composite)); return content; }
private void initText() { String txt = "Droid Navi " + DroidNavi.VERSION + "\n\n" + "Licensed under LGPL v2.0\n\n" + "Libraries in use:\n" + "Jackson JSON Processor 1.9.13\n" + "Standard Widget Toolkti (SWT) 4.4\n" + "QRGen 1.4\n" + "Zxing Java Core 3.0\n" + "Log4j2 2.0 RC1"; Label text = new Label(getWindowShell(), SWT.LEFT); text.setText(txt); Label space = new Label(getWindowShell(), SWT.NONE); RowData data = new RowData(); data.height = 10; space.setLayoutData(data); }
protected CLabel createContextButton (String text, Image icon) { CLabel lbl = new CLabel(buttonsContainer, SWT.NONE); lbl.setLayoutData(new RowData(SWT.DEFAULT, 28)); lbl.setRightMargin(10); lbl.setLeftMargin(8); lbl.setText(text); lbl.setImage(icon); lbl.setBackground(ColorResources.COLOR_CS_BLUE); lbl.setForeground(ColorResources.COLOR_WHITE); lbl.setCursor(new Cursor(getDisplay(), SWT.CURSOR_HAND)); contextButtonsMap.put(lbl, text); return lbl; }
void hideExcessiveLeftMostPathButtons() { final Control[] pathButtons = pathButtonBar.getChildren(); final int width = pathButtonBar.getBounds().width; for ( int ndx = 0; ndx < pathButtons.length && pathButtonBar.computeSize( SWT.DEFAULT, SWT.DEFAULT ).x > width; ++ndx ) { scrollPathBarLeftButton.setVisible( true ); final Control pathButton = pathButtons[ ndx ]; if ( pathButton.isVisible() ) { pathButton.setVisible( false ); ( ( RowData ) pathButton.getLayoutData() ).exclude = true; } } scrollPathBarLeftButton.setVisible( pathButtons.length == 0 ? false : ( ( RowData ) ( ( Label ) pathButtons[ 0 ] ).getLayoutData() ).exclude ); scrollPathBarRightButton.setVisible( pathButtons.length == 0 ? false : ( ( RowData ) ( ( Label ) pathButtons[ pathButtons.length - 1 ] ).getLayoutData() ).exclude ); pathButtonBar.layout(); pathButtonBar.getParent().layout(); }
/** * {@inheritDoc} * * @see org.modeshape.modeler.ui.FocusTreeView#newPathButton(java.lang.String, java.lang.String, java.lang.Object, * java.lang.Object) */ @Override public Object newPathButton( final String text, final String description, final Object backgroundColor, final Object foregroundColor ) { final Label button = new Label( pathButtonBar, SWT.NONE ); button.setText( text ); button.setToolTipText( description ); button.setBackground( ( Color ) backgroundColor ); button.setForeground( ( Color ) foregroundColor ); button.setAlignment( SWT.CENTER ); final Point size = button.computeSize( SWT.DEFAULT, SWT.DEFAULT ); button.setLayoutData( new RowData( size.x + 10, size.y ) ); button.addPaintListener( pathButtonPaintListener ); hideExcessiveLeftMostPathButtons(); return button; }
/** * {@inheritDoc} * * @see org.modeshape.modeler.ui.FocusTreeView#scrollPathBarRight() */ @Override public void scrollPathBarRight() { final Control[] pathButtons = pathButtonBar.getChildren(); // Show first hidden path button on right for ( int ndx = pathButtons.length; --ndx >= 0; ) { Control pathButton = pathButtons[ ndx ]; if ( pathButton.isVisible() ) { // Show next path button pathButton = pathButtons[ ++ndx ]; pathButton.setVisible( true ); ( ( RowData ) pathButton.getLayoutData() ).exclude = false; break; } } // Hide first shown path button on left until all buttons fit in button bar hideExcessiveLeftMostPathButtons(); }
void hideExcessiveLeftMostPathButtons() { final Control[] pathButtons = pathButtonBar.getChildren(); final int width = pathButtonBar.getBounds().width; for ( int ndx = 0; ndx < pathButtons.length && pathButtonBar.computeSize( SWT.DEFAULT, SWT.DEFAULT ).x > width; ++ndx ) { leftPathBarButton.setVisible( true ); final Control pathButton = pathButtons[ ndx ]; if ( pathButton.isVisible() ) { pathButton.setVisible( false ); ( ( RowData ) pathButton.getLayoutData() ).exclude = true; } } leftPathBarButton.setVisible( pathButtons.length == 0 ? false : ( ( RowData ) ( ( Label ) pathButtons[ 0 ] ).getLayoutData() ).exclude ); rightPathBarButton.setVisible( pathButtons.length == 0 ? false : ( ( RowData ) ( ( Label ) pathButtons[ pathButtons.length - 1 ] ).getLayoutData() ).exclude ); pathButtonBar.layout(); pathButtonBar.getParent().layout(); }
void scrollPathBarRight() { final Control[] pathButtons = pathButtonBar.getChildren(); // Show first hidden path button on right for ( int ndx = pathButtons.length; --ndx >= 0; ) { Control pathButton = pathButtons[ ndx ]; if ( pathButton.isVisible() ) { // Show next path button pathButton = pathButtons[ ++ndx ]; pathButton.setVisible( true ); ( ( RowData ) pathButton.getLayoutData() ).exclude = false; break; } } // Hide first shown path button on left until all buttons fit in button bar hideExcessiveLeftMostPathButtons(); }
@Override protected Control createDialogArea(final Composite parent) { final Composite area = (Composite)super.createDialogArea(parent); container = new Composite(area, SWT.NONE); container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); container.setLayout(RowLayoutFactory.swtDefaults().type(SWT.VERTICAL).wrap(true).create()); constraintContainer = new Composite(container, SWT.NONE); constraintContainer.setLayout(RowLayoutFactory.swtDefaults().wrap(true).type(SWT.HORIZONTAL).create()); validationMessageLabel = new Label(container, SWT.WRAP); container.addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { constraintContainer.setLayoutData(new RowData(container.getSize().x, SWT.DEFAULT)); validationMessageLabel.setLayoutData(new RowData(container.getSize().x, SWT.DEFAULT)); } }); refreshContraint(); return area; }
private void createAllEntries () { final Composite extensionSpace = this.extensionSpaceProvider.getExtensionSpace (); if ( extensionSpace == null ) { return; } this.wrapper = new Composite ( extensionSpace, SWT.NONE ); final RowLayout layout = new RowLayout ( SWT.HORIZONTAL ); layout.marginTop = layout.marginBottom = 0; this.wrapper.setLayout ( layout ); int i = 0; for ( final Profile profile : this.profiles ) { final ProfileEntry entry = createProfileEntry ( profile, i ); if ( entry != null ) { this.profileEntries.put ( profile.getId (), entry ); } i++; } final Label sep = new Label ( this.wrapper, SWT.SEPARATOR | SWT.VERTICAL ); sep.setLayoutData ( new RowData ( SWT.DEFAULT, 20 ) ); extensionSpace.layout (); }
public SeparatorController ( final ControllerManager controllerManager, final ChartContext chartContext, final org.eclipse.scada.ui.chart.model.SeparatorController controller ) { final Composite space = chartContext.getExtensionSpaceProvider ().getExtensionSpace (); if ( space != null ) { this.label = new Label ( space, SWT.SEPARATOR | SWT.VERTICAL ); this.label.setLayoutData ( new RowData ( 20, SWT.DEFAULT ) ); space.layout (); } else { this.label = null; } }
public ValueComposite ( final Composite parent, final int style, final DataItemDescriptor descriptor, final String format, final String decimal, final boolean isText, final String attribute, final Boolean isDate, final String hdConnectionId, final String hdItemId, final String queryString ) { super ( parent, style, format, decimal, isText, attribute ); this.isDate = isDate; final RowLayout layout = new RowLayout (); layout.wrap = false; layout.center = true; layout.spacing = 7; layout.pack = true; setLayout ( layout ); this.controlImage = new ControlImage ( this, this.registrationManager ); Helper.createTrendButton ( this.controlImage, hdConnectionId, hdItemId, queryString ); this.dataLabel = new Label ( this, SWT.NONE ); final RowData rowData = new RowData ( 80, SWT.DEFAULT ); this.dataLabel.setAlignment ( SWT.RIGHT ); this.dataLabel.setLayoutData ( rowData ); this.dataLabel.setText ( "" ); //$NON-NLS-1$ new DescriptorLabel ( this, SWT.NONE, format, descriptor ); if ( descriptor != null ) { this.controlImage.setDetailItem ( descriptor.asItem () ); this.registrationManager.registerItem ( "value", descriptor.getItemId (), descriptor.getConnectionInformation (), false, false ); //$NON-NLS-1$ } }
private void createDisplayUi() { RowLayout rowLayout = new RowLayout(); rowLayout.wrap = true; rowLayout.pack = false; rowLayout.justify = true; rowLayout.fill = true; rowLayout.type = SWT.HORIZONTAL; mBottomPanel.setLayout(rowLayout); IPreferenceStore store = DdmUiPreferences.getStore(); int displayWidth = store.getInt(PREFS_DISPLAY_WIDTH); int displayHeight = store.getInt(PREFS_DISPLAY_HEIGHT); for (EventDisplay eventDisplay : mEventDisplays) { Control c = eventDisplay.createComposite(mBottomPanel, mCurrentEventLogParser, this); if (c != null) { RowData rd = new RowData(); rd.height = displayHeight; rd.width = displayWidth; c.setLayoutData(rd); } Table table = eventDisplay.getTable(); if (table != null) { addTableToFocusListener(table); } } mBottomPanel.layout(); mBottomParentPanel.setMinSize(mBottomPanel.computeSize(SWT.DEFAULT, SWT.DEFAULT)); mBottomParentPanel.layout(); }
public CameraDirectionGroup(Composite parent) { super(parent, SWT.NONE); setLayout(new FillLayout(SWT.HORIZONTAL)); Group group = new Group(this, SWT.NONE); group.setText("Camera Direction"); RowLayout row = new RowLayout(SWT.HORIZONTAL); row.marginTop = 0; row.marginBottom = 0; row.marginLeft = 0; row.marginRight = 0; row.justify = true; row.pack = false; group.setLayout(row); xdirInput = new DirectionInput(group, "X-Dir", "Ctrl + Up/Down" + "\nShift + Mouse-Left" + "\nVertical rotates X"); xdirInput.setLayoutData(new RowData()); xdirInput.addModifyListener(INPUT_LISTENER); ydirInput = new DirectionInput(group, "Y-Dir", ""); ydirInput.setLayoutData(new RowData()); ydirInput.addModifyListener(INPUT_LISTENER); zdirInput = new DirectionInput(group, "Z-Dir", "Ctrl + Left/Right" + "\nShift + Mouse-Left" + "\nHorizontal rotates Z"); zdirInput.setLayoutData(new RowData()); zdirInput.addModifyListener(INPUT_LISTENER); }
public CameraPositionGroup(Composite parent) { super(parent, SWT.NONE); setLayout(new FillLayout(SWT.HORIZONTAL)); Group group = new Group(this, SWT.NONE); group.setText("Camera Position"); RowLayout row = new RowLayout(SWT.HORIZONTAL); row.marginTop = 0; row.marginBottom = 0; row.marginLeft = 0; row.marginRight = 0; row.justify = true; row.pack = false; group.setLayout(row); xposInput = new PositionInput(group, "X-Pos", "Left/Right"); xposInput.setLayoutData(new RowData()); xposInput.addModifyListener(INPUT_LISTENER); yposInput = new PositionInput(group, "Y-Pos", "Up/Down"); yposInput.setLayoutData(new RowData()); yposInput.addModifyListener(INPUT_LISTENER); zposInput = new PositionInput(group, "Z-Pos", "Page-Up/Page-Dn"); zposInput.setLayoutData(new RowData()); zposInput.setLimits((int) GLConstants.ZOOM_MAX, (int) (GLConstants.Z_FAR - 1)); zposInput.addModifyListener(INPUT_LISTENER); }
public ToolSeparator(Composite parent, int style, boolean isHorizontal) { super(parent, style); this.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_NORMAL_SHADOW)); if (isHorizontal) { this.setLayoutData(new RowData(1, 25)); } else { this.setLayoutData(new RowData(25, 1)); } }
public static CLabel createLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory, String txt, int width) { CLabel lbl = widgetFactory.createCLabel(parent, txt, SWT.RIGHT); if (parent.getLayout() instanceof RowLayout) { RowData rd = new RowData(); rd.width = width; lbl.setLayoutData(rd); } else if (parent.getLayout() instanceof GridLayout) { GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_BEGINNING); if (width > 0) gd.minimumWidth = width; lbl.setLayoutData(gd); } return lbl; }
protected void createComponent(Composite parent) { composite = section.getWidgetFactory().createComposite(parent); RowLayout layout = new RowLayout(SWT.HORIZONTAL); layout.wrap = true; layout.marginHeight = 0; layout.marginWidth = 0; layout.center = true; composite.setLayout(layout); scale = new Scale(composite, SWT.HORIZONTAL); scale.setMinimum(0); scale.setMaximum(100); scale.setIncrement(1); scale.setPageIncrement(5); RowData rd = new RowData(); rd.width = 100; scale.setLayoutData(rd); scale.setToolTipText(pDescriptor.getDescription()); scale.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (!isRefresh) ftext.setText("" + (scale.getSelection() / 100f)); } }); super.createComponent(composite); }
public static Label createLabel(Composite parent, String txt, int span) { Label lbl = new Label(parent, SWT.RIGHT); lbl.setText(txt); if (parent.getLayout() instanceof RowLayout) { RowData rd = new RowData(); lbl.setLayoutData(rd); } else if (parent.getLayout() instanceof GridLayout) { GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_BEGINNING); gd.verticalIndent = 5; if (span > 0) gd.horizontalSpan = span; lbl.setLayoutData(gd); } return lbl; }
public static Label createSeparator(Composite parent, int span) { Label lbl = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.WRAP); if (parent.getLayout() instanceof RowLayout) { RowData rd = new RowData(); lbl.setLayoutData(rd); } else if (parent.getLayout() instanceof GridLayout) { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = span; lbl.setLayoutData(gd); } return lbl; }
/** Sets the layouData on the Control to a new GridData, and returns an API for modifying it. */ public static LayoutsRowData setRowData(Control control) { getLayout(control.getParent(), RowLayout.class); RowData rowData = new RowData(); control.setLayoutData(rowData); return new LayoutsRowData(rowData); }
private void adjustSelectedElement() { int selected = menu.getSelectionIndex(); if (selected != -1) { ListPaneElement selectedElement =(ListPaneElement)elements.get(selected); selectedElement.getComposite().setVisible(true); RowData dt = (RowData)selectedElement.getComposite().getLayoutData(); dt.exclude = false; if (panes.getSize().x > 3 && panes.getSize().y > 3) { dt.width = panes.getSize().x - 3; dt.height = panes.getSize().y - 3; } selectedElement.getComposite().setLayoutData(dt); } }
protected final void addCategoryIcon(final Image image) { if (image != null) { ImageData imageData = image.getImageData(); Canvas canvas = new Canvas(iconRow, SWT.NO_REDRAW_RESIZE | SWT.NO_FOCUS); canvas.setLayoutData(new RowData(imageData.width, imageData.height)); canvas.setBackground(iconRow.getBackground()); canvas.addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { e.gc.drawImage(image,0,0); } }); } }
private void createUnitsControls(Composite parent, String attr, String label) { DataNode dn = DCUtils.findDataNode(parent, true); Field unitsField = new UnitField(attr); Field numField = new NumberField(attr); dn.addComputedField(numField); dn.addComputedField(unitsField); createLabel(label, null); Composite controlRow = new Composite(parent, SWT.NONE); RowLayout rl = new RowLayout(); rl.marginBottom = rl.marginLeft = rl.marginRight = rl.marginTop = 0; rl.center = true; controlRow.setLayout(rl); GridData gd = createControlGDFill(1); controlRow.setLayoutData(gd); Composite save = getCurrentParent(); setCurrentParent(controlRow); DCCompositeText text = createDCTextComputed(numField.getName(), new RowData(80, SWT.DEFAULT)); MultiValidator mv = new MultiValidator(); mv.add(new StrictNumberValidator(new Double(0), null)); mv.add(new LengthValidator(0, 7)); // Allow 7 digits text.setValidator(mv); String[] codes = { "px", "%" }; //$NON-NLS-1$ String[] labels = { "Pixels", "Percent" }; // $NLX-CommonConfigurationAttributesPanel.Pixels-1$ $NLX-CommonConfigurationAttributesPanel.Percent-2$ ILookup lookup = new StringLookup(codes, labels); createLabel("Units:", null); // $NLX-CommonConfigurationAttributesPanel.Units-1$ DCCompositeCombo combo = createComboComputed(unitsField.getName(), lookup, null, true, false); unitsField.setControls(text, combo); numField.setControls(text, combo); setCurrentParent(save); }
@Override public Object[] getLayoutDataOfControls() { RowData[] layoutData = new RowData[3]; layoutData[0] = new RowData(); layoutData[1] = new RowData(); layoutData[2] = new RowData(); return layoutData; }
private static void setWidthForText( Text theTextControl, int visibleChars) { GC gc = new GC( theTextControl); int charWidth = gc.getFontMetrics().getAverageCharWidth(); gc.dispose(); int minWidth = visibleChars * charWidth; Object layout = theTextControl.getLayoutData(); if ( layout instanceof GridData) ((GridData) layout).minimumWidth = minWidth; if ( layout instanceof RowData) ((RowData) layout).width = minWidth; else theTextControl.setSize( theTextControl.computeSize( minWidth, SWT.DEFAULT)); }
private void setWidthForText(Combo theComboControl, int visibleChars) { GC gc = new GC( theComboControl); int charWidth = gc.getFontMetrics().getAverageCharWidth(); gc.dispose(); int minWidth = visibleChars * charWidth; Object layout = theComboControl.getLayoutData(); if (layout instanceof GridData) ( (GridData) layout).minimumWidth = minWidth + 20; if (layout instanceof RowData) ( (RowData) layout).width = minWidth + 20; else theComboControl.setSize( theComboControl.computeSize( minWidth + 20, SWT.DEFAULT)); }
private static void setWidthForText( Control theTextControl, int visibleChars) { GC gc = new GC( theTextControl); int charWidth = gc.getFontMetrics().getAverageCharWidth(); gc.dispose(); int minWidth = visibleChars * charWidth; Object layout = theTextControl.getLayoutData(); if ( layout instanceof GridData) ((GridData) layout).minimumWidth = minWidth + 20; if ( layout instanceof RowData) ((RowData) layout).width = minWidth + 20; else theTextControl.setSize( theTextControl.computeSize( minWidth + 20, SWT.DEFAULT)); }