Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 28277 Details for
Bug 106182
[plan item] Improve and extend the SWT widget set
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
buttons are getting elongated
UploaderScreen.java (text/plain), 12.76 KB, created by
sivashankari natarajan
on 2005-10-14 02:48:39 EDT
(
hide
)
Description:
buttons are getting elongated
Filename:
MIME Type:
Creator:
sivashankari natarajan
Created:
2005-10-14 02:48:39 EDT
Size:
12.76 KB
patch
obsolete
>/* > * > * Project : Spogger > * File Name : UploaderScreen.java > * Package : com.spogger.ui > * Id : $Id: UploaderScreen.java,v 1.5 2005/09/23 > * Date : $Date: 2005/10/04 15:40:53 $ > * Revision : $Revision: 1.13 $ > * Copyright (c) Spogger, Inc. > * All rights reserved. > */ >package com.spogger.ui; > >import org.apache.commons.logging.Log; >import org.apache.commons.logging.LogFactory; >import org.eclipse.swt.SWT; >import org.eclipse.swt.events.SelectionAdapter; >import org.eclipse.swt.events.SelectionEvent; >import org.eclipse.swt.events.ShellAdapter; >import org.eclipse.swt.events.ShellEvent; >import org.eclipse.swt.graphics.Font; >import org.eclipse.swt.graphics.Image; >import org.eclipse.swt.layout.FillLayout; >import org.eclipse.swt.widgets.Button; >import org.eclipse.swt.widgets.Composite; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.Event; >import org.eclipse.swt.widgets.FileDialog; >import org.eclipse.swt.widgets.Label; >import org.eclipse.swt.widgets.Listener; >import org.eclipse.swt.widgets.Menu; >import org.eclipse.swt.widgets.MenuItem; >import org.eclipse.swt.widgets.Shell; >import org.eclipse.swt.widgets.TabFolder; >import org.eclipse.swt.widgets.TabItem; >import org.eclipse.swt.widgets.Table; > >import com.spogger.action.UploadManager; >import com.spogger.common.ServiceFactory; >import com.spogger.ftp.UploadConnectionPool; >import com.spogger.model.MediaFile; >import com.spogger.util.BrowserUtil; >import com.spogger.util.CommonUtils; >import com.spogger.util.ISpoggerConstants; >import com.spogger.util.UploaderProperties; > >public class UploaderScreen { > private Display mDisplay; > private Shell mShell; > private Composite mCompositeUploading; > private Composite mCompositeCompleted; > private UploaderTable uploadtable; > private CompletedTable completetable; > protected final Log logger = LogFactory.getLog(getClass()); > private String userName; > private String password; > > private Table mUploadingTable; > private Table mCompletedTable; > > private int i = 0; > > > > /** > * public methods > */ > static private UploaderScreen instance = new UploaderScreen(); > > static public UploaderScreen getInstance() { > return instance; > } > private UploaderScreen() { > ServiceFactory.getUserActionListener(); > } > /** > * Creates the uploader screen > * @param user > * @param pwd > */ > public void createFrame(String user, String pwd){ > userName = user; > password = pwd; > UploadConnectionPool.initializePool(user, pwd); > uploadtable = new UploaderTable(); > completetable= new CompletedTable(); > createAndShowGUI(); > createMenuBar(); > createTabbedPane(); > createTables(); > //refreshTables(); > defineShellConstants(); > > } > > /** > * This should be the last method which is meant for the shell to open and > * holds shell size and location. > * > */ > private void defineShellConstants(){ > mShell.setSize(1050, 740); > mShell.setLocation(0, 0); > //mShell.pack(); > mShell.open(); > while (!mShell.isDisposed()) { > if (!mDisplay.readAndDispatch()) > mDisplay.sleep(); > } > mDisplay.dispose(); > } > > /** > * creates the frame > * > */ > private void createAndShowGUI() { > mDisplay = new Display(); > mShell = new Shell(mDisplay); > mShell.setText(getMessage("frameheader")); > Image image = new Image(mDisplay,ISpoggerConstants.LOGO_GIF); > mShell.setImage (image); > //TODO for resizing > /*FillLayout layout = new FillLayout(); > mShell.setLayout(layout); > RowLayout layout = new RowLayout(); > layout.wrap = true; > layout.justify = true;*/ > > mShell.addShellListener(new ShellAdapter() { > public void shellClosed(ShellEvent event) { > int response = new CommonUtils().displayInformationMessage(mShell,getMessage("exit")); > if(event.doit = response == SWT.OK){ > uploadtable.persistUserPreferenceForSorting(); > completetable.persistUserPreferenceForSorting(); > closeApplication(); > > } > }}); > } > /** > * creates the uploading table which contains the file details and completed > * table which contains information about file upload completed details > * > */ > private void createTables() { > mUploadingTable = uploadtable.createContents(mShell,mCompositeUploading); > mCompletedTable = completetable.createCompletedTable(mShell,mCompositeCompleted); > > } > > private void createTabbedPane(){ > > Font font = new Font(mDisplay, "", 9, SWT.BOLD); > > final TabFolder tabfolder = new TabFolder(mShell, SWT.CLOSE); > tabfolder.setBounds(10, 10, 1000, 680); > > Label imageLabel=new Label(tabfolder,SWT.NONE); > imageLabel.setSize(100, 100); > imageLabel.setLocation(915, 0); > > mCompositeUploading = new Composite(tabfolder, SWT.CENTER); > final Button btnAddFile = new Button(mCompositeUploading, SWT.PUSH); > btnAddFile.setText(getMessage("addfiles")); > btnAddFile.setSize(80, 30); > btnAddFile.setLocation(10, 10); > btnAddFile.setFont(font); > Display.getDefault().syncExec(new Runnable() { > public void run() { > btnAddFile.addListener(SWT.Selection, new Listener() { > public void handleEvent(Event event) { > //new FileHandler().openFileDialog(mShell); > FileDialog mFileDialog = new FileDialog(mShell, SWT.MULTI); > mFileDialog.setFilterExtensions(new String[] { > "*.bmp; *.gif; *.ico; *.jpg; *.pcx; *.png; *.tif", "*.bmp", > "*.gif","*.mpg", "*.ico", "*.jpg", "*.pcx", "*.png", "*.tif","*.*" }); > > mFileDialog.open(); > String[] selectedFiles = mFileDialog.getFileNames(); > String mFilepath = mFileDialog.getFilterPath(); > CommonUtils util=new CommonUtils(); > MediaFile file=null; > boolean fileExists = false; > for (int i = 0; i < selectedFiles.length; i++) { > file = util.loadFileProperties(mFilepath,selectedFiles[i]); > file.setUserLoginName(userName); > fileExists = util.fileExists(file.getFileName(),file.getLocalPath()); > if (fileExists) { > util.displayErrorMessage(mShell,getMessage("fileexist")); > break; > } > uploadtable.setTableItems(mUploadingTable,file); > ServiceFactory.getUserActionListener().addFile(file); > > } > > } > }); // button > } > });// thread > > > > Label lblBrowseDesktop = new Label(mCompositeUploading, SWT.NONE); > lblBrowseDesktop.setText(getMessage("browselabel")); > lblBrowseDesktop.setSize(400, 30); > lblBrowseDesktop.setLocation(100, 10); > > final Button btnResumeAll = new Button(mCompositeUploading, SWT.PUSH); > btnResumeAll.setText(getMessage("resumeall")); > btnResumeAll.setSize(80, 30); > btnResumeAll.setLocation(650, 10); > btnResumeAll.setEnabled(false); > > final Button btnPauseAll = new Button(mCompositeUploading, SWT.PUSH); > btnPauseAll.setText(getMessage("pauseall")); > btnPauseAll.setSize(80, 30); > btnPauseAll.setLocation(550, 10); > btnPauseAll.addSelectionListener(new SelectionAdapter() { > public void widgetSelected(SelectionEvent e) { > btnResumeAll.setEnabled(true); > btnPauseAll.setEnabled(false); > ServiceFactory.getUserActionListener().pauseAll(); > } > }); > > btnResumeAll.addSelectionListener(new SelectionAdapter() { > public void widgetSelected(SelectionEvent e) { > btnPauseAll.setEnabled(true); > btnResumeAll.setEnabled(false); > ServiceFactory.getUserActionListener().resumeAll(); > > } > }); > Button btnRemoveAll = new Button(mCompositeUploading, SWT.PUSH); > btnRemoveAll.setText(getMessage("removeall")); > btnRemoveAll.setSize(80, 30); > btnRemoveAll.setLocation(750, 10); > btnRemoveAll.addSelectionListener(new SelectionAdapter() { > public void widgetSelected(SelectionEvent e) { > ServiceFactory.getUserActionListener().cancelAll(); > } > }); > Font tabfont = new Font(mDisplay, "", 10, SWT.NORMAL); > tabfolder.setFont(tabfont); > > TabItem tabItemUploading = new TabItem(tabfolder,SWT.NULL| SWT.BOTTOM); > tabItemUploading.setText(getMessage("uploading")); > tabItemUploading.setControl(mCompositeUploading); > > mCompositeCompleted = new Composite(tabfolder, SWT.NONE); > TabItem tabItemCompleted = new TabItem(tabfolder, SWT.NULL| SWT.BOTTOM); > tabItemCompleted.setText(getMessage("completed")); > tabItemCompleted.setControl(mCompositeCompleted); > > } > > /* > * > * This method will create the menubar and menu items > * > */ > private void createMenuBar(){ > Menu menubar = new Menu(mShell, SWT.BAR); > mShell.setMenuBar(menubar); > MenuItem menuItemFile = new MenuItem(menubar, SWT.CASCADE); > menuItemFile.setText(getMessage("file")); > Menu fileMenu = new Menu(mShell, SWT.DROP_DOWN); > menuItemFile.setMenu(fileMenu); > > final MenuItem menuItemConnect = new MenuItem(fileMenu, SWT.PUSH); > menuItemConnect.setText(getMessage("connect")); > menuItemConnect.setEnabled(false); > > final MenuItem menuItemDisconnect = new MenuItem(fileMenu, SWT.PUSH); > menuItemDisconnect.setText(getMessage("disconnect")); > menuItemDisconnect.setEnabled(true); > > menuItemConnect.addSelectionListener(new SelectionAdapter() { > public void widgetSelected(SelectionEvent e) { > menuItemDisconnect.setEnabled(true); > menuItemConnect.setEnabled(false); > } > }); > > menuItemDisconnect.addSelectionListener(new SelectionAdapter() { > public void widgetSelected(SelectionEvent e) { > menuItemDisconnect.setEnabled(false); > menuItemConnect.setEnabled(true); > } > }); > MenuItem menuItemQuit = new MenuItem(fileMenu, SWT.PUSH); > menuItemQuit.setText(getMessage("quit")); > menuItemQuit.addSelectionListener(new SelectionAdapter() { > public void widgetSelected(SelectionEvent e) { > uploadtable.persistUserPreferenceForSorting(); > int response = new CommonUtils().displayInformationMessage(mShell,getMessage("exit")); > closeApplication(); > } > }); > MenuItem menuItemOptions = new MenuItem(menubar, SWT.CASCADE); > menuItemOptions.setText(getMessage("options")); > Menu optionsMenu = new Menu(mShell, SWT.DROP_DOWN); > menuItemOptions.setMenu(optionsMenu); > MenuItem menuItemSettings = new MenuItem(optionsMenu, SWT.PUSH); > menuItemSettings.setText(getMessage("settings")); > menuItemSettings.addSelectionListener(new SelectionAdapter() { > public void widgetSelected(SelectionEvent e) { > } > }); > MenuItem menuItemHelp = new MenuItem(menubar, SWT.CASCADE); > menuItemHelp.setText(getMessage("help")); > Menu helpMenu = new Menu(mShell, SWT.DROP_DOWN); > menuItemHelp.setMenu(helpMenu); > MenuItem menuItemFAQ = new MenuItem(helpMenu, SWT.PUSH); > menuItemFAQ.setText(getMessage("faq")); > menuItemFAQ.addSelectionListener(new SelectionAdapter(){ > public void widgetSelected(SelectionEvent e) { > //new FAQDialog(mShell); > BrowserUtil.displayURL(mShell,getMessage("faqurl")); > } > }); > MenuItem menuItemAbout = new MenuItem(helpMenu, SWT.PUSH); > menuItemAbout.setText(getMessage("about")); > menuItemAbout.addSelectionListener(new SelectionAdapter(){ > public void widgetSelected(SelectionEvent e){ > new AboutDialog(mShell); > } > }); > } > /** > * Sets the TableItem whenever the new status is updated > * @param mediafile > */ > public void updateTableItem(final MediaFile mediafile){ > mDisplay.asyncExec(new Runnable(){ > public void run() { > int status = mediafile.getStatus(); > if(status==MediaFile.COMPLETED){ > completetable.setTableItems(mCompletedTable,mediafile); > removeAll(mUploadingTable); > } > uploadtable.updateTableItem(mUploadingTable,mediafile); > > }}); > } > > public void removeAll(Table tableUploading){ > logger.debug("removeall frm table "); > for(int i = 0;i<tableUploading.getItemCount();i++){ > tableUploading.remove(i); > } > } > > > > public void updatePercentageCompletion(final MediaFile mediafile){ > mDisplay.asyncExec(new Runnable(){ > public void run() { > uploadtable.updateProgressbar(mUploadingTable,mediafile); > } > }); > > } > /** > * loads property files > * @param key > * @return > */ > private String getMessage(String key){ > return UploaderProperties.getProperty(key); > } > > public synchronized void closeApplication(){ > UploadManager.stopPendingTransferThread(); > UploadConnectionPool.getInstance().releaseAllConnections(); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 106182
: 28277