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

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


       
        if(obj instanceof Campaign)
        {
            logger.debug("obj is a Campaign");
           
            Campaign c = (Campaign)obj;
           
            c.setName(page1.getName());
            c.setEdition(page1.getEdition().getName());
            c.setSetting(page1.getSetting());
            c.setStartLevel(page1.getStartingLevel());
//            c.setInception(null); TODO
           
            return true;
        }
       
View Full Code Here


        if(selectedItem == null ||
           selectedItem instanceof Campaign)
        {
            try
            {
                Campaign campaign = (Campaign)DataManager.getDataManager().createDataInstance(Campaign.class, runWizard, null, null);

                if(campaign != null)
                {
                    logger.debug("saving object: " + campaign);
                    DataStore.getDataStore().saveObject(campaign, null);
View Full Code Here

    {
        logger.debug("matches? editorRef: " + editorRef + "; input: " + input);
       
        if(input instanceof CampaignEditorInput)
        {
            Campaign campaign = (Campaign)((CampaignEditorInput)input).getCampaign();
            logger.trace("campaign: " + campaign);
           
            if(campaign != null)
            {
                return true;
View Full Code Here

        if(selectedItem == null ||
           selectedItem instanceof Campaign)
        {
            try
            {
                Campaign campaign = (Campaign)DataManager.getDataManager().createDataInstance(Campaign.class, runWizard, null, null);

                if(campaign != null)
                {
                    logger.debug("saving object: " + campaign);
                    DataStore.getDataStore().saveObject(campaign, null);
View Full Code Here

        setPartName(res.getLocaleString("campaign.editor.title.tab") + ": " + ((CampaignEditorInput)getEditorInput()).getCampaign().getName());
    }

    private Composite createMainPage(Composite parent)
    {
        final Campaign campaign = ((CampaignEditorInput)getEditorInput()).getCampaign();
        Label label;
       
        logger.debug("creating controls");
       
        SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL);

        // have to create the children before setting their weights
        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 });
       
        // left side of sash
        {
            leftSide.setLayout(new GridLayout());

            // top group
            logger.debug("creating general group");
            Group generalGroup = new Group(leftSide, SWT.NONE);
            generalGroup.setText(res.getLocaleString("campaign.editor.group.general.label"));
            generalGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

            GridLayout generalGroupLayout = new GridLayout();
            generalGroupLayout.numColumns = 6;
            generalGroup.setLayout(generalGroupLayout);

            // name
            logger.debug("creating name field");
            label = new Label(generalGroup, SWT.RIGHT);
            label.setText(res.getLocaleString("campaign.editor.name.label"));
            label.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));

            name = new Text(generalGroup, SWT.BORDER);
            {
                GridData gd = new GridData(GridData.FILL_HORIZONTAL);
                gd.horizontalSpan = 5;
                name.setLayoutData(gd);
            }
            name.setText(campaign.getName());
            name.addModifyListener(new ModifyListener() {
                public void modifyText(ModifyEvent event)
                {
                    logger.debug("setting campaign name");
                    campaign.setName(name.getText());
                   
                    logger.debug("setting editor as dirty");
                    dirty = true;
                   
                    // set editor name
                    CampaignEditor.this.setPartName(res.getLocaleString("campaign.editor.title.tab") + ": " + name.getText());
                }
            });
                       
            // setting
            logger.debug("creating setting chooser");
            label = new Label(generalGroup, SWT.RIGHT);
            label.setText(res.getLocaleString("campaign.editor.setting.label"));
            label.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
           
            setting = new Combo(generalGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
            {
                GridData gd = new GridData(GridData.FILL_HORIZONTAL);
                gd.horizontalSpan = 2;
                setting.setLayoutData(gd);
            }
            for(Setting s : DataManager.getDataManager().getSettings())
            {
                setting.add(s.getName());
            }
            setting.select(DataManager.getDataManager().getSettingIndex(campaign.getSetting()));
            setting.addSelectionListener(new SelectionListener() {
                public void widgetDefaultSelected(SelectionEvent e)
                {
                    widgetSelected(e);
                }

                public void widgetSelected(SelectionEvent e)
                {
                    logger.debug("setting campaign setting; index = " + setting.getSelectionIndex());
                    campaign.setSetting(Application.getApplication().getDataManager().getSetting(setting.getSelectionIndex()));
                   
                    logger.debug("setting editor as dirty");
                    dirty = true;
//                    CampaignEditor.this.
                }
            });
           
            // edition
            logger.debug("creating edition chooser");
            label = new Label(generalGroup, SWT.RIGHT);
            label.setText(res.getLocaleString("campaign.editor.edition.label"));
            label.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
           
            edition = new Combo(generalGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
            {
                GridData gd = new GridData(GridData.FILL_HORIZONTAL);
                gd.horizontalSpan = 2;
                edition.setLayoutData(gd);
            }
            // if campaign is deleteable, then it's not the default workspace campaign, and can therefore
            // have an edition assigned to it
            for(Edition ed : DataManager.getDataManager().getEditions())
            {
                edition.add(ed.getName());
            }
            edition.select(DataManager.getDataManager().getEditionIndex(campaign.getEdition()));
            edition.addSelectionListener(new SelectionListener() {
                public void widgetDefaultSelected(SelectionEvent e)
                {
                    widgetSelected(e);
                }

                public void widgetSelected(SelectionEvent e)
                {
                    logger.debug("setting campaign edition; index = " + edition.getSelectionIndex());
                    campaign.setEdition(Application.getApplication().getDataManager().getEdition(edition.getSelectionIndex()).getName());

                    logger.debug("setting editor as dirty");
                    dirty = true;
//                  CampaignEditor.this.
                }
            });

            // inception
            logger.debug("creating date field");
            label = new Label(generalGroup, SWT.RIGHT);
            label.setText(res.getLocaleString("campaign.editor.inception.label"));
            label.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));

            inception = new Text(generalGroup, SWT.BORDER);
            inception.setText(campaign.getInception().toString());
            {
                GridData gd = new GridData(GridData.FILL_HORIZONTAL);
                gd.horizontalSpan = 2;
                inception.setLayoutData(gd);
            }
            inception.addModifyListener(new ModifyListener() {
                public void modifyText(ModifyEvent event)
                {
                    logger.debug("modifying inception date");
                   
                    SimpleDateFormat sdf = new SimpleDateFormat();
                    String dateText = inception.getText();

                    try
                    {
                        logger.debug("parsing inception date");                       
                        Date d = sdf.parse(dateText);
                       
                        logger.debug("setting inception date");
                        campaign.setInception(d);
                       
                        logger.debug("marking editor as dirty");
                        dirty = true;
                    }
                    catch(ParseException e)
                    {
                        logger.debug("date is invalid; don't do it");
                    }
                }
            });
            inception.addVerifyListener(new VerifyListener() {
                public void verifyText(VerifyEvent event)
                {
                    logger.debug("verifying date text");
                   
                    event.doit = true;

                    SimpleDateFormat sdf = new SimpleDateFormat();
                    String dateText = inception.getText();

                    try
                    {
                        Date d = sdf.parse(dateText);
                    }
                    catch(ParseException e)
                    {
                        logger.debug("date is invalid; don't do it");
                        event.doit = false;
                    }
                }
            });

//            logger.debug("creating date picker");
//            Button datePicker = new Button(generalGroup, SWT.PUSH | SWT.FLAT);
//            // datePicker.setText("Choose..."); // TODO: replace with image
//            datePicker.setImage(ImageLoader.getImage(Activator.class, "/icons/date-picker.gif"));
//            datePicker.setLayoutData(new GridData());
//            datePicker.addSelectionListener(new SelectionListener() {
//                public void widgetDefaultSelected(SelectionEvent event)
//                {
//                }
//
//                public void widgetSelected(SelectionEvent event)
//                {
//                }
//            });

            // starting level
            logger.debug("creating starting level field");
            label = new Label(generalGroup, SWT.RIGHT);
            label.setText(res.getLocaleString("campaign.editor.starting_level.label"));
            label.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));

            startingLevel = new Spinner(generalGroup, SWT.BORDER);
            {
                GridData gd = new GridData(GridData.FILL_HORIZONTAL);
                gd.horizontalSpan = 2;
                startingLevel.setLayoutData(gd);
            }
            startingLevel.setSelection(campaign.getStartLevel());
            startingLevel.setMinimum(1);
            startingLevel.setMaximum(99);
            startingLevel.addModifyListener(new ModifyListener() {
                public void modifyText(ModifyEvent event)
                {
                    logger.debug("setting campaign starting level");
                    campaign.setStartLevel(startingLevel.getSelection());

                    logger.debug("setting editor as dirty");
                    dirty = true;
                }
            });
           
            if(!campaign.isDeleteable())
            {
                logger.debug("marking general group disabled");
                generalGroup.setEnabled(false);
            }
        }
       
        // bottom group: misc.
        {
            logger.debug("creating misc. group");
            Group miscGroup = new Group(leftSide, SWT.NONE);
            miscGroup.setText(res.getLocaleString("campaign.editor.group.notes.label"));
            miscGroup.setLayout(new FillLayout());
            miscGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
           
            // description field
            notes = new Text(miscGroup, SWT.MULTI);
            notes.setText(campaign.getNotes());
            notes.addModifyListener(new ModifyListener() {
                public void modifyText(ModifyEvent e)
                {
                    logger.debug("setting notes");
                    campaign.setNotes(notes.getText());

                    logger.debug("setting editor as dirty");
                    dirty = true;
                }
            });
View Full Code Here

                case 0:
                    return ImageLoader.getImage(Activator.class, IApplicationConstants.CAMPAIGN_ICON_PATH);

                case 1:
                    // TODO: aggregate some icons to reflect the campaign's status
                    Campaign c = (Campaign)element;
                    Image img = null;

                    if(c.isExternal())
                    {
                        img = ImageLoader.getImage(Activator.class, IApplicationConstants.CAMPAIGN_EXTERNAL_ICON_PATH);

                        if(!c.isConnected())
                        {
                            img = new Image(Display.getCurrent(), img, SWT.IMAGE_DISABLE);
                        }
                    }
                    else
                    {
                        if(c.isHostable())
                        {
                            img = ImageLoader.getImage(Activator.class, IApplicationConstants.CAMPAIGN_LOCAL_ICON_PATH);

                            if(!c.isHosting())
                            {
                                img = new Image(Display.getCurrent(), img, SWT.IMAGE_DISABLE);
                            }
                        }
                        else
View Full Code Here

    {
        logger.debug("get font");

        if(element instanceof Campaign)
        {
            Campaign c = (Campaign)element;

            if(c.isExternal() && !c.isConnected())
            {
                return JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT);
            }
        }
        else if(element instanceof Participant)
View Full Code Here

    {
        logger.debug("get foreground color");

        if(element instanceof Campaign)
        {
            Campaign c = (Campaign)element;

            if(c.isExternal() && !c.isConnected())
            {
                // TODO
            }
        }
View Full Code Here

        if(parentElement instanceof Campaign)
        {
            logger.debug("get campaign sections");

            Campaign campaign = (Campaign)parentElement;

            Vector<CampaignSection> sections = sectionMap.get(campaign);
            logger.trace("sections: " + sections);
            if(sections == null)
            {
View Full Code Here

TOP

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

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.