Package net.sourceforge.torchlight.core.data.campaign

Examples of net.sourceforge.torchlight.core.data.campaign.Participant


       
        if(obj instanceof Participant)
        {
            logger.debug("obj is a Participant");
           
            Participant p = (Participant)obj;

            p.setName(page1.getParticipantName());
            p.setRole(page1.getRole());
           
            p.setCampaign(campaign);
           
            return true;
        }
       
        return false;
View Full Code Here


                public void widgetSelected(SelectionEvent event)
                {
                    try
                    {
                        logger.info("Creating participant...");
                        Participant p = (Participant)DataManager.getDataManager().createDataInstance(Participant.class, true, NewPlayerCharacterWizard.this.campaign, null);
                        logger.debug("p: " + p);

                        if(p != null)
                        {
                            participant.add(p.getLabel());
                        }
                    }
                    catch(Exception e)
                    {
                        MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), res.getLocaleString("campaign.error.create_player_character.title"), res.getLocaleString("campaign.error.create_player_character.message") + "\n\n" + e.getLocalizedMessage());
View Full Code Here

            return pcName.getText();
        }
       
        public Participant getParticipant()
        {
            Participant p = null;
           
            try
            {
                p = NewPlayerCharacterWizard.this.campaign.getParticipants().elementAt(participant.getSelectionIndex());
            }
View Full Code Here

    {
        Label label;
       
        logger.debug("creating controls");
       
        final Participant p = ((ParticipantEditorInput)getEditorInput()).getParticipant();
       
        SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL);
       
        Composite leftSide = new Composite(sashForm, SWT.NONE);
        new Sash(sashForm, SWT.NONE);
        Composite rightSide = new Composite(sashForm, SWT.NONE);
       
        sashForm.setWeights(new int[] { 65, 35 });
       
        // create a generic focus listener that saves the object when focus is lost
        FocusListener saveObjectFocusListener = new FocusListener() {
      public void focusGained(FocusEvent event)
      {
          logger.trace("focus gained: " + event);
      }

      public void focusLost(FocusEvent event)
      {
          logger.debug("focus lost: " + event);
         
          try
                {
              Participant p = ((ParticipantEditorInput)getEditorInput()).getParticipant();
             
                  logger.info("Saving participant: " + p);
                    DataStore.getDataStore().saveObject(p, null);
                }
                catch(DataPersistenceException e)
                {
                    logger.error("exception while saving participant: " + e.getLocalizedMessage(), e);
                   
                    MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), res.getLocaleString("campaign.editor.error.save_participant.title"), res.getLocaleString("campaign.editor.error.save_participant.message"));
                }
      }
        };

        {
            GridLayout layout = new GridLayout();
            layout.numColumns = 4;
            leftSide.setLayout(layout);

            // name
            label = new Label(leftSide, SWT.RIGHT);
            label.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
            label.setText(res.getLocaleString("participant.editor.name.label"));

            name = new Text(leftSide, SWT.BORDER);
            name.setText(p.getName());
            name.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            name.addModifyListener(new ModifyListener() {
                public void modifyText(ModifyEvent e)
                {
                    logger.debug("modifying participant name");

                    p.setName(name.getText());

                    dirty = true;

                    ParticipantEditor.this.setPartName(res.getLocaleString("participant.editor.title.tab") + ": " + ((ParticipantEditorInput)getEditorInput()).getParticipant().getName());
                }
            });
            name.addFocusListener(saveObjectFocusListener);

            // role
            label = new Label(leftSide, SWT.RIGHT);
            label.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
            label.setText(res.getLocaleString("participant.editor.role.label"));

            role = new Combo(leftSide, SWT.READ_ONLY | SWT.DROP_DOWN);
            role.add(res.getLocaleString("participant.role.player"));
            role.add(res.getLocaleString("participant.role.dm"));
            role.select(IApplicationConstants.DUNGEON_MASTER_ROLE.equals(p.getRole()) ? 1 : 0);
            role.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            role.addSelectionListener(new SelectionListener() {
                public void widgetDefaultSelected(SelectionEvent e)
                {
                    // do nothing
                }

                public void widgetSelected(SelectionEvent e)
                {
                    logger.debug("modifying participant role");

                    int selection = role.getSelectionIndex();

                    if(selection == 1)
                        p.setRole(IApplicationConstants.DUNGEON_MASTER_ROLE);
                    else
                        p.setRole(IApplicationConstants.PLAYER_ROLE);

                    dirty = true;
                }
            });
            role.addFocusListener(saveObjectFocusListener);

            // address
            label = new Label(leftSide, SWT.RIGHT);
            label.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
            label.setText(res.getLocaleString("participant.editor.address.label"));
           
            address = new Text(leftSide, SWT.BORDER | SWT.MULTI);
            {
                GridData gd = new GridData(GridData.FILL_BOTH);
                gd.horizontalSpan = 3;
                address.setLayoutData(gd);
            }
            address.setSize(0, 50); // TODO: better determination?
            address.setText(p.getAddress());
            address.addModifyListener(new ModifyListener() {
                public void modifyText(ModifyEvent e)
                {
                    logger.debug("modifying participant address");
                   
                    p.setAddress(name.getText());
                   
                    dirty = true;
                }
            });
            address.addFocusListener(saveObjectFocusListener);
           
            // home phone
            label = new Label(leftSide, SWT.RIGHT);
            label.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
            label.setText(res.getLocaleString("participant.editor.home_phone.label"));
           
            homePhone = new Text(leftSide, SWT.BORDER);
            homePhone.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            homePhone.setText(p.getHomePhone());
            homePhone.addModifyListener(new ModifyListener() {
                public void modifyText(ModifyEvent e)
                {
                    logger.debug("modifying participant home phone");
                   
                    p.setHomePhone(name.getText());
                   
                    dirty = true;
                }
            });
            homePhone.addFocusListener(saveObjectFocusListener);
           
            // mobile phone
            label = new Label(leftSide, SWT.RIGHT);
            label.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
            label.setText(res.getLocaleString("participant.editor.mobile_phone.label"));
           
            mobilePhone = new Text(leftSide, SWT.BORDER);
            mobilePhone.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            mobilePhone.setText(p.getMobilePhone());
            mobilePhone.addModifyListener(new ModifyListener() {
                public void modifyText(ModifyEvent e)
                {
                    logger.debug("modifying participant mobile phone");
                   
                    p.setMobilePhone(name.getText());
                   
                    dirty = true;
                }
            });
            mobilePhone.addFocusListener(saveObjectFocusListener);

            // email
            label = new Label(leftSide, SWT.RIGHT);
            label.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
            label.setText(res.getLocaleString("participant.editor.email.label"));
           
            email = new Text(leftSide, SWT.BORDER);
            {
                GridData gd = new GridData(GridData.FILL_HORIZONTAL);
                gd.horizontalSpan = 3;
                email.setLayoutData(gd);
            }
            email.setText(p.getEmail());
            email.addModifyListener(new ModifyListener() {
                public void modifyText(ModifyEvent e)
                {
                    logger.debug("modifying participant email");
                   
                    p.setEmail(name.getText());
                   
                    dirty = true;
                }
            });
            email.addFocusListener(saveObjectFocusListener);

            // notes
            label = new Label(leftSide, SWT.RIGHT);
            label.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
            label.setText(res.getLocaleString("participant.editor.notes.label"));
           
            notes = new Text(leftSide, SWT.BORDER | SWT.MULTI);
            {
                GridData gd = new GridData(GridData.FILL_BOTH);
                gd.horizontalSpan = 3;
                notes.setLayoutData(gd);
            }
            notes.setText(p.getAddress());
            notes.addModifyListener(new ModifyListener() {
                public void modifyText(ModifyEvent e)
                {
                    logger.debug("modifying participant notes");
                   
                    p.setAddress(name.getText());
                   
                    dirty = true;
                }
            });
            notes.addFocusListener(saveObjectFocusListener);
View Full Code Here

    {
        logger.debug("matches? editorRef: " + editorRef + "; input: " + input);
       
        if(input instanceof ParticipantEditorInput)
        {
            Participant p = (Participant)((ParticipantEditorInput)input).getParticipant();
            logger.trace("p: " + p);
           
            if(p != null)
            {
                return true;
View Full Code Here

        }

        try
        {
            logger.info("Creating participant...");
            Participant p = (Participant)DataManager.getDataManager().createDataInstance(Participant.class, runWizard, section.getCampaign(), null);
            logger.debug("p: " + p);

            if(p != null)
            {
                logger.debug("saving object: " + p);
View Full Code Here

                return JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT);
            }
        }
        else if(element instanceof Participant)
        {
            Participant p = (Participant)element;

            if(IApplicationConstants.DUNGEON_MASTER_ROLE.equals(p.getRole()))
            {
                logger.debug("participant is DM");
                return JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT);
            }
        }
View Full Code Here

TOP

Related Classes of net.sourceforge.torchlight.core.data.campaign.Participant

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.