/**
 * Copyright (C) 2012 MK124
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.gtaun.shoebill.common.dialog;

import net.gtaun.shoebill.Shoebill;
import net.gtaun.shoebill.constant.DialogStyle;
import net.gtaun.shoebill.event.dialog.DialogResponseEvent;
import net.gtaun.shoebill.object.Player;
import net.gtaun.util.event.EventManager;

/**
 * 抽象输入对话框类。
 * 
 * @author MK124
 */
public abstract class AbstractInputDialog extends AbstractDialog
{
	private final boolean passwordMode;
	
	
	protected String message = "None";
	
	
	public AbstractInputDialog(Player player, Shoebill shoebill, EventManager rootEventManager)
	{
		this(player, shoebill, rootEventManager, null);
	}

	public AbstractInputDialog(Player player, Shoebill shoebill, EventManager rootEventManager, AbstractDialog parentDialog)
	{
		super(DialogStyle.INPUT, player, shoebill, rootEventManager, parentDialog);
		this.passwordMode = false;
	}

	public AbstractInputDialog(Player player, Shoebill shoebill, EventManager rootEventManager, boolean passwordMode)
	{
		this(player, shoebill, rootEventManager, passwordMode, null);
	}
	
	public AbstractInputDialog(Player player, Shoebill shoebill, EventManager rootEventManager, boolean passwordMode, AbstractDialog parentDialog)
	{
		super(passwordMode ? DialogStyle.PASSWORD : DialogStyle.INPUT, player, shoebill, rootEventManager, parentDialog);
		this.passwordMode = passwordMode;
	}

	public AbstractInputDialog(Player player, Shoebill shoebill, EventManager rootEventManager, String caption, String message)
	{
		this(player, shoebill, rootEventManager, caption, message, null);
	}

	public AbstractInputDialog(Player player, Shoebill shoebill, EventManager rootEventManager, String caption, String message, AbstractDialog parentDialog)
	{
		super(DialogStyle.INPUT, player, shoebill, rootEventManager, parentDialog);
		this.passwordMode = false;
		this.caption = caption;
		this.message = message;
	}

	public AbstractInputDialog(Player player, Shoebill shoebill, EventManager rootEventManager, String caption, String message, boolean passwordMode)
	{
		this(player, shoebill, rootEventManager, caption, message, passwordMode, null);
	}
	
	public AbstractInputDialog(Player player, Shoebill shoebill, EventManager rootEventManager, String caption, String message, boolean passwordMode, AbstractDialog parentDialog)
	{
		super(passwordMode ? DialogStyle.PASSWORD : DialogStyle.INPUT, player, shoebill, rootEventManager, parentDialog);
		this.passwordMode = passwordMode;
		this.caption = caption;
		this.message = message;
	}
	
	public boolean isPasswordMode()
	{
		return passwordMode;
	}
	
	@Override
	public void show()
	{
		show(message);
	}
	
	@Override
	final void onClickOk(DialogResponseEvent event)
	{
		onClickOk(event.getInputText());
	}
	
	public void onClickOk(String inputText)
	{
		
	}
}

@@ -1595,16 +1595,22 @@
 Manager,
+ null,
  passwor
@@ -1606,38 +1606,32 @@
 ll, passwordMode
-, null
 );%0A%09%7D%0A%09%0A%09public 
@@ -1714,38 +1714,16 @@
 Manager,
- boolean passwordMode,
  Abstrac
@@ -1734,32 +1734,54 @@
 log parentDialog
+, boolean passwordMode
 )%0A%09%7B%0A%09%09super(pas
@@ -2087,32 +2087,38 @@
 ootEventManager,
+ null,
  caption, messag
@@ -2118,22 +2118,16 @@
  message
-, null
 );%0A%09%7D%0A%0A%09
@@ -2209,32 +2209,61 @@
 ootEventManager,
+ AbstractDialog parentDialog,
  String caption,
@@ -2281,37 +2281,8 @@
 sage
-, AbstractDialog parentDialog
 )%0A%09%7B
@@ -2637,16 +2637,22 @@
 Manager,
+ null,
  caption
@@ -2674,22 +2674,16 @@
 wordMode
-, null
 );%0A%09%7D%0A%09%0A
@@ -2766,32 +2766,61 @@
 ootEventManager,
+ AbstractDialog parentDialog,
  String caption,
@@ -2860,37 +2860,8 @@
 Mode
-, AbstractDialog parentDialog
 )%0A%09%7B

修改 AbstractInputDialog 构造器的参数顺序。