⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 databasedialog.java

📁 生成与Oracle相关的Ibatis相关配置文件及Java源码
💻 JAVA
字号:
/*
 * Copyright (c) 2008 胜利油田胜利软件有限责任公司. All rights reserved.
 */
package com.victorysoft.code.ui;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

import com.victorysoft.code.base.CodeMakerConst;

/**
 * 
 * @author 于景洋
 * @newtime Oct 29, 2008,12:58:59 PM
 * @version 1.0
 * @see
 * @since JDK 1.5.0
 */
public class DataBaseDialog extends Dialog {

	private Text t_password;
	private Text t_username;
	private Text t_database;
	private Text t_hostname;

	/**
	 * Create the dialog
	 * 
	 * @param parentShell
	 */
	public DataBaseDialog(Shell parentShell) {
		super(parentShell);
	}

	/**
	 * Create contents of the dialog
	 * 
	 * @param parent
	 */
	@Override
	protected Control createDialogArea(Composite parent) {
		Composite container = (Composite) super.createDialogArea(parent);
		final GridLayout gridLayout = new GridLayout();
		gridLayout.numColumns = 2;
		container.setLayout(gridLayout);

		final Label l_hostname = new Label(container, SWT.NONE);
		final GridData gd_l_hostname = new GridData();
		l_hostname.setLayoutData(gd_l_hostname);
		l_hostname.setText("主机地址:");

		t_hostname = new Text(container, SWT.BORDER);
		final GridData gd_t_hostname = new GridData(SWT.FILL, SWT.CENTER, true,
				false);
		t_hostname.setLayoutData(gd_t_hostname);

		final Label l_database = new Label(container, SWT.NONE);
		l_database.setText("数据库名:");

		t_database = new Text(container, SWT.BORDER);
		final GridData gd_t_database = new GridData(SWT.FILL, SWT.CENTER, true,
				false);
		t_database.setLayoutData(gd_t_database);

		final Label l_username = new Label(container, SWT.NONE);
		l_username.setText("用户名称:");

		t_username = new Text(container, SWT.BORDER);
		final GridData gd_t_username = new GridData(SWT.FILL, SWT.CENTER, true,
				false);
		t_username.setLayoutData(gd_t_username);

		final Label l_password = new Label(container, SWT.NONE);
		l_password.setText("用户密码:");

		t_password = new Text(container, SWT.BORDER);
		final GridData gd_t_password = new GridData(SWT.FILL, SWT.CENTER, true,
				false);
		t_password.setLayoutData(gd_t_password);

		t_hostname.setText(CodeMakerConst.hostname);
		t_database.setText(CodeMakerConst.database);
		t_username.setText(CodeMakerConst.username);
		t_password.setText(CodeMakerConst.password);
		//
		return container;
	}

	/**
	 * Create contents of the button bar
	 * 
	 * @param parent
	 */
	@Override
	protected void createButtonsForButtonBar(Composite parent) {
		createButton(parent, IDialogConstants.OK_ID, "确定", true);
		createButton(parent, IDialogConstants.CANCEL_ID, "取消", false);
	}

	/**
	 * Return the initial size of the dialog
	 */
	@Override
	protected Point getInitialSize() {
		return new Point(255, 171);
	}

	protected void configureShell(Shell newShell) {
		super.configureShell(newShell);
		newShell.setText("设置数据库");
	}

	protected void buttonPressed(int buttonId) {
		if (buttonId == IDialogConstants.OK_ID) {
			return;
		}
		super.buttonPressed(buttonId);
	}

}

⌨️ 快捷键说明

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