public PerspectiveSwitcherBuilder(final Composite parent, final String subSetId) { super(parent, subSetId); GridLayout glayout = new GridLayout(); glayout.marginBottom = 0; glayout.marginHeight = 0; parent.setLayout(glayout); background = new Composite(parent, SWT.NONE); background.setData(RWT.CUSTOM_VARIANT, ICSSConstants.COMP_TRANS); // $NON-NLS-1$ background.setLayoutData(new GridData(SWT.RIGHT, SWT.BOTTOM, true, true, 1, 1)); RowLayout layout = new RowLayout(); background.setLayout(layout); layout.spacing = 4; layout.marginBottom = 0; layout.marginRight = 10; layout.marginTop = 0; layout.wrap = false; layout.pack = false; perspectiveButtonMap = new HashMap<IPerspectiveDescriptor, Button>(); buttonPerspectiveMap = new HashMap<Button, IPerspectiveDescriptor>(); buttonList = new ArrayList<Button>(); perspectiveList = new ArrayList<String>(); // images bgActive = getImage(ILayoutSetConstants.PERSP_BG_ACTIVE); }
private void createFeaturesToolbar(FormToolkit toolkit, Section section) { Composite headerComposite = toolkit.createComposite(section, SWT.NONE); RowLayout rowLayout = new RowLayout(); rowLayout.marginTop = 0; rowLayout.marginBottom = 0; headerComposite.setLayout(rowLayout); headerComposite.setBackground(null); toolBarManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL); toolBarManager.createControl(headerComposite); installAction = new InstallAction(); installAction.setEnabled(false); toolBarManager.add(installAction); toolBarManager.add(new CheckForUpdatesAction()); CommandContributionItem item = JBossCentralActivator.createContributionItem( getSite(), "org.jboss.tools.central.refreshDiscovery"); toolBarManager.add(item); toolBarManager.update(true); section.setTextClient(headerComposite); }
public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); container.setLayout(layout); layout.numColumns = 2; layout.verticalSpacing = 20; Label label = new Label(container, SWT.NULL); label.setText("&Nombre del projecto:"); // TEXT nombreProyecto = new Text(container, SWT.BORDER | SWT.SINGLE); GridData gd = new GridData(GridData.FILL_HORIZONTAL); nombreProyecto.setLayoutData(gd); nombreProyecto.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); // Combo box label = new Label(container, SWT.NULL); label.setText("&Dispositivo:"); board = new Combo(container, SWT.BORDER | SWT.SINGLE); gd = new GridData(GridData.FILL_HORIZONTAL); board.setLayoutData(gd); // Radio button label = new Label(container, SWT.NULL); label.setText(" "); group1 = new Group(container, SWT.SHADOW_IN); group1.setText("Tipo de proyecto:"); RowLayout row = new RowLayout(SWT.HORIZONTAL); row.marginTop = 10; row.marginRight = 20; row.marginLeft = 20; row.marginBottom = 10; row.spacing = 15; group1.setLayout(row); botonGenerico = new Button(group1, SWT.RADIO); botonGenerico.setText("Generico"); new Button(group1, SWT.RADIO).setText("BareMetal"); gd = new GridData(GridData.FILL_HORIZONTAL); group1.setLayoutData(gd); initialize(); dialogChanged(); setControl(container); }
/** This method initializes composite */ private void createComposite() { RowLayout rowLayout1 = new RowLayout(); // rowLayout1.marginHeight = 5; rowLayout1.marginTop = 2; rowLayout1.marginBottom = 2; // rowLayout1.marginWidth = 5; rowLayout1.type = SWT.VERTICAL; composite = new Composite(composite1, SWT.NONE); composite.setLayout(rowLayout1); SelectionAdapter hexTextSelectionAdapter = new SelectionAdapter() { public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { text.setText(text.getText()); // generate event lastHexButtonSelected = e.widget == hexRadioButton; /* Crashes when the text is not a number if (lastHexButtonSelected) return; String textNew = text.getText(); textNew = Integer.toHexString(Integer.parseInt(textNew)).toUpperCase(); text.setText(textNew); // generate event lastHexButtonSelected = true; */ } }; /* Crashes when the text is not radix 16 SelectionAdapter decTextSelectionAdapter = new SelectionAdapter() { public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { if (!lastHexButtonSelected) return; String textNew = text.getText(); textNew = Integer.toString(Integer.parseInt(textNew, 16)); text.setText(textNew); // generate event lastHexButtonSelected = false; } }; */ // Besides the crashes: the user always knows which number is entering, don't need any automatic // conversion. What does sometimes happen is one enters the right number and the wrong hex or // dec was // selected. In that case automatic conversion is the wrong thing to do and very annoying. hexRadioButton = new Button(composite, SWT.RADIO); hexRadioButton.setText("Hex"); hexRadioButton.addSelectionListener(defaultSelectionAdapter); hexRadioButton.addSelectionListener(hexTextSelectionAdapter); decRadioButton = new Button(composite, SWT.RADIO); decRadioButton.setText("Dec"); decRadioButton.addSelectionListener(defaultSelectionAdapter); decRadioButton.addSelectionListener(hexTextSelectionAdapter); // decTextSelectionAdapter); }
public PerspectiveSwitcherBuilder(final Composite parent, final String subSetId) { super(parent, subSetId); background = new Composite(parent, SWT.NONE); background.setData(RWT.CUSTOM_VARIANT, "compTrans"); // $NON-NLS-1$ RowLayout layout = new RowLayout(); background.setLayout(layout); layout.spacing = 3; layout.marginBottom = 0; layout.marginTop = 0; perspectiveButtonMap = new HashMap(); buttonPerspectiveMap = new HashMap(); buttonList = new ArrayList(); perspectiveList = new ArrayList(); // images left = getImage(ILayoutSetConstants.PERSP_LEFT_ACTIVE); right = getImage(ILayoutSetConstants.PERSP_RIGHT_ACTIVE); bg = getImage(ILayoutSetConstants.PERSP_BG); bgActive = getImage(ILayoutSetConstants.PERSP_BG_ACTIVE); }
public Composite createPartControl(Composite parent) { content = new Composite(parent, SWT.NONE); RowLayout rowLayout = new RowLayout(); rowLayout.wrap = true; rowLayout.pack = true; rowLayout.fill = true; rowLayout.justify = false; rowLayout.type = SWT.HORIZONTAL; rowLayout.marginLeft = 2; rowLayout.marginTop = 2; rowLayout.marginRight = 2; rowLayout.marginBottom = 2; rowLayout.spacing = 3; content.setLayout(rowLayout); IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager(); themeManager.addPropertyChangeListener(themeChangeListener); ITheme theme = themeManager.getCurrentTheme(); setTheme(theme); content.addMouseListener(mouseListener); return content; }
public LoginPanel(Shell page, Composite parent) { super(parent, SWT.NONE); this.shell = page; setLayout(new GridLayout()); // ´´½¨µÇ¼ÇøÓòµÄÓû§±êÇ© Óû§ÃûÊäÈë¿ò ÃÜÂë±êÇ© ÃÜÂëÊäÈë¿ò µÇ¼°´Å¥ Composite panelTop = new Composite(this, SWT.NONE); panelTop.setBackgroundMode(SWT.INHERIT_DEFAULT); RowLayout layout = new RowLayout(); layout.spacing = 40; layout.marginBottom = 0; layout.marginRight = 10; layout.marginTop = 0; layout.wrap = false; layout.pack = true; layout.center = true; panelTop.setLayout(layout); userText = new Text(panelTop, SWT.BORDER); RowData rd = new RowData(); rd.width = 240; userText.setMessage("Õʺš¢Óû§Ãû»òÕßemail"); userText.setLayoutData(rd); userText.setData(RWT.CUSTOM_VARIANT, "loginInput"); userText.setFocus(); passwordText = new Text(panelTop, SWT.BORDER | SWT.PASSWORD); rd = new RowData(); rd.width = 220; passwordText.setMessage("ÊäÈëµÇ¼ÃÜÂë"); passwordText.setLayoutData(rd); passwordText.setData(RWT.CUSTOM_VARIANT, "loginInput"); okButton = new Button(panelTop, SWT.PUSH); okButton.setData(RWT.CUSTOM_VARIANT, "loginInput"); rd = new RowData(); rd.width = 50; rd.height = 50; okButton.setLayoutData(rd); page.setDefaultButton(okButton); okButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { buttonPressed(); } }); // ´´½¨±£´æÃÜÂë¹´Ñ¡¿òºÍ±£´æÓû§Ãû¹´Ñ¡¿ò Composite panelBottom = new Composite(this, SWT.NONE); layout = new RowLayout(); layout.spacing = 4; layout.marginBottom = 0; layout.marginRight = 10; layout.marginTop = 0; layout.wrap = false; layout.pack = true; panelBottom.setLayout(layout); saveIdButton = new Button(panelBottom, SWT.CHECK); saveIdButton.setText("±£´æµÇ¼ÕʺÅ"); saveIdButton.setData(RWT.CUSTOM_VARIANT, "loginCheck"); savePassButton = new Button(panelBottom, SWT.CHECK); savePassButton.setText("±£´æµÇ¼ÃÜÂë"); savePassButton.setData(RWT.CUSTOM_VARIANT, "loginCheck"); // cookie save String uid = RWT.getSettingStore().getAttribute(COOKIE_UI_USERID); if (uid != null && uid.length() > 0) { userText.setText(uid); saveIdButton.setSelection(true); } // cookie save String psd = RWT.getSettingStore().getAttribute(COOKIE_UI_PASSWORD); if (psd != null && psd.length() > 0) { passwordText.setText(psd); savePassButton.setSelection(true); } panelTop.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, true, false)); panelBottom.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, false, false)); createTooltips(); }
private void initIcons(ApplicationFactory factory) { Composite center = null; if (Application.LICENSE == Install.PERSONAL) { center = new Composite(this, SWT.TRANSPARENCY_ALPHA); GridData gridData = new GridData(GridData.FILL_BOTH); center.setLayoutData(gridData); GridLayout gridLayout = new GridLayout(2, false); center.setLayout(gridLayout); Browser widget = null; // ClientLog.getInstance().setMessage(getShell(), new Exception( "buoc 1 da chay vao day // roi " + widget.toString())); try { widget = new Browser(center, SWT.NONE); // ClientLog.getInstance().setMessage(getShell(), new Exception( " da chay vao day // roi " + widget.toString())); } catch (Exception e) { widget = new Browser(center, SWT.NONE); ClientLog.getInstance().setException(null, e); } gridData = new GridData(GridData.FILL_BOTH); gridData.verticalSpan = 2; widget.setLayoutData(gridData); if (Application.GROUPS.length > 0 && Application.GROUPS[0].equals("XML")) { widget.setUrl("http://vietspider.org/webextractor/"); toolbar.setText("http://vietspider.org/webextractor/"); } else { widget.setUrl("http://nik.vn/tin/"); // widget.setUrl("http://*****:*****@SuppressWarnings("unused") public void linkActivated(HyperlinkEvent e) { BrowserWidget browser = workspace.getTab().createItem(); browser.viewPage(); } }; browserImageLink.addHyperlinkListener(listener); // browserLink.addHyperlinkListener(listener); composite = createItem(top); final ImageHyperlink creatorImageLink = new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA); creatorImageLink.setImage(factory.loadImage("large.createsource.png")); // creatorImageLink.setBackground(getBackground()); creatorImageLink.setToolTipText(factory.getLabel("creatorLink")); // final Hyperlink creatorLink = createLink(composite); // creatorLink.setText(factory.getLabel("creatorLink")); // creatorLink.setForeground(color); listener = new HyperlinkAdapter() { @SuppressWarnings("unused") public void linkEntered(HyperlinkEvent e) { // creatorLink.setUnderlined(true); } @SuppressWarnings("unused") public void linkExited(HyperlinkEvent e) { // creatorLink.setUnderlined(false); } @SuppressWarnings("unused") public void linkActivated(HyperlinkEvent e) { // creatorLink.setUnderlined(false); try { ChannelWizard wizard = (ChannelWizard) workspace.getTab().createTool(ChannelWizard.class, false, SWT.CLOSE); } catch (Exception exp) { ClientLog.getInstance().setException(null, exp); } // try { // Creator creator = (Creator)workspace.getTab().createTool( // Creator.class, false, SWT.CLOSE); // creator.selectData(new Worker[0], null, null); // } catch (Exception exp) { // ClientLog.getInstance().setException(null, exp); // } } }; creatorImageLink.addHyperlinkListener(listener); // creatorLink.addHyperlinkListener(listener); //////////////////////////////////////////////////////////////////////////////////////////////// Composite bottom = new Composite(center, SWT.TRANSPARENCY_ALPHA); if (Application.LICENSE == Install.PERSONAL) { gridData = new GridData(); gridData.widthHint = 350; } else { gridData = new GridData(GridData.FILL_BOTH); } bottom.setLayoutData(gridData); // bottom.setBackground(getBackground()); rowLayout = new RowLayout(); rowLayout.wrap = true; rowLayout.pack = true; rowLayout.justify = true; rowLayout.type = SWT.HORIZONTAL; rowLayout.marginLeft = 5; rowLayout.marginTop = 5; rowLayout.marginRight = 5; rowLayout.marginBottom = 5; rowLayout.spacing = 20; bottom.setLayout(rowLayout); if (Application.LICENSE != Install.PERSONAL) { composite = createItem(top); } else { composite = createItem(bottom); } final ImageHyperlink crawlerImageLink = new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA); crawlerImageLink.setImage(factory.loadImage("large.crawler.png")); // crawlerImageLink.setBackground(getBackground()); crawlerImageLink.setToolTipText(factory.getLabel("crawlerLink")); // final Hyperlink crawlerLink = createLink(composite); // crawlerLink.setText(factory.getLabel("crawlerLink")); // crawlerLink.setForeground(color); listener = new HyperlinkAdapter() { @SuppressWarnings("unused") public void linkEntered(HyperlinkEvent e) { // crawlerLink.setUnderlined(true); } @SuppressWarnings("unused") public void linkExited(HyperlinkEvent e) { // crawlerLink.setUnderlined(false); } @SuppressWarnings("unused") public void linkActivated(HyperlinkEvent e) { // crawlerLink.setUnderlined(false); try { workspace.getTab().createTool(Crawler.class, true, SWT.CLOSE); } catch (Exception exp) { ClientLog.getInstance().setException(getShell(), exp); } } }; crawlerImageLink.addHyperlinkListener(listener); // crawlerLink.addHyperlinkListener(listener); if (Application.LICENSE != Install.PERSONAL) { composite = createItem(bottom); final ImageHyperlink monitorImageLink = new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA); monitorImageLink.setImage(factory.loadImage("large.log.png")); // monitorImageLink.setBackground(getBackground()); monitorImageLink.setToolTipText(factory.getLabel("logLink")); // final Hyperlink monitorLink = createLink(composite); // monitorLink.setText(factory.getLabel("monitorLink")); // monitorLink.setForeground(color); listener = new HyperlinkAdapter() { @SuppressWarnings("unused") public void linkActivated(HyperlinkEvent e) { try { workspace.getTab().createTool(LogViewer2.class, true, SWT.CLOSE); } catch (Exception exp) { ClientLog.getInstance().setException(workspace.getShell(), exp); } } }; monitorImageLink.addHyperlinkListener(listener); // monitorLink.addHyperlinkListener(listener); } /*if(Application.LICENSE != Install.PERSONAL) { composite = createItem(bottom); final ImageHyperlink userImageLink = new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA); userImageLink.setImage(factory.loadImage("large.userfolder.png")); // userImageLink.setBackground(getBackground()); userImageLink.setToolTipText(factory.getLabel("userLink")); // final Hyperlink userLink = createLink(composite); // userLink.setText(factory.getLabel("userLink")); // userLink.setForeground(color); listener = new HyperlinkAdapter() { @SuppressWarnings("unused") public void linkEntered(HyperlinkEvent e) { // userLink.setUnderlined(true); } @SuppressWarnings("unused") public void linkExited(HyperlinkEvent e) { // userLink.setUnderlined(false); // userLink.setFont(UIDATA.FONT_9VB); } @SuppressWarnings("unused") public void linkActivated(HyperlinkEvent e) { // userLink.setUnderlined(false); try { workspace.getTab().createTool(Organization.class, true, SWT.CLOSE); }catch (Exception exp) { ClientLog.getInstance().setException(workspace.getShell(), exp); } } }; userImageLink.addHyperlinkListener(listener); // userLink.addHyperlinkListener(listener); }*/ composite = createItem(bottom); final ImageHyperlink configImageLink = new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA); configImageLink.setImage(factory.loadImage("large.settingsfolder.png")); // configImageLink.setBackground(getBackground()); configImageLink.setToolTipText(factory.getLabel("configLink")); // final Hyperlink configLink = createLink(composite); // configLink.setText(factory.getLabel("configLink")); // configLink.setForeground(color); listener = new HyperlinkAdapter() { @SuppressWarnings("unused") public void linkEntered(HyperlinkEvent e) { // configLink.setUnderlined(true); } @SuppressWarnings("unused") public void linkExited(HyperlinkEvent e) { // configLink.setUnderlined(false); } @SuppressWarnings("unused") public void linkActivated(HyperlinkEvent e) { // configLink.setUnderlined(false); try { workspace.getTab().createTool(Config.class, true, SWT.CLOSE); } catch (Exception exp) { ClientLog.getInstance().setException(workspace.getShell(), exp); } } }; configImageLink.addHyperlinkListener(listener); }
public void createToolBar(final Composite parent, IAppWindow window) { GridLayout gridLayout; Composite container = new Composite(parent, SWT.NONE); gridLayout = new GridLayout(2, false); gridLayout.horizontalSpacing = 0; gridLayout.verticalSpacing = 0; gridLayout.marginWidth = 3; gridLayout.marginHeight = 1; container.setLayout(gridLayout); ToolBar toolBar = new ToolBar(container, SWT.FLAT | SWT.RIGHT); toolBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); IAppWindow.Type type = window.getType(); if (type != IAppWindow.Type.ARENA) { ToolItem arenaWindowItem = new ToolItem(toolBar, SWT.PUSH); arenaWindowItem.setText("アリーナ"); arenaWindowItem.setToolTipText("部屋の検索やロビーのチャット"); arenaWindowItem.setImage(imageRegistry.get(ICON_TOOLBAR_ARENA)); arenaWindowItem.addListener( SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { arenaWindow.show(); } }); } if (type != IAppWindow.Type.ROOM) { ToolItem roomWindowItem = new ToolItem(toolBar, SWT.PUSH); roomWindowItem.setText("ルーム"); roomWindowItem.setToolTipText("ルーム内で通信プレイができます"); roomWindowItem.setImage(imageRegistry.get(ICON_TOOLBAR_ROOM)); roomWindowItem.addListener( SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { getRoomWindow().show(); } }); } ToolItem configWindowItem = new ToolItem(toolBar, SWT.PUSH); configWindowItem.setText("設定"); configWindowItem.setToolTipText("アプリケーションの設定をします"); configWindowItem.setImage(imageRegistry.get(ICON_TOOLBAR_CONFIG)); configWindowItem.addListener( SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { if (openConfigDialog(parent.getShell(), null)) { if (arenaWindow != null) arenaWindow.settingChanged(); if (roomWindow != null) roomWindow.settingChanged(); } } }); ToolItem wikiItem = new ToolItem(toolBar, SWT.PUSH); wikiItem.setText("Wiki"); wikiItem.setToolTipText(AppConstants.APP_NAME + "のWikiページを表示します"); wikiItem.setImage(imageRegistry.get(ICON_TOOLBAR_WIKI)); wikiItem.addListener( SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { Program.launch("http://wiki.team-monketsu.net/"); } }); ToolItem exitItem = new ToolItem(toolBar, SWT.PUSH); exitItem.setText("終了"); exitItem.setToolTipText(AppConstants.APP_NAME + "を終了します"); exitItem.setImage(imageRegistry.get(ICON_TOOLBAR_EXIT)); exitItem.addListener( SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { if (openShutdownConfirmDialog(parent.getShell())) { isRunning = false; } } }); Composite appVersionContainer = new Composite(container, SWT.NONE); appVersionContainer.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false)); RowLayout rowLayout = new RowLayout(); rowLayout.center = true; rowLayout.marginTop = 0; rowLayout.marginBottom = 0; rowLayout.marginLeft = 0; rowLayout.marginRight = 0; appVersionContainer.setLayout(rowLayout); Label statusApplicationVersionLabel = new Label(appVersionContainer, SWT.NONE); statusApplicationVersionLabel.setText("バージョン:"); initControl(statusApplicationVersionLabel); Label statusApplicationVersionNumber = new Label(appVersionContainer, SWT.NONE); statusApplicationVersionNumber.setText(AppConstants.VERSION); statusApplicationVersionNumber.setForeground(colorRegistry.get(COLOR_APP_NUMBER)); initControl(statusApplicationVersionNumber); Label statusApplicationProtocolLabel = new Label(appVersionContainer, SWT.NONE); statusApplicationProtocolLabel.setText("プロトコル:"); initControl(statusApplicationProtocolLabel); Label statusApplicationProtocolNumber = new Label(appVersionContainer, SWT.NONE); statusApplicationProtocolNumber.setText(IProtocol.NUMBER); statusApplicationProtocolNumber.setForeground(colorRegistry.get(COLOR_APP_NUMBER)); initControl(statusApplicationProtocolNumber); Label statusApplicationSsidLabel = new Label(appVersionContainer, SWT.NONE); statusApplicationSsidLabel.setText("SSID機能:"); initControl(statusApplicationSsidLabel); Label statusApplicationSsidLibrary = new Label(appVersionContainer, SWT.NONE); toolbarSsidLibraryLabels.add(statusApplicationSsidLibrary); initControl(statusApplicationSsidLibrary); updateWlanLibraryStatus(); }
/** * Create contents of the wizard. * * @param parent the parent widget */ @Override @SuppressWarnings("unused") // Don't warn about unassigned "new Label(.)": has side-effect public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); setControl(container); GridLayout glContainer = new GridLayout(2, false); glContainer.marginWidth = 0; glContainer.horizontalSpacing = 0; glContainer.marginHeight = 0; glContainer.verticalSpacing = 0; container.setLayout(glContainer); ScrolledComposite configurationScrollArea = new ScrolledComposite(container, SWT.V_SCROLL); configurationScrollArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2)); configurationScrollArea.setExpandHorizontal(true); configurationScrollArea.setExpandVertical(true); mConfigurationArea = new Composite(configurationScrollArea, SWT.NONE); GridLayout glConfigurationArea = new GridLayout(3, false); glConfigurationArea.horizontalSpacing = 0; glConfigurationArea.marginRight = 15; glConfigurationArea.marginWidth = 0; glConfigurationArea.marginHeight = 0; mConfigurationArea.setLayout(glConfigurationArea); Label foregroundLabel = new Label(mConfigurationArea, SWT.NONE); foregroundLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); foregroundLabel.setText("Foreground:"); Composite foregroundComposite = new Composite(mConfigurationArea, SWT.NONE); foregroundComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1)); GridLayout glForegroundComposite = new GridLayout(5, false); glForegroundComposite.horizontalSpacing = 0; foregroundComposite.setLayout(glForegroundComposite); mImageRadio = new Button(foregroundComposite, SWT.FLAT | SWT.TOGGLE); mImageRadio.setSelection(false); mImageRadio.addSelectionListener(this); mImageRadio.setText("Image"); mClipartRadio = new Button(foregroundComposite, SWT.FLAT | SWT.TOGGLE); mClipartRadio.setText("Clipart"); mClipartRadio.addSelectionListener(this); mTextRadio = new Button(foregroundComposite, SWT.FLAT | SWT.TOGGLE); mTextRadio.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1)); mTextRadio.setText("Text"); mTextRadio.addSelectionListener(this); new Label(mConfigurationArea, SWT.NONE); mForegroundArea = new Composite(mConfigurationArea, SWT.NONE); mForegroundArea.setLayout(new StackLayout()); mForegroundArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); mImageForm = new Composite(mForegroundArea, SWT.NONE); mImageForm.setLayout(new GridLayout(3, false)); Label fileLabel = new Label(mImageForm, SWT.NONE); fileLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); fileLabel.setText("Image File:"); mImagePathText = new Text(mImageForm, SWT.BORDER); GridData pathLayoutData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); pathLayoutData.widthHint = 200; mImagePathText.setLayoutData(pathLayoutData); mImagePathText.addSelectionListener(this); mImagePathText.addModifyListener(this); mPickImageButton = new Button(mImageForm, SWT.FLAT); mPickImageButton.setText("Browse..."); mPickImageButton.addSelectionListener(this); mClipartForm = new Composite(mForegroundArea, SWT.NONE); mClipartForm.setLayout(new GridLayout(2, false)); mChooseClipart = new Button(mClipartForm, SWT.FLAT); mChooseClipart.setText("Choose..."); mChooseClipart.addSelectionListener(this); mClipartPreviewPanel = new Composite(mClipartForm, SWT.NONE); RowLayout rlClipartPreviewPanel = new RowLayout(SWT.HORIZONTAL); rlClipartPreviewPanel.marginBottom = 0; rlClipartPreviewPanel.marginTop = 0; rlClipartPreviewPanel.center = true; mClipartPreviewPanel.setLayout(rlClipartPreviewPanel); mClipartPreviewPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); mTextForm = new Composite(mForegroundArea, SWT.NONE); mTextForm.setLayout(new GridLayout(2, false)); Label textLabel = new Label(mTextForm, SWT.NONE); textLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); textLabel.setText("Text:"); mText = new Text(mTextForm, SWT.BORDER); mText.setText("Aa"); mText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); mText.addModifyListener(this); Label fontLabel = new Label(mTextForm, SWT.NONE); fontLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); fontLabel.setText("Font:"); mFontButton = new Button(mTextForm, SWT.FLAT); mFontButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1)); mFontButton.addSelectionListener(this); mFontButton.setText("Choose Font..."); new Label(mConfigurationArea, SWT.NONE); mTrimCheckBox = new Button(mConfigurationArea, SWT.CHECK); mTrimCheckBox.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1)); mTrimCheckBox.setSelection(false); mTrimCheckBox.setText("Trim Surrounding Blank Space"); mTrimCheckBox.addSelectionListener(this); new Label(mConfigurationArea, SWT.NONE); Label paddingLabel = new Label(mConfigurationArea, SWT.NONE); paddingLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1)); paddingLabel.setText("Additional Padding:"); new Label(mConfigurationArea, SWT.NONE); mPaddingSlider = new Slider(mConfigurationArea, SWT.NONE); mPaddingSlider.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); // This doesn't work right -- not sure why. For now just use a plain slider // and subtract 10 from it to get the real range. // mPaddingSlider.setValues(0, -10, 50, 0, 1, 10); mPaddingSlider.setSelection(10 + 15); mPaddingSlider.addSelectionListener(this); mPercentLabel = new Label(mConfigurationArea, SWT.NONE); mPercentLabel.setText(" 15%"); // Enough available space for -10% mScalingLabel = new Label(mConfigurationArea, SWT.NONE); mScalingLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); mScalingLabel.setText("Foreground Scaling:"); mScalingComposite = new Composite(mConfigurationArea, SWT.NONE); mScalingComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1)); GridLayout gl_mScalingComposite = new GridLayout(5, false); gl_mScalingComposite.horizontalSpacing = 0; mScalingComposite.setLayout(gl_mScalingComposite); mCropRadio = new Button(mScalingComposite, SWT.FLAT | SWT.TOGGLE); mCropRadio.setSelection(true); mCropRadio.setText("Crop"); mCropRadio.addSelectionListener(this); mCenterRadio = new Button(mScalingComposite, SWT.FLAT | SWT.TOGGLE); mCenterRadio.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1)); mCenterRadio.setText("Center"); mCenterRadio.addSelectionListener(this); mShapeLabel = new Label(mConfigurationArea, SWT.NONE); mShapeLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); mShapeLabel.setText("Shape"); mShapeComposite = new Composite(mConfigurationArea, SWT.NONE); mShapeComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1)); GridLayout gl_mShapeComposite = new GridLayout(5, false); gl_mShapeComposite.horizontalSpacing = 0; mShapeComposite.setLayout(gl_mShapeComposite); mSquareRadio = new Button(mShapeComposite, SWT.FLAT | SWT.TOGGLE); mSquareRadio.setSelection(true); mSquareRadio.setText("Square"); mSquareRadio.addSelectionListener(this); mCircleButton = new Button(mShapeComposite, SWT.FLAT | SWT.TOGGLE); mCircleButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1)); mCircleButton.setText("Circle"); mCircleButton.addSelectionListener(this); mThemeLabel = new Label(mConfigurationArea, SWT.NONE); mThemeLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); mThemeLabel.setText("Theme"); mThemeComposite = new Composite(mConfigurationArea, SWT.NONE); mThemeComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); GridLayout gl_mThemeComposite = new GridLayout(2, false); gl_mThemeComposite.horizontalSpacing = 0; mThemeComposite.setLayout(gl_mThemeComposite); mHoloLightRadio = new Button(mThemeComposite, SWT.FLAT | SWT.TOGGLE); mHoloLightRadio.setText("Holo Light"); mHoloLightRadio.setSelection(true); mHoloLightRadio.addSelectionListener(this); mHoloDarkRadio = new Button(mThemeComposite, SWT.FLAT | SWT.TOGGLE); mHoloDarkRadio.setText("Holo Dark"); mHoloDarkRadio.addSelectionListener(this); mBgColorLabel = new Label(mConfigurationArea, SWT.NONE); mBgColorLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); mBgColorLabel.setText("Background Color:"); mBgButton = new Button(mConfigurationArea, SWT.FLAT); mBgButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1)); mBgButton.addSelectionListener(this); mBgButton.setAlignment(SWT.CENTER); mFgColorLabel = new Label(mConfigurationArea, SWT.NONE); mFgColorLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); mFgColorLabel.setText("Foreground Color:"); mFgButton = new Button(mConfigurationArea, SWT.FLAT); mFgButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1)); mFgButton.setAlignment(SWT.CENTER); mFgButton.addSelectionListener(this); if (SUPPORT_LAUNCHER_ICON_TYPES) { mEffectsLabel = new Label(mConfigurationArea, SWT.NONE); mEffectsLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); mEffectsLabel.setText("Foreground Effects:"); mEffectsComposite = new Composite(mConfigurationArea, SWT.NONE); mEffectsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1)); GridLayout gl_mEffectsComposite = new GridLayout(5, false); gl_mEffectsComposite.horizontalSpacing = 0; mEffectsComposite.setLayout(gl_mEffectsComposite); mSimpleRadio = new Button(mEffectsComposite, SWT.FLAT | SWT.TOGGLE); mSimpleRadio.setSelection(true); mSimpleRadio.setText("Simple"); mSimpleRadio.addSelectionListener(this); mFancyRadio = new Button(mEffectsComposite, SWT.FLAT | SWT.TOGGLE); mFancyRadio.setText("Fancy"); mFancyRadio.addSelectionListener(this); mGlossyRadio = new Button(mEffectsComposite, SWT.FLAT | SWT.TOGGLE); mGlossyRadio.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1)); mGlossyRadio.setText("Glossy"); mGlossyRadio.addSelectionListener(this); } configurationScrollArea.setContent(mConfigurationArea); configurationScrollArea.setMinSize(mConfigurationArea.computeSize(SWT.DEFAULT, SWT.DEFAULT)); Label previewLabel = new Label(container, SWT.NONE); previewLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1)); previewLabel.setText("Preview:"); mPreviewArea = new Composite(container, SWT.BORDER); RowLayout rlPreviewAreaPreviewArea = new RowLayout(SWT.HORIZONTAL); rlPreviewAreaPreviewArea.wrap = true; rlPreviewAreaPreviewArea.pack = true; rlPreviewAreaPreviewArea.center = true; rlPreviewAreaPreviewArea.spacing = 0; rlPreviewAreaPreviewArea.marginBottom = 0; rlPreviewAreaPreviewArea.marginTop = 0; rlPreviewAreaPreviewArea.marginRight = 0; rlPreviewAreaPreviewArea.marginLeft = 0; mPreviewArea.setLayout(rlPreviewAreaPreviewArea); GridData gdMPreviewArea = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1); gdMPreviewArea.widthHint = PREVIEW_AREA_WIDTH; mPreviewArea.setLayoutData(gdMPreviewArea); // Initial color Display display = parent.getDisplay(); // updateColor(display, new RGB(0xa4, 0xc6, 0x39), true /*background*/); updateColor(display, new RGB(0xff, 0x00, 0x00), true /*background*/); updateColor(display, new RGB(0x00, 0x00, 0x00), false /*background*/); // Start out showing the image form // mImageRadio.setSelection(true); // chooseForegroundTab(mImageRadio, mImageForm); // No, start out showing the text, since the user doesn't have to enter anything // initially and we still get images mTextRadio.setSelection(true); chooseForegroundTab(mTextRadio, mTextForm); new Label(mConfigurationArea, SWT.NONE); new Label(mConfigurationArea, SWT.NONE); new Label(mConfigurationArea, SWT.NONE); validatePage(); }
@PostConstruct void createWidget(Composite parent, MToolControl toolControl) { psME = toolControl; MUIElement meParent = psME.getParent(); int orientation = SWT.HORIZONTAL; if (meParent instanceof MTrimBar) { MTrimBar bar = (MTrimBar) meParent; if (bar.getSide() == SideValue.RIGHT || bar.getSide() == SideValue.LEFT) orientation = SWT.VERTICAL; } comp = new Composite(parent, SWT.NONE); RowLayout layout = new RowLayout(SWT.HORIZONTAL); layout.marginLeft = layout.marginRight = 8; layout.marginBottom = 4; layout.marginTop = 6; comp.setLayout(layout); psTB = new ToolBar(comp, SWT.FLAT | SWT.WRAP | SWT.RIGHT + orientation); comp.addPaintListener( new PaintListener() { public void paintControl(PaintEvent e) { paint(e); } }); toolParent = ((Control) toolControl.getParent().getWidget()); toolParent.addPaintListener( new PaintListener() { public void paintControl(PaintEvent e) { if (borderColor == null) borderColor = e.display.getSystemColor(SWT.COLOR_BLACK); e.gc.setForeground(borderColor); Rectangle bounds = ((Control) e.widget).getBounds(); e.gc.drawLine(0, bounds.height - 1, bounds.width, bounds.height - 1); } }); comp.addDisposeListener( new DisposeListener() { public void widgetDisposed(DisposeEvent e) { dispose(); } }); psTB.addMenuDetectListener( new MenuDetectListener() { public void menuDetected(MenuDetectEvent e) { ToolBar tb = (ToolBar) e.widget; Point p = new Point(e.x, e.y); p = psTB.getDisplay().map(null, psTB, p); ToolItem item = tb.getItem(p); if (item == null) E4Util.message(" ToolBar menu"); // $NON-NLS-1$ else { MPerspective persp = (MPerspective) item.getData(); if (persp == null) E4Util.message(" Add button Menu"); // $NON-NLS-1$ else openMenuFor(item, persp); } } }); psTB.addDisposeListener( new DisposeListener() { public void widgetDisposed(DisposeEvent e) { disposeTBImages(); } }); psTB.getAccessible() .addAccessibleListener( new AccessibleAdapter() { public void getName(AccessibleEvent e) { if (0 <= e.childID && e.childID < psTB.getItemCount()) { ToolItem item = psTB.getItem(e.childID); if (item != null) { e.result = item.getToolTipText(); } } } }); hookupDnD(psTB); final ToolItem createItem = new ToolItem(psTB, SWT.PUSH); createItem.setImage(getOpenPerspectiveImage()); createItem.setToolTipText(WorkbenchMessages.OpenPerspectiveDialogAction_tooltip); createItem.addSelectionListener( new SelectionListener() { public void widgetSelected(SelectionEvent e) { selectPerspective(); } public void widgetDefaultSelected(SelectionEvent e) { selectPerspective(); } }); new ToolItem(psTB, SWT.SEPARATOR); MPerspectiveStack stack = getPerspectiveStack(); if (stack != null) { // Create an item for each perspective that should show up for (MPerspective persp : stack.getChildren()) { if (persp.isToBeRendered()) { addPerspectiveItem(persp); } } } }
/** * creating new object of pop-up menu if not exist and set main menu entry * * @param menubar composite where the root of menues should appear * @param node object of tree node for pop-up menu */ public static void init(Composite menubar, TreeNodes node) { RowLayout layout = new RowLayout(); final Group popup = new Group(menubar, SWT.NONE); Label text = new Label(popup, SWT.SHADOW_IN); HashMap<String, String> metablock = node.getMetaData(); final String entry; String sLabel; String spacing = metablock.get("popupspace"); int space; FontObject font = new FontObject(); int popupsize = 0; boolean bold = false; boolean italic = false; String looks, ssize; MouseListener listener1, listener2; HashMap<Control, MouseListener> ListenerMap = new HashMap<Control, MouseListener>(); if (_instance == null) { _instance = new PopupMenu(menubar); } entry = node.getName(); sLabel = node.getTitle(); ssize = metablock.get("popupfontsize"); if (ssize != null) popupsize = Integer.parseInt(ssize); looks = metablock.get("popupfontstyle"); if (looks != null) { String[] split; split = looks.split(","); for (int i = 0; i < split.length; ++i) { split[i] = split[i].trim().toLowerCase(); if (split[i].equals("bold")) bold = true; else if (split[i].equals("italic")) italic = true; } } font.defineColor(popup, metablock.get("popupcolor"), colors.BACKGROUND, entry + " popup"); font.defineColor(popup, metablock.get("popupfontcolor"), colors.TEXT, entry + " popup"); font.defineFont( popup, metablock.get("popupfont"), popupsize, bold, italic, /*underline*/ false); text.setText(sLabel); if (spacing != null) space = Integer.parseInt(spacing); else space = 15; layout.marginWidth = 0; layout.marginHeight = 0; layout.marginTop = space; layout.marginRight = space + (space / 2); layout.marginBottom = space; layout.marginLeft = space + (space / 2); popup.setLayout(layout); font.setDevice(popup); font.setDevice(text); font.dispose(); text.addMouseListener( listener1 = new MouseAdapter() { public void mouseDown(MouseEvent event) { LayoutLoader loader; Thread t = null; if (HtmTags.lockDebug) { t = Thread.currentThread(); System.out.println(t.getName() + " show pop-up menue of " + entry); } _instance.show(entry, false); if (HtmTags.lockDebug) { System.out.println(t.getName() + " want to setActiveSideVisible of " + entry); } synchronized (TreeNodes.m_DISPLAYLOCK) { loader = LayoutLoader.instance(); loader.m_sAktFolder = entry; if (HtmTags.lockDebug) { System.out.println(t.getName() + " setActiveSideVisible of " + entry); } loader.setCurrentSideVisible(/*inform server by no body*/ true); if (HtmTags.lockDebug) { System.out.println(t.getName() + " hase setActiveSideVisible of " + entry); } } } }); popup.addMouseListener( listener2 = new MouseAdapter() { public void mouseDown(MouseEvent event) { LayoutLoader loader; Thread t = null; if (HtmTags.lockDebug) { t = Thread.currentThread(); System.out.println(t.getName() + " show pop-up menue of " + entry); } _instance.show(entry, false); if (HtmTags.lockDebug) System.out.println(t.getName() + " want to setActiveSideVisible of " + entry); synchronized (TreeNodes.m_DISPLAYLOCK) { loader = LayoutLoader.instance(); loader.m_sAktFolder = entry; if (HtmTags.lockDebug) System.out.println(t.getName() + " setActiveSideVisible of " + entry); loader.setCurrentSideVisible(/*inform server by no body*/ true); if (HtmTags.lockDebug) System.out.println(t.getName() + " hase setActiveSideVisible of " + entry); } } }); ListenerMap.put(text, listener1); ListenerMap.put(popup, listener2); _instance.m_aMainPopupListeners.put(entry, ListenerMap); _instance.m_mRootEntrys.put(entry, popup); _instance.m_mRootNodes.put(entry, node); }
/** * show one popup menu over the main window * * @param menu_entry actual entry which should be shown or disposed * @param move TRUE if the curser be moved over one entry, otherwise by clicking false */ private void show(String menu_entry, boolean move) { Point abs; Group popup; Rectangle rect, popup_rect = new Rectangle(0, 0, 120, 100); TreeNodes node; RowLayout l; ArrayList<TreeNodes> nodes; ArrayList<Composite> comps; if (move && m_sMenu.equals("")) { return; } if (!m_sMenu.equals(menu_entry)) { if (m_popupShell != null) m_popupShell.dispose(); popup = m_mRootEntrys.get(menu_entry); rect = popup.getBounds(); m_popupShell = new Shell(m_oTopLevelShell, SWT.NO_TRIM); // popup_rect= m_popupShell.getClientArea(); abs = LayoutLoader.getAbsoluteUseFieldPoint(); popup_rect.x = m_oMenu.getBounds().x + abs.x + rect.x; popup_rect.y = abs.y + rect.y + rect.height; l = new RowLayout(); l.type = SWT.VERTICAL; l.pack = false; l.marginBottom = 0; l.marginHeight = 0; l.marginLeft = 0; l.marginRight = 0; l.marginTop = 0; l.marginWidth = 0; l.spacing = 0; m_popupShell.setLayout(l); node = m_mRootNodes.get(menu_entry); nodes = node.getChilds(); m_sMenu = menu_entry; if (nodes.size() == 0) { m_sMenu = ""; return; } comps = new ArrayList<Composite>(); for (TreeNodes subnode : nodes) { RowLayout layout = new RowLayout(); Composite comp = new Group(m_popupShell, SWT.NONE); Label text = new Label(comp, SWT.NONE); HashMap<String, String> metablock = subnode.getMetaData(); String popupspace = metablock.get("popupspace"); final String entry; int space = 20; FontObject font = new FontObject(); int popupsize = 0; boolean bold = false; boolean italic = false; String looks, ssize; MouseListener listener1, listener2; entry = m_sMenu + "/" + subnode.getName(); ssize = metablock.get("popupfontsize"); if (ssize != null) popupsize = Integer.parseInt(ssize); looks = metablock.get("popupstyle"); if (looks != null) { String[] split; split = looks.split(","); for (int i = 0; i < split.length; ++i) { split[i] = split[i].trim().toLowerCase(); if (split[i].equals("bold")) bold = true; else if (split[i].equals("italic")) italic = true; } } font.defineColor(popup, metablock.get("popupcolor"), colors.WIDGET, entry + " popup"); font.defineColor(popup, metablock.get("popupfontcolor"), colors.TEXT, entry + " popup"); font.defineFont( popup, metablock.get("popupfont"), popupsize, bold, italic, /*underline*/ false); text.setText(subnode.getTitle().trim()); if (popupspace != null) space = Integer.parseInt(popupspace); layout.type = SWT.VERTICAL; layout.marginTop = space; layout.marginRight = space; layout.marginBottom = space; layout.marginLeft = space; comp.setLayout(layout); font.setDevice(comp); font.setDevice(text); font.dispose(); comps.add(comp); text.addMouseListener( listener1 = new MouseAdapter() { public void mouseDown(MouseEvent event) { LayoutLoader loader; Thread t = null; if (HtmTags.lockDebug) { t = Thread.currentThread(); System.out.println(t.getName() + " want to setActiveSideVisible of " + entry); } loader = LayoutLoader.instance(); loader.m_sAktFolder = entry; synchronized (TreeNodes.m_DISPLAYLOCK) { loader.setCurrentSideVisible(/*inform server by no body*/ true); } m_nPopup = m_popupShell.getBounds(); destroyPopupShell(); m_sMenu = ""; } }); m_aPopupListeners.put(text, listener1); comp.addMouseListener( listener2 = new MouseAdapter() { public void mouseDown(MouseEvent event) { LayoutLoader loader; Thread t = null; if (HtmTags.lockDebug) { t = Thread.currentThread(); System.out.println(t.getName() + " want to setActiveSideVisible of " + entry); } loader = LayoutLoader.instance(); loader.m_sAktFolder = entry; synchronized (TreeNodes.m_DISPLAYLOCK) { loader.setCurrentSideVisible(/*inform server by no body*/ true); } m_nPopup = m_popupShell.getBounds(); destroyPopupShell(); m_sMenu = ""; } }); m_aPopupListeners.put(comp, listener2); } if (m_nPopup != null) popup_rect = m_nPopup; m_popupShell.setBounds(popup_rect); m_popupShell.setEnabled(false); m_popupShell.setVisible(false); m_popupShell.open(); m_popupShell.pack(); m_popupShell.setEnabled(true); m_popupShell.setVisible(true); } else if (!m_sMenu.equals("") && !move) { // actual popup is the same m_popupShell.dispose(); m_sMenu = ""; } }