/*
* Created on 2004/08/14
* Author aki@www.xucker.jpn.org
* License Apache2.0 or Common Public License
*/
package org.jpn.xucker.commons.swt.series.wfs;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.RowData;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.jpn.xucker.commons.swt.ui.OkCancelDialog;
import org.jpn.xucker.commons.swt.ui.OkCancelDialogListener;
/**
*
*
*/
public class WrapperFileStandardSettingDialog extends OkCancelDialog{
protected String commandLabel;
protected String exeName;
protected Group group1;
public String getCommandLabel() {
return commandLabel;
}
public void setCommandLabel(String commandLabel) {
this.commandLabel = commandLabel;
}
public String getExeName() {
return exeName;
}
public void setExeName(String exeName) {
this.exeName = exeName;
}
protected String searchButtonLabel="Q";
private Button searchButton;
private Text pathText;
public WrapperFileStandardSettingDialog(OkCancelDialogListener listener,Shell shell){
super(listener,shell);
}
public String getCommandPath(){
String value=pathText.getText();
if(value.equals("")){
return null;
}else{
return value;
}
}
public void setCommandPath(String value){
if(value!=null){
pathText.setText(value);
}
}
public void createGUI(){
group1=new Group(shell,SWT.NULL);
RowData group1_row=new RowData();
group1_row.width=250;
group1.setLayoutData(group1_row);
group1.setLayout(new RowLayout());
group1.setText(commandLabel);
pathText = new Text(group1,SWT.READ_ONLY);
pathText.setBackground(new Color(getShell().getDisplay(),255,255,255));
RowData data2=new RowData();
data2.width=230;
pathText.setLayoutData(data2);
searchButton = new Button(group1,SWT.NULL);
searchButton.setText(searchButtonLabel);
RowData data3=new RowData();
data3.width=50;
searchButton.setLayoutData(data3);
searchButton.addSelectionListener(this);
}
/* (non-Javadoc)
* @see org.jpn.xucker.commons.swt.ui.OkCancelDialog#afterInit()
*/
protected void afterInit() {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.jpn.xucker.commons.swt.ui.OkCancelDialog#beforeInit()
*/
protected void beforeInit() {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.jpn.xucker.commons.swt.ui.OkCancelDialog#do_other_ui(org.eclipse.swt.events.SelectionEvent)
*/
protected void do_other_ui(SelectionEvent event) {
if(event.getSource()==searchButton){
FileDialog dialog=new FileDialog(shell,SWT.NULL);
if(exeName!=null){
dialog.setFilterExtensions(new String[]{exeName});
}
String path=dialog.open();
if(path!=null){
setCommandPath(path);
}
}
}
/* (non-Javadoc)
* @see org.jpn.xucker.commons.swt.ui.OkCancelDialog#getValue()
*/
public String getValue(String key) {
if(key.equals(WrapperFileStandard.COMMAND_PATH)){
return getCommandPath();
}
return null;
}
}
|