Package org.criticalfailure.torchlight.core.model.model

Examples of org.criticalfailure.torchlight.core.model.model.Participant


                }
                break;
               
            case ACTION_TYPE_PARTICIPANT:
                try {
                    Participant participant;

                    // find a participant creation helper
                    if(runWizard) {
                        logger.debug("running wizard to create participant");
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(), Messages.getString("campaign.editor.error.save_participant.title"), Messages.getString("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(Messages.getString("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(Messages.getString("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(Messages.getString("participant.editor.role.label"));

            role = new Combo(leftSide, SWT.READ_ONLY | SWT.DROP_DOWN);
            role.add(Messages.getString("participant.role.player"));
            role.add(Messages.getString("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(Messages.getString("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(address.getText());
                   
                    dirty = true;
                }
            });
            address.addFocusListener(saveObjectFocusListener);
           
            // notes
            label = new Label(leftSide, SWT.RIGHT);
            label.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
            label.setText(Messages.getString("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(notes.getText());
                   
                    dirty = true;
                }
            });
            notes.addFocusListener(saveObjectFocusListener);
View Full Code Here

    public boolean matches(IEditorReference editorRef, IEditorInput input)
    {
        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

    public Object[] getChildren(Object o) {
       
        logger.debug("get children: " + o);
       
        if(o instanceof Participant) {
            Participant p = (Participant)o;
           
            // TODO
        }
       
        return new Object[0];
View Full Code Here

TOP

Related Classes of org.criticalfailure.torchlight.core.model.model.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.