FileDocCategorySizeDatePackage
PublishListener.javaAPI DocAzureus 3.0.3.43875Thu Aug 02 12:19:32 BST 2007com.aelitis.azureus.ui.swt.browser.listener.publish

PublishListener

public class PublishListener extends com.aelitis.azureus.ui.swt.browser.txn.AbstractTransactionalListener
Handles messages from the PublishNewContent page.
  • choose-file
  • choose-folder
  • torrent-ready
author
dharkness
created
Jul 18, 2006

Fields Summary
public static final String
DEFAULT_LISTENER_ID
public static final String
OP_CHOOSE_FILE
public static final String
OP_CHOOSE_FOLDER
public static final String
OP_CHOOSE_THUMBNAIL
public static final String
OP_EDIT_THUMBNAIL
public static final String
OP_TORRENT_READY
public static final String
OP_CANCEL
private org.eclipse.swt.widgets.Shell
shell
private LocalHoster
hoster
Constructors Summary
public PublishListener(org.eclipse.swt.widgets.Shell s, LocalHoster hoster)


	     
		this(s, DEFAULT_LISTENER_ID, hoster);
	
public PublishListener(org.eclipse.swt.widgets.Shell s, String id, LocalHoster hoster)

        super(id);
        
        this.shell = s;
        this.hoster = hoster;
        
        registerOperationTxnRequiresNew(OP_CHOOSE_FILE);
        registerOperationTxnRequiresNew(OP_CHOOSE_FOLDER);
        registerOperationTxnMandatory(OP_CHOOSE_THUMBNAIL);
        registerOperationTxnMandatory(OP_TORRENT_READY);        
        registerOperationTxnRequired(OP_CANCEL);
        registerOperationTxnRequiresNew(OP_EDIT_THUMBNAIL);
    
Methods Summary
public voidhandleTxnlMessage(com.aelitis.azureus.ui.swt.browser.msg.BrowserMessage message, com.aelitis.azureus.ui.swt.browser.txn.Transaction txn)
Handles the given message, usually by parsing the parameters and calling the appropriate operation.

param
message holds all message information

        PublishTransaction realTxn = (PublishTransaction) txn;
        
        realTxn.setShell(shell);
        realTxn.setLocalHoster(hoster);
        
        if ( OP_CHOOSE_FILE.equals(message.getOperationId()) ) {
            realTxn.chooseFile(message);
        }
        else if ( OP_CHOOSE_FOLDER.equals(message.getOperationId()) ) {
            realTxn.chooseFolder(message);
        }
        else if ( OP_CHOOSE_THUMBNAIL.equals(message.getOperationId()) || OP_EDIT_THUMBNAIL.equals(message.getOperationId())) {
            realTxn.chooseThumbnail(message);
        }
        else if ( OP_TORRENT_READY.equals(message.getOperationId()) ) {
            realTxn.torrentIsReady(message);
        }
        else if ( OP_CANCEL.equals(message.getOperationId()) ) {
            realTxn.cancel();
        }
        else {
            throw new IllegalArgumentException("Unknown operation: " + message.getOperationId());
        }