本文整理汇总了Java中javax.security.auth.callback.ConfirmationCallback.setSelectedIndex方法的典型用法代码示例。如果您正苦于以下问题:Java ConfirmationCallback.setSelectedIndex方法的具体用法?Java ConfirmationCallback.setSelectedIndex怎么用?Java ConfirmationCallback.setSelectedIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.security.auth.callback.ConfirmationCallback
的用法示例。
在下文中一共展示了ConfirmationCallback.setSelectedIndex方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testConfirmationCallback_09
import javax.security.auth.callback.ConfirmationCallback; //导入方法依赖的package包/类
/**
* test of methods getOptionType(), getDefaultOption(), getMessageType()
* getOptions(), set/getSelectedIndex
*/
public final void testConfirmationCallback_09() throws IllegalArgumentException {
String[] opt = {"CONTINUE", "ABORT"};
String[] s;
cc = new ConfirmationCallback("prompt", mt[0], opt, 1);
assertEquals(1, cc.getDefaultOption());
assertEquals(ConfirmationCallback.INFORMATION, cc.getMessageType());
assertEquals(opt,cc.getOptions());
s = cc.getOptions();
for (int i = 0; i < opt.length; i++){
assertEquals(opt[i], s[i]);
}
assertEquals("prompt", cc.getPrompt());
assertEquals(-1, cc.getOptionType());
assertEquals(ConfirmationCallback.UNSPECIFIED_OPTION, cc.getOptionType());
assertNotNull(cc.getOptions());
cc.setSelectedIndex(1);
assertEquals(1, cc.getSelectedIndex());
}
示例2: handleConfirmation
import javax.security.auth.callback.ConfirmationCallback; //导入方法依赖的package包/类
protected void handleConfirmation(ConfirmationCallback c)
{
if (c.getOptionType() == ConfirmationCallback.YES_NO_OPTION)
c.setSelectedIndex(ConfirmationCallback.NO);
else if (c.getOptionType() == ConfirmationCallback.YES_NO_CANCEL_OPTION)
c.setSelectedIndex(ConfirmationCallback.NO);
else if (c.getOptionType() == ConfirmationCallback.OK_CANCEL_OPTION)
c.setSelectedIndex(ConfirmationCallback.OK);
else
c.setSelectedIndex(c.getDefaultOption());
}
示例3: testConfirmationCallback_10
import javax.security.auth.callback.ConfirmationCallback; //导入方法依赖的package包/类
/**
* test of methods getOptions(), set/getSelectedIndex when options is null
*/
public final void testConfirmationCallback_10() throws IllegalArgumentException {
cc = new ConfirmationCallback("prompt", mt[0], ot[0], dopt[0]);
assertNull(cc.getOptions());
cc.setSelectedIndex(1);
assertEquals(1, cc.getSelectedIndex());
}
示例4: testSetSelectedIndex
import javax.security.auth.callback.ConfirmationCallback; //导入方法依赖的package包/类
public final void testSetSelectedIndex() throws Exception {
cc = new ConfirmationCallback("prompt", mt[0], ot[0], dopt[0]);
cc.setSelectedIndex(ConfirmationCallback.YES);
}