public FeatureSelectionTable(Composite parent, FeatureLayer featureLayer, IPanel panel) { BatikApplication.instance().getContext().propagate(this); this.featureLayer = featureLayer; this.fs = featureLayer.featureSource(); this.panel = panel; parent.setLayout(FormLayoutFactory.defaults().create()); // topbar Composite topbar = on(tk().createComposite(parent)).fill().noBottom().height(36).control(); topbar.setLayout(FormLayoutFactory.defaults().spacing(10).margins(3).create()); // closeBtn Button closeBtn = tk().createButton(topbar, "", SWT.PUSH, SWT.FLAT); closeBtn.setToolTipText("Close table"); closeBtn.setImage( BatikPlugin.images() .svgImage( "close.svg", SvgImageRegistryHelper.NORMAL12)); // P4Plugin.TOOLBAR_ICON_CONFIG ) ); on(closeBtn).left(0).top(0).height(26).width(28); closeBtn.addSelectionListener( selectionListener( ev -> { close(); })); // title Label title = tk().createLabel(topbar, abbreviate(featureLayer.layer().label.get(), 20)); title.setFont(MdAppDesign.font(FontStyle.Title)); on(title).top(0, 1).left(closeBtn, -8); // seach createTextSearch(topbar); on(searchText.getControl()).left(title).top(0).width(250); // toolbar toolbar = tk().createToolbar(topbar, SWT.FLAT); on(toolbar.getControl()).fill().noLeft().right(100); ContributionManager.instance().contributeTo(toolbar, panel, TOOLBAR_TAG); // table viewer createTableViewer(parent); on(viewer.getTable()).fill().top(topbar); // listen to commit events EventManager.instance() .subscribe( this, TypeEventFilter.ifType( FeatureEvent.class, ev -> ev.getType() == Type.COMMIT && ev.getFeatureSource() == fs)); // listen to click events EventManager.instance() .subscribe( this, TypeEventFilter.ifType( FeatureClickEvent.class, ev -> ev.getSource() == this.featureLayer && ev.clicked.isPresent())); }
public Upload(Composite parent, int style, int... uploadStyles) { super(parent, style); setLayout(FormLayoutFactory.defaults().create()); fileUpload = new FileUpload(this, SWT.NONE); fileUpload.setLayoutData(FormDataFactory.filled().create()); fileUpload.setText(i18n.get("select")); fileUpload.setData(RWT.TOOLTIP_MARKUP_ENABLED, Boolean.TRUE); setData(RWT.TOOLTIP_MARKUP_ENABLED, Boolean.TRUE); fileUpload.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent ev) { UIUtils.activateCallback("upload"); fileUpload.submit(UploadService.registerHandler(Upload.this)); } }); if (ArrayUtils.contains(uploadStyles, SHOW_UPLOAD_BUTTON)) { log.info("SHOW_UPLOAD_BUTTON is not supported yet."); } if (ArrayUtils.contains(uploadStyles, SHOW_PROGRESS)) { fileUpload.setLayoutData(FormDataFactory.filled().noRight().create()); progress = new ProgressBar(this, SWT.HORIZONTAL); progress.setLayoutData(FormDataFactory.filled().left(fileUpload).create()); progress.setMaximum(Integer.MAX_VALUE); progressLabel = new Label(this, SWT.NONE); progressLabel.setLayoutData(FormDataFactory.filled().top(0, 5).left(fileUpload, 20).create()); progressLabel.setText(i18n.get("progressLabel")); log.warn("not yet ported: progressLabel.setForeground( new Color( 0x60, 0x60, 0x60 ) ) "); progressLabel.moveAbove(progress); } }