setactivefieldpage.java

来自「一个eclipse插件源代码。用于web开发」· Java 代码 · 共 255 行

JAVA
255
字号
/*
 * $Header: /home/cvs/WEBPUMP2.0/WebPumpIDE_Src/WebPumpIDE/src/com/webpump/ui/bind/dialog/SetActiveFieldPage.java,v 1.1.1.1 2004/07/01 09:07:41 wang_j Exp $
 * $Revision: 1.1.1.1 $
 * $Date: 2004/07/01 09:07:41 $
 *
 * ====================================================================
 *
 * The NanJing HopeRun(IT-FOREST) Software License, Version 2.0.0
 *
 * Copyright 2003-2004 by NanJing HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and
 *                        IT Forest Corporation
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and IT Forest Corporation.
 * You shall not disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into with
 * HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and IT Forest Corporation.
 */
package com.webpump.ui.bind.dialog;


import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;

import com.webpump.ui.bind.editors.BindEditor;
import com.webpump.ui.bind.editors.ParameterValue;
import com.webpump.ui.perspective.MacroResource;
import com.webpump.ui.perspective.WebpumpIDEPlugin;

/**
 * Class for layout of set active field page .
 * 
 * @author luo_sa
 * @version 2.0.0 2004-2-11
 */
public class SetActiveFieldPage extends WizardPage {
	
	private BindEditor m_objEditor;
    
    /** text of ObjectName*/
    private Text m_textObjectName;
    
    /**text of DefaultValue*/
    private Text m_textDefaultValue;
    
    /**text of Description*/
    private Text m_textDescription;
    
    /** combo of Type*/
    private Combo m_comboType;
    
    /** combo of VariableName*/
    private Combo m_comboVariableName;
    
    /** combo of VariableType*/
    private Combo m_comboVariableType;
    
    /** button of Filter*/
    private Button m_buttonFilter;
        
    /** value of m_buttonFilter*/  
    private boolean filterButtonSelect;
    
    /** object of ParameterValue which used to take values of SetActiveFieldPage to table*/
    private  ParameterValue m_objSetParameterValue = new ParameterValue();
    
    /** object of ParameterValue which used to take values of table to dialog */
    private ParameterValue m_objParameterValue = new ParameterValue();
    /**
     * Set the Title and Description field
     *
     */
	public SetActiveFieldPage( ) {
		super("wizardPage");
        // set Title field
		//setTitle("页面变量设置");
        setTitle(WebpumpIDEPlugin.getResourceString(MacroResource.SETACTIVEFIELDPAGE_TITLE));
        // set Description field
		//setDescription("以下可以设置页面变量");
        setDescription(WebpumpIDEPlugin.getResourceString(MacroResource.SETACTIVEFIELDPAGE_DESCRIPTIONA));

	}
    
    /**
     * Create control of SetActiveFieldPage
     * 
     * @param parent thr parent composite
     */
	public void createControl(Composite parent) {

		final Composite composite = new Composite(parent, SWT.NONE);
		final GridLayout gridLayout_2 = new GridLayout();
		gridLayout_2.makeColumnsEqualWidth = true;
        gridLayout_2.marginHeight = 0;
        gridLayout_2.marginWidth = 0;
        gridLayout_2.verticalSpacing = 0;
        gridLayout_2.horizontalSpacing = 0;
        
		composite.setLayout(gridLayout_2);
		setControl(composite);
        
        {
            final Group group = new Group(composite, SWT.NONE);
            final GridLayout gridLayout = new GridLayout();
            gridLayout.numColumns = 4;
            gridLayout.makeColumnsEqualWidth = true;
            group.setLayout(gridLayout);
            //group.setText("HTML 模块变量");
            group.setText(WebpumpIDEPlugin.getResourceString(MacroResource.SETACTIVEFIELDPAGE_HTML_TEMPLATE_VARIALBLE));
            group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            {
                final Label label = new Label(group, SWT.NONE);
                label.setLayoutData(new GridData());
                //label.setText("名称:");
                label.setText(WebpumpIDEPlugin.getResourceString(MacroResource.SETACTIVEFIELDPAGE_OBJECT_NAME));
            }
            {
                m_textObjectName = new Text(group, SWT.BORDER|SWT.READ_ONLY);
                final GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
                gridData.horizontalSpan = 2;
                m_textObjectName.setLayoutData(gridData);
                m_textObjectName.setText("");
            }
            {
                final Label label = new Label(group, SWT.NONE);
                label.setLayoutData(new GridData());
            }
            {
                final Label label = new Label(group, SWT.NONE);
                //label.setText("类型:");
                label.setText(WebpumpIDEPlugin.getResourceString(MacroResource.SETACTIVEFIELDPAGE_TYPE));
            }
            {
                m_comboType = new Combo(group, SWT.NONE);
                final GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
                gridData.horizontalSpan = 2;
                m_comboType.setLayoutData(gridData);
                m_comboType.setText("SingleValue");
                m_comboType.setEnabled(false);
            }
        }

        {

            final Group group = new Group(composite, SWT.NONE);
            final GridLayout gridLayout = new GridLayout();
            gridLayout.makeColumnsEqualWidth = true;
            gridLayout.numColumns = 4;
            group.setLayout(gridLayout);
            //group.setText("成员变量");
            group.setText(WebpumpIDEPlugin.getResourceString(MacroResource.SETACTIVEFIELDPAGE_MEMBER_VARIABLE));
            group.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
            {
                final Label label = new Label(group, SWT.NONE);
                //label.setText("变量名:");
                label.setText(WebpumpIDEPlugin.getResourceString(MacroResource.SETACTIVEFIELDPAGE_VARIABLE_NAME));
            }
            {
                m_comboVariableName = new Combo(group, SWT.NONE);
                // add a SelectionAdapter
                m_comboVariableName.addSelectionListener(new SelectionAdapter() {
                    public void widgetSelected(SelectionEvent e) {
                        int i;
                        i=m_comboVariableName.getSelectionIndex();
                        setPageComplete(true);
                        setDescription(WebpumpIDEPlugin.getResourceString(MacroResource.SETACTIVEFIELDPAGE_DESCRIPTIONA));
                    }
                            
                });
                // add a KeyAdapter
                m_comboVariableName.addModifyListener(new ModifyListener() {
                    public void modifyText(ModifyEvent e){
                        if (m_comboVariableName.getText().length() > 0) {
                            setPageComplete(true);
                            setDescription(WebpumpIDEPlugin.getResourceString(MacroResource.SETACTIVEFIELDPAGE_DESCRIPTIONA));
                        } else {
                            setPageComplete(false);
                            setDescription(WebpumpIDEPlugin.getResourceString(MacroResource.SETACTIVEFIELDPAGE_WRONG));
                        }
                    }
                });
                final GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
                gridData.horizontalSpan = 2;
                m_comboVariableName.setLayoutData(gridData);

            }
            {
                final Label label = new Label(group, SWT.NONE);
            }
            {
                final Label label = new Label(group, SWT.NONE);
                //label.setText("变量类型:");
                label.setText(WebpumpIDEPlugin.getResourceString(MacroResource.SETACTIVEFIELDPAGE_VARIABLE_TYPE));
            }
            {
                m_comboVariableType = new Combo(group, SWT.Selection);
                // add a SelectionAdapter 
                m_comboVariableType.addSelectionListener(new SelectionAdapter() {
                    public void widgetSelected(SelectionEvent e) {
                        int i;
                        i=m_comboVariableType.getSelectionIndex();
                        if (i>=1) {
                            m_textDefaultValue.setText("null");
                        }
                        if (i >=1){
							m_textDefaultValue.setEditable(false);
                        }else{
							m_textDefaultValue.setEditable(true);
                        }
                        if (i == 0){
                            m_textDefaultValue.setText("");
                        }
                        if (i == 4){
							m_buttonFilter.setSelection(false);
							m_buttonFilter.setEnabled(false);
                        } 
                        if (i != 0) {
							m_buttonFilter.setSelection(false);
							m_buttonFilter.setEnabled(false);      
                        }
                        else
                        {
							//m_buttonFilter.setSelection(true);
							m_buttonFilter.setEnabled(true);
                        }
                    }
                            
                });
                final GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
                gridData.horizontalSpan = 2;
                m_comboVariableType.setLayoutData(gridData);
                m_comboVariableType.add("String", 0);
                m_comboVariableType.add("String[]", 1);
				m_comboVariableType.add("FormFile", 2);               
				m_comboVariableType.add("File", 3);
				m_comboVariableType.add("Combobox", 4);
                m_comboVariableType.select(0);

            }
            {
                m_buttonFilter = new Button(group, SWT.CHECK);                
                //m_buttonFilter.setText("  

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?