public TagItem(Composite parent, int style, int index, Tag tag, TagPanel parentTagPanel) { super(parent, style); this.tag = tag; this.index = index; this.parentTagPanel = parentTagPanel; FormLayout layout = new FormLayout(); setLayout(layout); imageLabel = new Label(this, SWT.None); imageLabel.setImage(image); FormData data = new FormData(); data.left = new FormAttachment(0, 15); imageLabel.setLayoutData(data); textLabel = new Label(this, SWT.None); textLabel.setText(tag.getName()); int rgb[] = ColorMap.get().getRGB(tag.getColorName()); if (rgb == null) { rgb = ColorMap.get().getRGB("Black"); } unselectedBackground = getBackground(); textLabel.setForeground(new Color(getDisplay(), rgb[0], rgb[1], rgb[2])); data = new FormData(); data.left = new FormAttachment(imageLabel, 5); data.top = new FormAttachment(imageLabel, 0, SWT.CENTER); data.right = new FormAttachment(100, 0); textLabel.setLayoutData(data); imageLabel.addMouseListener(this); textLabel.addMouseListener(this); addMouseListener(this); }
private void createSorterTextBlock(final Composite composite) { final Label sorterLabel = new Label(composite, SWT.NONE); sorterLabel.setText("Sorter:"); sorterText = new Text(composite, SWT.BORDER); sorterText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); final Label clearSorterLabel = new Label(composite, SWT.PUSH); clearSorterLabel.setImage(XViewerLib.getImage("clear.gif")); clearSorterLabel.addMouseListener( new MouseListener() { @Override public void mouseDown(MouseEvent e) { // do nothing } @Override public void mouseDoubleClick(MouseEvent e) { // do nothing } @Override public void mouseUp(MouseEvent e) { sorterText.setText(""); } }); }
private void createColumnFilterTextBlock(final Composite composite) { // Filter text block final Composite composite_8 = new Composite(composite, SWT.NONE); composite_8.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 3, 1)); final GridLayout gridLayout_14 = new GridLayout(); gridLayout_14.numColumns = 3; composite_8.setLayout(gridLayout_14); final Label columnFilterLabel = new Label(composite_8, SWT.NONE); columnFilterLabel.setText("Column Filter:"); columnFilterText = new Text(composite_8, SWT.BORDER); columnFilterText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); final Label clearColumnFilterLabel = new Label(composite_8, SWT.PUSH); clearColumnFilterLabel.setImage(XViewerLib.getImage("clear.gif")); clearColumnFilterLabel.addMouseListener( new MouseListener() { @Override public void mouseDown(MouseEvent e) { // do nothing } @Override public void mouseDoubleClick(MouseEvent e) { // do nothing } @Override public void mouseUp(MouseEvent e) { columnFilterText.setText(""); } }); }
@NotNull public static Button createLabelCheckbox( @NotNull Composite parent, @NotNull String label, @Nullable String tooltip, boolean checked, int style) { Label labelControl = createControlLabel(parent, label); // labelControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); final Button button = new Button(parent, SWT.CHECK | style); if (checked) { button.setSelection(true); } labelControl.addMouseListener( new MouseAdapter() { @Override public void mouseUp(MouseEvent e) { if (!button.isDisposed() && button.isVisible() && button.isEnabled()) { button.setSelection(!button.getSelection()); button.notifyListeners(SWT.Selection, new Event()); } } }); if (tooltip != null) { labelControl.setToolTipText(tooltip); button.setToolTipText(tooltip); } return button; }
/** Updates {@link #labelAppVersion} with current verson information */ private void updateLabelAppVersion() { if (Version.isUpdateAvailable() == null) { if (ConfigurationFactory.getConfigurationFactory().getConfiguration().checkForUpdates()) { labelAppVersion.setToolTipText("Could not get version information."); } } else { if (Version.isUpdateAvailable()) { labelAppVersion.setForeground(SharedStyle.COLOR_RED); labelAppVersion.setText(Version.VERSION_NUMBER + " (Update Available!)"); labelAppVersion.setToolTipText("Click to go to update " + "download page"); labelAppVersion.setCursor(SharedStyle.CURSOR_HAND); labelAppVersion.addMouseListener( new MouseAdapter() { @Override public void mouseUp(final MouseEvent event) { Program.launch(Version.DOWNLOAD_URL); shell.dispose(); } }); } else { labelAppVersion.setText(Version.VERSION_NUMBER); labelAppVersion.setToolTipText("Latest available version!"); labelAppVersion.setForeground(SharedStyle.COLOR_GREEN); } } }
@Override public void addMouseListener(MouseListener listener) { super.addMouseListener(listener); iconLabel.addMouseListener(listener); // nameLabel.addMouseListener(listener); }
/** * @see * com.aptana.ide.editors.unified.ContributedBrowser#createControl(org.eclipse.swt.widgets.Composite) */ public void createControl(Composite parent) { browser = createSWTBrowser(parent); browser.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); errors = new Composite(parent, SWT.NONE); GridLayout eLayout = new GridLayout(2, false); eLayout.marginHeight = 1; eLayout.marginWidth = 1; eLayout.horizontalSpacing = 2; errors.setLayout(eLayout); errors.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); hand = new Cursor(errors.getDisplay(), SWT.CURSOR_HAND); errorIcon = new Label(errors, SWT.LEFT); errorIcon.setCursor(hand); MouseAdapter showConsole = new MouseAdapter() { public void mouseDown(MouseEvent e) { ConsolePlugin.getDefault() .getConsoleManager() .showConsoleView(FirefoxConsole.getConsole()); } }; errorIcon.setLayoutData(new GridData(SWT.END, SWT.FILL, true, true)); errorIcon.addMouseListener(showConsole); errorLabel = new Label(errors, SWT.LEFT); errorLabel.setCursor(hand); errorLabel.addMouseListener(showConsole); errorLabel.setForeground(errorLabel.getDisplay().getSystemColor(SWT.COLOR_DARK_RED)); errorLabel.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, true)); nsIConsoleService service = (nsIConsoleService) Mozilla.getInstance() .getServiceManager() .getServiceByContractID( "@mozilla.org/consoleservice;1", nsIConsoleService.NS_ICONSOLESERVICE_IID); // $NON-NLS-1$ service.registerListener(errorListener); // Hook console FirefoxConsole.getConsole(); }
/** * The close button disposes the {@link FilterPanel} and repacks the parent. * * @param parent */ private void createCloseButton(final Composite parent) { Label close = new Label(this, SWT.FLAT); close.setText("\u2716"); close.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); close.addMouseListener( new MouseAdapter() { @Override public void mouseUp(MouseEvent e) { dispose(); parent.pack(); } }); }
private void createButtonRow() { logger.log(Level.INFO, "Detail panel: Creating button row ..."); Button backButton = new Button(this, SWT.NONE); backButton.setText(I18n.getText("org.syncany.gui.history.DetailPanel.button.back")); backButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1)); backButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { historyDialog.showMainPanel(); } }); GridData restoreStatusCompositeGridData = new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1); restoreStatusCompositeGridData.verticalIndent = 3; restoreStatusComposite = new Composite(this, SWT.NONE); restoreStatusComposite.setLayout(new GridLayout(2, false)); restoreStatusComposite.setLayoutData(restoreStatusCompositeGridData); restoreStatusIconComposite = new ImageComposite(restoreStatusComposite, SWT.NONE); restoreStatusIconComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); restoreStatusTextLabel = new Label(restoreStatusComposite, SWT.NONE); restoreStatusTextLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1)); restoreStatusTextLabel.addMouseListener( new MouseAdapter() { @Override public void mouseUp(MouseEvent e) { if (restoredFile != null) { DesktopUtil.launch(restoredFile.getAbsolutePath()); } } }); restoreButton = new Button(this, SWT.NONE); restoreButton.setEnabled(false); restoreButton.setText(I18n.getText("org.syncany.gui.history.DetailPanel.button.restore")); restoreButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); restoreButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { restoreSelectedFile(); } }); }
/** Creates label with application homepage URL */ private void createLabelAppHomePage() { labelAppHomePage = new Label(shell, SWT.NONE); labelAppHomePage.setText(Version.HOMEPAGE); labelAppHomePage.setLayoutData(SharedStyle.relativeTo(labelReleased, labelHomePage)); labelAppHomePage.setCursor(SharedStyle.CURSOR_HAND); labelAppHomePage.setForeground(SharedStyle.COLOR_BLUE); labelAppHomePage.setToolTipText("Click to open in browser"); labelAppHomePage.addMouseListener( new MouseAdapter() { @Override public void mouseUp(final MouseEvent event) { Program.launch(Version.HOMEPAGE); shell.dispose(); } }); }
public MessageComposite(Composite parent, ViewStack viewStack) { super(parent, SWT.WRAP); this.viewStack = viewStack; this.parent = parent; setLayout(new GridLayout(2, false)); userNameLabel = new Label(this, SWT.NONE); userNameLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); backButton = new Label(this, SWT.NONE); backButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); backImage = AbstractUIPlugin.imageDescriptorFromPlugin("EclipsePlugin", "/icons/back.png") .createImage(); backButton.setImage(backImage); backButton.addMouseListener( new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { hasFocus = false; viewStack.changeToUsersView(); } }); historicMessages = new Text(this, SWT.BORDER | SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL); historicMessages.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); newMessageText = new Text(this, SWT.BORDER); newMessageText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); sendNewMessageButton = new Button(this, SWT.NONE); sendNewMessageButton.setText("Send"); sendNewMessageButton.addMouseListener( new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { if (!newMessageText.getText().isEmpty()) { revedereManager .getCurrentSession() .sendMessage(currentUser, newMessageText.getText()); newMessageText.setText(""); } } }); this.parent.layout(); }
protected Control createDialogArea(Composite parent) { dialogArea = new Composite(parent, SWT.NONE); dialogArea.setLayoutData(new GridData(GridData.FILL_BOTH)); GridLayout layout = new GridLayout(); layout.numColumns = 1; dialogArea.setLayout(layout); dialogArea.addMouseListener(clickListener); // The "click to update" label Label infoLabel = new Label(dialogArea, SWT.NONE); infoLabel.setText( MessageFormat.format( EplMessages.TitaniumUpdatePopup_update_detail, EclipseUtil.getStudioPrefix())); infoLabel.setLayoutData(new GridData(GridData.FILL_BOTH)); infoLabel.addMouseListener(clickListener); return dialogArea; }
private void createFilterTextBlock(final Composite composite) { // Filter text block final Composite composite_7 = new Composite(composite, SWT.NONE); composite_7.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 3, 1)); final GridLayout gridLayout_13 = new GridLayout(); gridLayout_13.numColumns = 5; composite_7.setLayout(gridLayout_13); final Label filterLabel = new Label(composite_7, SWT.NONE); filterLabel.setText("Filter Text:"); filterText = new Text(composite_7, SWT.BORDER); filterText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); Label filterLabel2 = new Label(composite_7, SWT.NONE); filterLabel2.setText("Regular Expression:"); filterRegExCheckBox = new Button(composite_7, SWT.CHECK); filterRegExCheckBox.setLayoutData(new GridData(SWT.RIGHT, SWT.NONE, false, false)); final Label clearFilterLabel = new Label(composite_7, SWT.PUSH); clearFilterLabel.setImage(XViewerLib.getImage("clear.gif")); clearFilterLabel.addMouseListener( new MouseListener() { @Override public void mouseDown(MouseEvent e) { // do nothing } @Override public void mouseDoubleClick(MouseEvent e) { // do nothing } @Override public void mouseUp(MouseEvent e) { filterText.setText(""); } }); }
public void showContent(Composite parent) { GridLayout gl = new GridLayout(1, true); parent.setLayout(gl); Label l = new Label(parent, SWT.NONE); l.setText(laClasse.getLabel()); l.setLayoutData(new GridData(GridData.FILL_BOTH)); Font f = new Font(Display.getCurrent(), "arial", 10, SWT.BOLD); // $NON-NLS-1$ l.setFont(f); l.addMouseTrackListener( new MouseTrackListener() { public void mouseEnter(MouseEvent e) { Label l = (Label) e.widget; l.setForeground(new Color(Display.getCurrent(), 0, 0, 200)); } public void mouseExit(MouseEvent e) { Label l = (Label) e.widget; l.setForeground(new Color(Display.getCurrent(), 0, 0, 0)); } public void mouseHover(MouseEvent e) {} }); l.addMouseListener( new MouseListener() { public void mouseDoubleClick(MouseEvent e) {} public void mouseDown(MouseEvent e) {} public void mouseUp(MouseEvent e) { // StructuredSelection ss = new StructuredSelection(laClasse); // PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().getActivePart().getSite().getSelectionProvider().setSelection(ss); Label l = (Label) e.widget; l.setForeground(new Color(Display.getCurrent(), 0, 0, 0)); // org.dafoe.ontologiclevel.Activator.currentClasse= laClasse; org.dafoe.ontologiclevel.Activator.setCurrentClass(laClasse); List<String> perpsectiveIdsFromContextLevel = org.dafoe.contextlevel.Activator.getDefault() .getContextLevel() .getPerpsectiveIdsFromContextLevel("ontologic"); // $NON-NLS-1$ IPerspectiveRegistry perspectiveRegistry = PlatformUI.getWorkbench().getPerspectiveRegistry(); IPerspectiveDescriptor perspectiveWithId = perspectiveRegistry.findPerspectiveWithId(perpsectiveIdsFromContextLevel.get(0)); PlatformUI.getWorkbench() .getActiveWorkbenchWindow() .getActivePage() .setPerspective(perspectiveWithId); } }); }
@Override protected Control createDialogArea(Composite parent) { Color background = JFaceColors.getBannerBackground(parent.getDisplay()); // Color foreground = JFaceColors.getBannerForeground(parent.getDisplay()); parent.setBackground(background); Composite group = new Composite(parent, SWT.NONE); group.setBackground(background); GridLayout layout = new GridLayout(1, false); layout.marginHeight = 20; layout.marginWidth = 20; group.setLayout(layout); GridData gd; IProduct product = Platform.getProduct(); String productVersion = DBeaverCore.getVersion().toString(); Label titleLabel = new Label(group, SWT.NONE); titleLabel.setBackground(background); titleLabel.setFont(TITLE_FONT); titleLabel.setText(product.getProperty(PRODUCT_PROP_SUB_TITLE)); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalAlignment = GridData.CENTER; titleLabel.setLayoutData(gd); titleLabel.addMouseListener( new MouseAdapter() { @Override public void mouseDoubleClick(MouseEvent e) { BusyIndicator.showWhile( getShell().getDisplay(), new Runnable() { @Override public void run() { // Do not create InstallationDialog directly // but execute "org.eclipse.ui.help.installationDialog" command IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); IHandlerService service = workbenchWindow.getService(IHandlerService.class); if (service != null) { try { service.executeCommand( "org.eclipse.ui.help.installationDialog", null); // $NON-NLS-1$ } catch (Exception e1) { // just ignore error } } } }); } }); Label imageLabel = new Label(group, SWT.NONE); imageLabel.setBackground(background); gd = new GridData(); gd.verticalAlignment = GridData.BEGINNING; gd.horizontalAlignment = GridData.CENTER; gd.grabExcessHorizontalSpace = true; imageLabel.setLayoutData(gd); imageLabel.setImage(ABOUT_IMAGE); Label versionLabel = new Label(group, SWT.NONE); versionLabel.setBackground(background); versionLabel.setText(CoreMessages.dialog_about_label_version + productVersion); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalAlignment = GridData.CENTER; versionLabel.setLayoutData(gd); Label authorLabel = new Label(group, SWT.NONE); authorLabel.setBackground(background); authorLabel.setText(product.getProperty(PRODUCT_PROP_COPYRIGHT)); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalAlignment = GridData.CENTER; authorLabel.setLayoutData(gd); Link siteLink = UIUtils.createLink( group, UIUtils.makeAnchor(product.getProperty(PRODUCT_PROP_WEBSITE)), new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { UIUtils.launchProgram(e.text); } }); siteLink.setBackground(background); gd = new GridData(); gd.horizontalAlignment = GridData.CENTER; siteLink.setLayoutData(gd); Link emailLink = UIUtils.createLink( group, UIUtils.makeAnchor(product.getProperty(PRODUCT_PROP_EMAIL)), new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { UIUtils.launchProgram("mailto:" + e.text); // $NON-NLS-1$ } }); emailLink.setBackground(background); gd = new GridData(); gd.horizontalAlignment = GridData.CENTER; emailLink.setLayoutData(gd); return parent; }
/** Initializes the GUI. */ private void initGUI() { try { this.setBackground(SWTResourceManager.getColor(192, 192, 192)); FormLayout thisLayout = new FormLayout(); this.setLayout(thisLayout); this.layout(); this.setSize(1024, 768); // Set up the header and the close button that goes on the header { FormData composite1LData = new FormData(); composite1LData.width = 1024; composite1LData.height = 120; composite1LData.left = new FormAttachment(0, 1000, 0); composite1LData.top = new FormAttachment(0, 1000, 0); headerContainer = new Composite(this, SWT.NONE); headerContainer.setLayout(null); headerContainer.setLayoutData(composite1LData); headerContainer.setBackgroundImage( ImageLoader.load(this.getDisplay(), "resources/header.png")); { closeButton = new Label(headerContainer, SWT.PUSH | SWT.CENTER); closeButton.setLocation(new org.eclipse.swt.graphics.Point(100, 0)); closeButton.setBounds(958, -2, 66, 33); closeButton.setImage(ImageLoader.load(this.getDisplay(), "resources/closeIcon.png")); closeButton.addMouseListener( new MouseAdapter() { public void mouseDown(MouseEvent evt) { closeButtonMouseDown(evt); } }); } } { FormData mainContentContainerLData = new FormData(); mainContentContainerLData.width = 834; mainContentContainerLData.height = 648; mainContentContainerLData.left = new FormAttachment(0, 1000, 190); mainContentContainerLData.top = new FormAttachment(0, 1000, 120); mainContentContainer = new Composite(this, SWT.NONE); mainContentContainer.setLayout(null); mainContentContainer.setLayoutData(mainContentContainerLData); mainContentContainer.setBackground(SWTResourceManager.getColor(255, 255, 255)); { mainNavigation = new ToolBar(mainContentContainer, SWT.FLAT | SWT.WRAP); mainNavigation.setBounds(0, 0, 835, 85); mainNavigation.setLayoutData(new FillLayout()); mainNavigation.setBackground(SWTResourceManager.getColor(239, 239, 239)); // Create the navigation tab bar { navigation = new NavigationBar(this.getDisplay(), this.mainContentContainer); navigation.createNavigationElement( home.getComponents("hvac"), mainNavigation, "resources/navigationIcons/hvac_active.png", "resources/navigationIcons/hvac_inactive.png"); navigation.createNavigationElement( home.getComponents("lighting"), mainNavigation, "resources/navigationIcons/lighting_active.png", "resources/navigationIcons/lighting_inactive.png"); navigation.createNavigationElement( home.getComponents("entertainment"), mainNavigation, "resources/navigationIcons/entertainment_active.png", "resources/navigationIcons/entertainment_inactive.png"); navigation.createNavigationElement( home.getComponents("security"), mainNavigation, "resources/navigationIcons/security_active.png", "resources/navigationIcons/security_inactive.png"); navigation.createNavigationElement( home.getComponents("other"), mainNavigation, "resources/navigationIcons/appliances_active.png", "resources/navigationIcons/appliances_inactive.png"); } mainNavigation.pack(); } { ambientTemperatureLabel = new Label(mainContentContainer, SWT.NONE); ambientTemperatureLabel.setText("Ambient Temperature: 0" + degreeSymbol); ambientTemperatureLabel.setBounds(176, 117, 385, 39); ambientTemperatureLabel.setBackground(SWTResourceManager.getColor(32, 32, 32)); ambientTemperatureLabel.setForeground(SWTResourceManager.getColor(255, 255, 255)); ambientTemperatureLabel.setFont( SWTResourceManager.getFont("Gill Sans MT", 18, 1, false, false)); ambientTemperatureLabel.setAlignment(SWT.CENTER); } } // Set up the sidebar { // Make it look pretty FormData sideBarContainerLData = new FormData(); sideBarContainerLData.width = 190; sideBarContainerLData.height = 647; sideBarContainerLData.left = new FormAttachment(0, 1000, 0); sideBarContainerLData.top = new FormAttachment(0, 1000, 120); sideBarContainer = new Composite(this, SWT.NONE); sideBarContainer.setLayout(null); sideBarContainer.setLayoutData(sideBarContainerLData); sideBarContainer.setBackgroundImage( ImageLoader.load(this.getDisplay(), "resources/sidebar.png")); // Current weather section { currentWeatherLabel = new Label(sideBarContainer, SWT.NONE); currentWeatherLabel.setText("Current Weather"); currentWeatherLabel.setFont( SWTResourceManager.getFont("Gill Sans MT", 13, 1, false, false)); currentWeatherLabel.setBounds(13, 24, 161, 25); currentWeatherLabel.setForeground(SWTResourceManager.getColor(51, 51, 51)); currentWeatherLabel.setAlignment(SWT.CENTER); } { currentWeatherIcon = new Label(sideBarContainer, SWT.NONE); currentWeatherIcon.setBounds(43, 61, 100, 100); currentWeatherIcon.setSize(93, 93); } { currentWeatherTemperature = new Label(sideBarContainer, SWT.NONE); currentWeatherTemperature.setBounds(17, 160, 160, 43); currentWeatherTemperature.setFont( SWTResourceManager.getFont("Gill Sans MT", 24, 1, false, false)); currentWeatherTemperature.setForeground(SWTResourceManager.getColor(51, 51, 51)); currentWeatherTemperature.setAlignment(SWT.CENTER); } { currentWeatherAdditional = new Label(sideBarContainer, SWT.NONE); currentWeatherAdditional.setFont( SWTResourceManager.getFont("Gill Sans MT", 8, 1, false, false)); currentWeatherAdditional.setForeground(SWTResourceManager.getColor(51, 51, 51)); currentWeatherAdditional.setBounds(11, 202, 166, 47); currentWeatherAdditional.setAlignment(SWT.CENTER); } LocalWeather localWeather = new LocalWeather(home.getLocation().getZipcode()); currentWeatherTemperature.setText("" + localWeather.getTemperature() + degreeSymbol + "F"); currentWeatherIcon.setImage(localWeather.getCurrentImage(this.getDisplay())); currentWeatherAdditional.setText( "Today's High: " + localWeather.getHighTemperature() + "\nPrecipitation: " + localWeather.getPrecipitation() + "%"); } } catch (Exception e) { e.printStackTrace(); } }
public Composite configSectionCreate(final Composite parent) { ImageLoader imageLoader = ImageLoader.getInstance(); Image imgOpenFolder = imageLoader.getImage("openFolderButton"); GridData gridData; GridLayout layout; final Composite cBR = new Composite(parent, SWT.NULL); gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL); cBR.setLayoutData(gridData); layout = new GridLayout(); layout.numColumns = 1; cBR.setLayout(layout); Label info_label = new Label(cBR, SWT.WRAP); Messages.setLanguageText(info_label, "ConfigView.section.br.overview"); gridData = Utils.getWrappableLabelGridData(1, GridData.HORIZONTAL_ALIGN_FILL); info_label.setLayoutData(gridData); // wiki link final Label linkLabel = new Label(cBR, SWT.NULL); linkLabel.setText(MessageText.getString("ConfigView.label.please.visit.here")); linkLabel.setData("http://wiki.vuze.com/w/Backup_And_Restore"); linkLabel.setCursor(linkLabel.getDisplay().getSystemCursor(SWT.CURSOR_HAND)); linkLabel.setForeground(Colors.blue); gridData = Utils.getWrappableLabelGridData(1, 0); linkLabel.setLayoutData(gridData); linkLabel.addMouseListener( new MouseAdapter() { public void mouseDoubleClick(MouseEvent arg0) { Utils.launch((String) ((Label) arg0.widget).getData()); } public void mouseDown(MouseEvent arg0) { Utils.launch((String) ((Label) arg0.widget).getData()); } }); ClipboardCopy.addCopyToClipMenu(linkLabel); final BackupManager backup_manager = BackupManagerFactory.getManager(AzureusCoreFactory.getSingleton()); // backup Group gBackup = new Group(cBR, SWT.NULL); Messages.setLanguageText(gBackup, "br.backup"); layout = new GridLayout(2, false); gBackup.setLayout(layout); gBackup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // info Label last_backup_label = new Label(gBackup, SWT.NULL); Messages.setLanguageText(last_backup_label, "br.backup.last.time"); final Label last_backup_time = new Label(gBackup, SWT.NULL); Label last_backup_error_label = new Label(gBackup, SWT.NULL); Messages.setLanguageText(last_backup_error_label, "br.backup.last.error"); final Label last_backup_error = new Label(gBackup, SWT.NULL); final Runnable stats_updater = new Runnable() { public void run() { long backup_time = backup_manager.getLastBackupTime(); last_backup_time.setText(backup_time == 0 ? "" : String.valueOf(new Date(backup_time))); last_backup_error.setText(backup_manager.getLastBackupError()); }; }; stats_updater.run(); // manual button Label backup_manual_label = new Label(gBackup, SWT.NULL); Messages.setLanguageText(backup_manual_label, "br.backup.manual.info"); Button backup_button = new Button(gBackup, SWT.PUSH); Messages.setLanguageText(backup_button, "br.backup"); backup_button.addListener( SWT.Selection, new Listener() { public void handleEvent(Event event) { String def_dir = COConfigurationManager.getStringParameter("br.backup.folder.default"); DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.APPLICATION_MODAL); if (def_dir != null) { dialog.setFilterPath(def_dir); } dialog.setMessage(MessageText.getString("br.backup.folder.info")); dialog.setText(MessageText.getString("br.backup.folder.title")); String path = dialog.open(); if (path != null) { COConfigurationManager.setParameter("br.backup.folder.default", path); runBackup(backup_manager, path, stats_updater); } } }); final BooleanParameter auto_backup_enable = new BooleanParameter(gBackup, "br.backup.auto.enable", "br.backup.auto.enable"); gridData = new GridData(); gridData.horizontalSpan = 2; auto_backup_enable.setLayoutData(gridData); Composite gDefaultDir = new Composite(gBackup, SWT.NONE); layout = new GridLayout(); layout.numColumns = 3; layout.marginHeight = 2; gDefaultDir.setLayout(layout); gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.horizontalSpan = 2; gDefaultDir.setLayoutData(gridData); Label lblDefaultDir = new Label(gDefaultDir, SWT.NONE); Messages.setLanguageText(lblDefaultDir, "ConfigView.section.file.defaultdir.ask"); lblDefaultDir.setLayoutData(new GridData()); gridData = new GridData(GridData.FILL_HORIZONTAL); final StringParameter pathParameter = new StringParameter(gDefaultDir, "br.backup.auto.dir", ""); pathParameter.setLayoutData(gridData); if (pathParameter.getValue().length() == 0) { String def_dir = COConfigurationManager.getStringParameter("br.backup.folder.default"); pathParameter.setValue(def_dir); } Button browse = new Button(gDefaultDir, SWT.PUSH); browse.setImage(imgOpenFolder); imgOpenFolder.setBackground(browse.getBackground()); browse.setToolTipText(MessageText.getString("ConfigView.button.browse")); browse.addListener( SWT.Selection, new Listener() { /* (non-Javadoc) * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event) */ public void handleEvent(Event event) { DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.APPLICATION_MODAL); dialog.setFilterPath(pathParameter.getValue()); dialog.setMessage(MessageText.getString("br.backup.auto.dir.select")); dialog.setText(MessageText.getString("ConfigView.section.file.defaultdir.ask")); String path = dialog.open(); if (path != null) { pathParameter.setValue(path); COConfigurationManager.setParameter("br.backup.folder.default", path); } } }); Label lbl_backup_days = new Label(gDefaultDir, SWT.NULL); Messages.setLanguageText(lbl_backup_days, "br.backup.auto.everydays"); IntParameter backup_everydays = new IntParameter(gDefaultDir, "br.backup.auto.everydays", 1, Integer.MAX_VALUE); gridData = new GridData(); gridData.horizontalSpan = 2; backup_everydays.setLayoutData(gridData); Label lbl_backup_retain = new Label(gDefaultDir, SWT.NULL); Messages.setLanguageText(lbl_backup_retain, "br.backup.auto.retain"); IntParameter backup_retain = new IntParameter(gDefaultDir, "br.backup.auto.retain", 1, Integer.MAX_VALUE); gridData = new GridData(); gridData.horizontalSpan = 2; backup_retain.setLayoutData(gridData); BooleanParameter chkNotify = new BooleanParameter(gDefaultDir, "br.backup.notify", "br.backup.notify"); gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.horizontalSpan = 3; chkNotify.setLayoutData(gridData); Label backup_auto_label = new Label(gDefaultDir, SWT.NULL); Messages.setLanguageText(backup_auto_label, "br.backup.auto.now"); Button backup_auto_button = new Button(gDefaultDir, SWT.PUSH); Messages.setLanguageText(backup_auto_button, "br.test"); backup_auto_button.addListener( SWT.Selection, new Listener() { public void handleEvent(Event event) { runBackup(backup_manager, null, stats_updater); } }); auto_backup_enable.setAdditionalActionPerformer( new ChangeSelectionActionPerformer(gDefaultDir)); // restore Group gRestore = new Group(cBR, SWT.NULL); Messages.setLanguageText(gRestore, "br.restore"); layout = new GridLayout(2, false); gRestore.setLayout(layout); gRestore.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label restore_label = new Label(gRestore, SWT.NULL); Messages.setLanguageText(restore_label, "br.restore.info"); Button restore_button = new Button(gRestore, SWT.PUSH); Messages.setLanguageText(restore_button, "br.restore"); restore_button.addListener( SWT.Selection, new Listener() { public void handleEvent(Event event) { String def_dir = COConfigurationManager.getStringParameter("br.backup.folder.default"); DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.APPLICATION_MODAL); if (def_dir != null) { dialog.setFilterPath(def_dir); } dialog.setMessage(MessageText.getString("br.restore.folder.info")); dialog.setText(MessageText.getString("br.restore.folder.title")); final String path = dialog.open(); if (path != null) { MessageBoxShell mb = new MessageBoxShell( SWT.ICON_WARNING | SWT.OK | SWT.CANCEL, MessageText.getString("br.restore.warning.title"), MessageText.getString("br.restore.warning.info")); mb.setDefaultButtonUsingStyle(SWT.CANCEL); mb.setParent(parent.getShell()); mb.open( new UserPrompterResultListener() { public void prompterClosed(int returnVal) { if (returnVal != SWT.OK) { return; } final TextViewerWindow viewer = new TextViewerWindow( MessageText.getString("br.backup.progress"), null, "", true, true); viewer.setEditable(false); viewer.setOKEnabled(false); backup_manager.restore( new File(path), new BackupManager.BackupListener() { public boolean reportProgress(String str) { return (append(str, false)); } public void reportComplete() { append("Restore Complete!", true); Utils.execSWTThread( new AERunnable() { public void runSupport() { MessageBoxShell mb = new MessageBoxShell( SWT.ICON_INFORMATION | SWT.OK, MessageText.getString( "ConfigView.section.security.restart.title"), MessageText.getString( "ConfigView.section.security.restart.msg")); mb.setParent(parent.getShell()); mb.open( new UserPrompterResultListener() { public void prompterClosed(int returnVal) { UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT(); if (uiFunctions != null) { uiFunctions.dispose(true, false); } } }); } }); } public void reportError(Throwable error) { append( "Restore Failed: " + Debug.getNestedExceptionMessage(error), true); } private boolean append(final String str, final boolean complete) { if (viewer.isDisposed()) { return (false); } Utils.execSWTThread( new AERunnable() { public void runSupport() { if (str.endsWith("...")) { viewer.append(str); } else { viewer.append(str + "\r\n"); } if (complete) { viewer.setOKEnabled(true); } } }); return (true); } }); viewer.goModal(); } }); } } }); return (cBR); }
private void createClearTextNew(Composite parent) { // only create the button if the text widget doesn't support one // natively if ((filterText.getStyle() & SWT.ICON_CANCEL) == 0) { final Image inactiveImage = new Image( this.getDisplay(), FilterTextComposite.class.getResourceAsStream(DISABLED_CLEAR_ICON)); final Image activeImage = new Image(this.getDisplay(), FilterTextComposite.class.getResourceAsStream(CLEAR_ICON)); final Image pressedImage = new Image(getDisplay(), activeImage, SWT.IMAGE_GRAY); final Label clearButton = new Label(parent, SWT.NONE); clearButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); clearButton.setImage(inactiveImage); clearButton.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); clearButton.setToolTipText("Tooltip"); clearButton.addMouseListener( new MouseAdapter() { private MouseMoveListener fMoveListener; public void mouseDown(MouseEvent e) { clearButton.setImage(pressedImage); fMoveListener = new MouseMoveListener() { private boolean fMouseInButton = true; public void mouseMove(MouseEvent e) { boolean mouseInButton = isMouseInButton(e); if (mouseInButton != fMouseInButton) { fMouseInButton = mouseInButton; clearButton.setImage(mouseInButton ? pressedImage : inactiveImage); } } }; clearButton.addMouseMoveListener(fMoveListener); } public void mouseUp(MouseEvent e) { if (fMoveListener != null) { clearButton.removeMouseMoveListener(fMoveListener); fMoveListener = null; boolean mouseInButton = isMouseInButton(e); clearButton.setImage(mouseInButton ? activeImage : inactiveImage); if (mouseInButton) { clearText(); filterText.setFocus(); } } } private boolean isMouseInButton(MouseEvent e) { Point buttonSize = clearButton.getSize(); return 0 <= e.x && e.x < buttonSize.x && 0 <= e.y && e.y < buttonSize.y; } }); clearButton.addMouseTrackListener( new MouseTrackListener() { public void mouseEnter(MouseEvent e) { clearButton.setImage(activeImage); } public void mouseExit(MouseEvent e) { clearButton.setImage(inactiveImage); } public void mouseHover(MouseEvent e) {} }); clearButton.addDisposeListener( new DisposeListener() { public void widgetDisposed(DisposeEvent e) { inactiveImage.dispose(); activeImage.dispose(); pressedImage.dispose(); } }); this.clearButtonControl = clearButton; } }
/** * 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); }
@Override protected void configureShell(Shell newShell) { newShell.setText(getTitle()); newShell.setImage(getImage()); newShell.addPaintListener( new PaintListener() { public void paintControl(PaintEvent e) { Shell shell = (Shell) e.getSource(); Rectangle rect = shell.getClientArea(); rect.width--; rect.height--; Color c = new Color(shell.getDisplay(), 0x1E, 0x3E, 0x93); e.gc.setForeground(c); e.gc.drawRectangle(0, 0, rect.width, rect.height); c.dispose(); c = new Color(shell.getDisplay(), 0xAA, 0xE1, 0xFF); e.gc.setForeground(c); e.gc.drawRectangle(1, 1, rect.width - 2, rect.height - 2); c.dispose(); c = new Color(shell.getDisplay(), 0x53, 0xAE, 0xF3); e.gc.setForeground(c); e.gc.drawRectangle(2, 2, rect.width - 4, rect.height - 4); c.dispose(); Color top = new Color(shell.getDisplay(), 0x15, 0x77, 0xD3); Color bottom = new Color(shell.getDisplay(), 0x68, 0xB6, 0xF7); String title = getTitle(); Point extent = e.gc.textExtent(title); int height = Math.max(18, extent.y + 6); e.gc.setForeground(top); e.gc.setBackground(bottom); e.gc.fillGradientRectangle(2, 2, rect.width - 4, height, true); top.dispose(); bottom.dispose(); c = new Color(shell.getDisplay(), 0x4F, 0x93, 0xD5); e.gc.setForeground(c); e.gc.setBackground(shell.getBackground()); e.gc.drawRectangle(3, 2 + height, rect.width - 6, 2 + height); c.dispose(); Image image = getImage(); Rectangle imageRect = image.getBounds(); e.gc.drawImage(getImage(), 4, 2 + ((height - imageRect.height) >> 1)); e.gc.setForeground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE)); e.gc.setFont(Resources.getInstance().getDefaultFont()); e.gc.drawString( title, 6 + imageRect.width, Math.max(5, (height - extent.y) >> 1), true); bottom = new Color(shell.getDisplay(), 0xCC, 0xEB, 0xFF); e.gc.setForeground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE)); e.gc.setBackground(bottom); e.gc.fillGradientRectangle( 3, 3 + height, rect.width - 5, rect.height - 5 - height, true); bottom.dispose(); Rectangle btnRect = btnDefault.getBounds(); c = new Color(shell.getDisplay(), 0x9A, 0xBD, 0xE2); int x = btnRect.x; int y = btnRect.y - 5; while (x < rect.width - 3) { e.gc.setForeground(c); e.gc.drawPoint(x, y); e.gc.setForeground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE)); e.gc.drawPoint(x, y + 1); x += 3; } c.dispose(); e.gc.setForeground(shell.getDisplay().getSystemColor(SWT.COLOR_BLUE)); TextLayout layout = new TextLayout(shell.getDisplay()); layout.setWidth(215); layout.setText(getTip()); layout.setFont(res.getDefaultFont()); layout.draw(e.gc, 3 + getLeftMargin(), 2 + height + getTopMargin()); layout.dispose(); } }); newShell.addMouseListener( new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { downX = e.x; downY = e.y; isMove = true; } @Override public void mouseUp(MouseEvent e) { isMove = false; } }); newShell.addMouseMoveListener( new MouseMoveListener() { public void mouseMove(MouseEvent e) { if (isMove) { Point loc = getShell().getLocation(); int x = loc.x + e.x - downX; int y = loc.y + e.y - downY; getShell().setLocation(x, y); } } }); // create default button newShell.setLayout(new FormLayout()); // close button Label lblClose = new Label(newShell, SWT.CENTER); lblClose.setImage(res.getImage(Resources.bmpCloseNormal)); FormData fd = new FormData(); fd.top = new FormAttachment(0, 3); fd.height = 16; fd.right = new FormAttachment(100, -3); fd.width = 17; lblClose.setLayoutData(fd); lblClose.addMouseTrackListener( new MouseTrackAdapter() { @Override public void mouseEnter(MouseEvent e) { Label lbl = (Label) e.getSource(); lbl.setImage(res.getImage(Resources.bmpCloseHover)); } @Override public void mouseExit(MouseEvent e) { Label lbl = (Label) e.getSource(); lbl.setImage(res.getImage(Resources.bmpCloseNormal)); } }); lblClose.addMouseListener( new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { Label lbl = (Label) e.getSource(); lbl.setImage(res.getImage(Resources.bmpCloseDown)); } @Override public void mouseUp(MouseEvent e) { getShell().close(); } }); btnDefault = new Slat(newShell); btnDefault.setText(getButtonLabel()); fd = new FormData(); fd.bottom = new FormAttachment(100, -6); fd.left = new FormAttachment(0, 6); btnDefault.setLayoutData(fd); btnDefault.addMouseListener( new MouseAdapter() { @Override public void mouseUp(MouseEvent e) { getShell().close(); onButton(); } }); btnDefault.setVisible(showButton()); }
/** * 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 = ""; } }