use of de.lessvoid.nifty.elements.Element in project jmonkeyengine by jMonkeyEngine.
the class InputSystemJme method processSoftKeyboard.
private void processSoftKeyboard() {
SoftTextDialogInput softTextDialogInput = JmeSystem.getSoftTextDialogInput();
if (softTextDialogInput != null) {
Element element = nifty.getCurrentScreen().getFocusHandler().getKeyboardFocusElement();
if (element != null) {
final TextField textField = element.getNiftyControl(TextField.class);
if (textField != null) {
Logger.getLogger(InputSystemJme.class.getName()).log(Level.FINE, "Current TextField: {0}", textField.getId());
String initialValue = textField.getText();
if (initialValue == null) {
initialValue = "";
}
softTextDialogInput.requestDialog(SoftTextDialogInput.TEXT_ENTRY_DIALOG, "Enter Text", initialValue, new SoftTextDialogInputListener() {
public void onSoftText(int action, String text) {
if (action == SoftTextDialogInputListener.COMPLETE) {
textField.setText(text);
}
}
});
}
}
}
}
use of de.lessvoid.nifty.elements.Element in project TeachingInSimulation by ScOrPiOzzy.
the class ConnectionController method showWireNum.
public void showWireNum() {
Element numDialogue = nifty.findPopupByName("numDialoguePopup");
if (numDialogue == null || !numDialogue.equals(nifty.getTopMostPopup())) {
return;
}
TextField wireNumTextfield = numDialogue.findElementByName("wireNum").getNiftyControl(TextField.class);
String wireNum = wireNumTextfield.getRealText();
connectionHandler.modifyWireNum(wireNum);
setNumDialogueVisible(false);
}
use of de.lessvoid.nifty.elements.Element in project TeachingInSimulation by ScOrPiOzzy.
the class ConnectionController method selectWire.
/**
*/
private void selectWire() {
if (!connectionHandler.checkChange()) {
Dispatcher.getIns().getTip().showTip(ITip.ERROR, ConnectionUtil.CONNECTING_CANNOT_CHANGE);
return;
}
setContentVisible("pipeColorsContent", "false");
setContentVisible("wireColorsContent", "true");
if (connectionHandler.getCurrLinker() instanceof Wire) {
// 当前是导线
currentWireIndex = currentWireIndex + 1 > wireColors.length - 1 ? 0 : currentWireIndex + 1;
}
List<Element> colorEles = findById("wireColorsContent").getElements();
for (int i = 0; i < colorEles.size(); i++) {
Element colorEle = colorEles.get(i);
if (i == currentWireIndex) {
colorEle.startEffect(EffectEventId.onHover);
} else {
colorEle.stopEffect(EffectEventId.onHover);
}
}
changeWireColor(String.valueOf(currentWireIndex));
// 2秒后隐藏
selectHideTimer("wireColorsContent");
}
use of de.lessvoid.nifty.elements.Element in project TeachingInSimulation by ScOrPiOzzy.
the class ConnectionController method showBorder.
/**
* 显示线缆线框
* @param index
*/
public void showBorder(int index) {
Element xianlanColorsContent = findById("xianlanColorsContent");
List<Element> eles = xianlanColorsContent.getElements();
for (int i = 0; i < eles.size(); i++) {
if (i == index) {
eles.get(i).startEffect(EffectEventId.onActive);
} else {
eles.get(i).stopEffect(EffectEventId.onActive);
}
}
}
Aggregations