Toggle menu
862
3.8K
30.2K
279.1K
Catglobe Wiki
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Project VN2664QNR : Export to QSL from Questionnaire Editor

From Catglobe Wiki
Revision as of 04:18, 27 April 2009 by Catglobe (talk | contribs) (New page: == What's purpose of this project ? == The main goal of this project is to allow user to export the structure of a questionnaire template into a QSL script . == Feature design == The feat...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

What's purpose of this project ?

The main goal of this project is to allow user to export the structure of a questionnaire template into a QSL script .

Feature design

The feature design could be found here : \\catproc\Share\CatGlobe Teams\Questionnaire\Projects\Version 5.8\VN2644QNR - Export to QSL from Questionnaire Editor

Implement GUI

In this project , we need to write a new collapse-able container and a container that can hold a collection of collapse-able container because the editor only use Swing ( standard Java's API library for providing a graphical user interface ) and this library does not have an explicit collapse-able container .

Class diagram

How to use an instance of collapse-able container

All sub panels of the container initialized once on constructor . The parameter of constructor contains an Array of sub panel's caption and an Array of sub panel . In order get the collapse-able container itself , use method getComponent() TO add a collapse-able container to another

Making an customize save file dialog

Currently we have an class for customize save file dialog but this one has not been supported our customize file filter yet so i modified it a little bit

Making the a file filter

The default "All file(*.*)" filter is in inconvenient when using so it will be overwrite . Another useful of it is that we can have text resource fully supported .

Make QSL file filter

public class QSLFilter extends FileFilter {

    /* (non-Javadoc)
     * @see javax.swing.filechooser.FileFilter#accept(java.io.File)
     */
    @Override
    public boolean accept(File arg0) {
        // TODO Auto-generated method stub
        if(arg0.isDirectory())
            return true;
        else 
            return (getExtension(arg0).equals("qsl"));
    }

    /* (non-Javadoc)
     * @see javax.swing.filechooser.FileFilter#getDescription()
     */
    @Override
    public String getDescription() {
        
        // TODO Auto-generated method stub
        return "QSL file(*.qsl)";
    }
    public static String getExtension(File f) {
        String ext = null;
        String s = f.getName();
        int i = s.lastIndexOf('.');

        if (i > 0 &&  i < s.length() - 1) {
            ext = s.substring(i+1).toLowerCase();
        }
        return ext;
    }

Export questionnaire template to QSL script

To implement export task , we use Visitor pattern .

Class diagram