private void hideCustomPanelChildren() { Control[] children = customUIPanel.getChildren(); for (Control child : children) { if (child instanceof Composite && "donotremove".equals(((Composite) child).getData())) { // skip } else { child.setParent(fakeShell); } } customUIPanel.pack(); }
private void selectCustomUI() { hideCustomPanelChildren(); String desiredScheme = customUIPicker.getText(); for (CustomVfsUiPanel panel : customUIPanels) { if (desiredScheme.equals(panel.getVfsSchemeDisplayText())) { panel.setParent(customUIPanel); panel.activate(); currentPanel = panel; } } if (currentPanel == null) { currentPanel = customUIPanels.get(0); currentPanel.setParent(customUIPanel); currentPanel.activate(); } customUIPanel.pack(); dialog.layout(); }
public synchronized void createDialog() { Composite c = this.getContents(); prepareDialog(c, getShell()); final Color color = new Color(getShell().getDisplay(), 255, 255, 225); // Buttons Composite buttonBar = new Composite(c, SWT.NONE); GridData gd = new GridData(); gd.horizontalSpan = this.m_columnCount; // check for plugins List plugins = this.getPlugins(this.getConfiguration().getProperty("pluginlist", "")); GridLayout gl = new GridLayout(Math.max(5, (plugins.size() + 2)), false); gl.marginRight = 20; buttonBar.setLayout(gl); buttonBar.setLayoutData(gd); buttonBar.setBackground(color); // check for active reject service IService rejectService = this.getRuntime().getServiceFactory().getService("Reject"); if (rejectService != null && rejectService.isEnabled()) { final HyperLink reject = new HyperLink(buttonBar, SWT.LEFT); reject.setBackground(color); reject.setText( this.getI18nManager() .getString(this.getNamespace(), "reject", "label", this.getLanguage())); reject.pack(); reject.addMouseListener( new MouseAdapter() { public void mouseDown(MouseEvent e) { if (e.button == 1) { reject.setEnabled(false); reject.setText( getI18nManager().getString(getNamespace(), "rejected", "label", getLanguage())); reject.setUnderline(color); reject.setActiveUnderline(color); reject.setHoverUnderline(color); reject.pack(true); IEventBroker eventBroker = getRuntime().getEventBroker(); if (m_call != null) m_call.setAttribute( getRuntime() .getCallFactory() .createAttribute( IJAMConst.ATTRIBUTE_NAME_CALLSTATUS, IJAMConst.ATTRIBUTE_VALUE_REJECTED)); eventBroker.send( ExtendedBalloonDialog.this, eventBroker.createEvent(IEventConst.EVENT_TYPE_CALLREJECTED, m_call)); } } }); } if (this.isAssignement() && !this.isCliredCaller()) { final IDialogPlugin assignPlugin = new AssignPlugin(); assignPlugin.setDialog(this); HyperLink hl = new HyperLink(buttonBar, SWT.LEFT); hl.setText(assignPlugin.getLabel()); hl.setBackground(color); hl.pack(); hl.addMouseListener( new MouseAdapter() { public void mouseDown(MouseEvent e) { if (e.button == 1) { assignPlugin.run(); } } }); } // add plugins String classString = null; for (int i = 0, j = plugins.size(); i < j; i++) { classString = this.getConfiguration().getProperty((String) plugins.get(i)); if (classString != null && classString.trim().length() > 0) { try { Class classObject = Thread.currentThread().getContextClassLoader().loadClass(classString); final IDialogPlugin plugin = (IDialogPlugin) classObject.newInstance(); plugin.setDialog(this); plugin.setID((String) plugins.get(i)); if (plugin.isEnabled()) { HyperLink hl = new HyperLink(buttonBar, SWT.LEFT); hl.setText(plugin.getLabel()); hl.setBackground(color); hl.pack(); hl.addMouseListener( new MouseAdapter() { public void mouseDown(MouseEvent e) { if (e.button == 1) { plugin.run(); } } }); } } catch (ClassNotFoundException e) { this.m_logger.warning("Class not found: " + classString); } catch (InstantiationException e) { this.m_logger.log(Level.SEVERE, e.getMessage(), e); } catch (IllegalAccessException e) { this.m_logger.log(Level.SEVERE, e.getMessage(), e); } } } color.dispose(); c.pack(); }
public Object skinObjectInitialShow(SWTSkinObject skinObject, Object params) { skin = skinObject.getSkin(); SWTSkinProperties properties = skin.getSkinProperties(); colorFileDragBorder = properties.getColor("color.buddy.filedrag.bg.border"); colorFileDragBG = properties.getColor("color.buddy.filedrag.bg"); soNoBuddies = skin.getSkinObject("buddies-viewer-nobuddies-panel"); SWTSkinObject viewer = skin.getSkinObject(SkinConstants.VIEWID_BUDDIES_VIEWER); if (null != viewer) { parent = (Composite) skinObject.getControl(); parent.setBackgroundMode(SWT.INHERIT_FORCE); scrollable = new ScrolledComposite(parent, SWT.V_SCROLL); scrollable.setExpandHorizontal(true); scrollable.setExpandVertical(true); scrollable.setBackgroundMode(SWT.INHERIT_FORCE); scrollable.getVerticalBar().setIncrement(10); scrollable.getVerticalBar().setPageIncrement(65); FormData fd = new FormData(); fd.top = new FormAttachment(0, 0); fd.bottom = new FormAttachment(100, 0); fd.left = new FormAttachment(0, 0); fd.right = new FormAttachment(100, 0); scrollable.setLayoutData(fd); avatarsPanel = new Composite(scrollable, SWT.NONE); avatarsPanel.setBackgroundMode(SWT.INHERIT_FORCE); scrollable.setContent(avatarsPanel); scrollable.addListener( SWT.Resize, new Listener() { public void handleEvent(Event event) { Rectangle r = scrollable.getClientArea(); scrollable.setMinHeight(avatarsPanel.computeSize(r.width, SWT.DEFAULT).y); } }); /* * Specify avatar dimensions and attributes before creating the avatars */ textColor = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND); selectedTextColor = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT); textLinkColor = properties.getColor("color.links.hover"); imageBorderColor = properties.getColor("color.buddy.bg.border"); selectedColor = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION); highlightedColor = parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW); avatarHightLightBorder = 0; avatarImageBorder = 1; hSpacing = 1; avatarImageSize = new Point(40, 40); avatarNameSize = new Point(60, 30); avatarSize = new Point(0, 0); avatarSize.x = Math.max(avatarNameSize.x, avatarImageSize.x) + (2 * (avatarHightLightBorder + avatarImageBorder)); avatarSize.y = avatarNameSize.y + avatarImageSize.y + (2 * (avatarHightLightBorder + avatarImageBorder) + 6); fillBuddies(avatarsPanel); /* UNCOMMENT THIS SECTION TO REVERT TO A ROW LAYOUT*/ // RowLayout rLayout = new RowLayout(SWT.HORIZONTAL); // rLayout.wrap = true; // rLayout.spacing = hSpacing; // avatarsPanel.setLayout(rLayout); // COMMENT THIS SECTION TO REVERT TO A ROW LAYOUT SimpleReorderableListLayout rLayout = new SimpleReorderableListLayout(); rLayout.margin = hSpacing; rLayout.wrap = true; rLayout.center = true; avatarsPanel.setLayout(rLayout); avatarsPanel.pack(); avatarsPanel.addMouseListener( new MouseAdapter() { public void mouseDown(MouseEvent e) { select(null, false, false); } }); avatarsPanel.addMouseListener( new MouseAdapter() { public void mouseDown(MouseEvent e) { select(null, false, false); } }); parent.layout(); hookFAQLink(); hookImageAction(); } return null; }