当前位置: 首页>>代码示例>>Java>>正文


Java ScreenController类代码示例

本文整理汇总了Java中de.lessvoid.nifty.screen.ScreenController的典型用法代码示例。如果您正苦于以下问题:Java ScreenController类的具体用法?Java ScreenController怎么用?Java ScreenController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ScreenController类属于de.lessvoid.nifty.screen包,在下文中一共展示了ScreenController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: apply

import de.lessvoid.nifty.screen.ScreenController; //导入依赖的package包/类
@Override
public Screen apply(String screenName) {
    ScreenDefinition screenDefinition = screenDefinitions.get(screenName);
    ScreenGenerator interfaceConstructor
            = null;
    try {
        interfaceConstructor = instanceResolutor.resolveScreenGenerator(screenDefinition.getInterfaceConstructor());
        ScreenController controller
                = instanceResolutor.resolveScreenControler(screenDefinition.getController());

        Screen screen = new Screen(interfaceConstructor, controller, flow, screenName);
        return screen;
    } catch (InstanceResolutionException e) {
        e.printStackTrace();
    }
    throw new RuntimeException();
}
 
开发者ID:albertonavarro,项目名称:nifty-flow,代码行数:18,代码来源:ScreenFlowManagerImpl.java

示例2: shouldCreateRootFlow

import de.lessvoid.nifty.screen.ScreenController; //导入依赖的package包/类
@Test
public void shouldCreateRootFlow()  throws Exception {
    ScreenDefinition sc1 = new ScreenDefinition("screen1", "controllerClass", "interfaceConstructor");
    ScreenDefinition sc2 = new ScreenDefinition("screen2", "controllerClass2", "interfaceConstructor2");
    ScreenDefinition sc3 = new ScreenDefinition("screen3", "controllerClass", "interfaceConstructor2");
    ScreenGenerator interfaceConstructor = mock(ScreenGenerator.class);
    ScreenGenerator interfaceConstructor2 = mock(ScreenGenerator.class);

    when(instanceResolutor.resolveScreenGenerator("interfaceConstructor")).thenReturn(interfaceConstructor);
    when(instanceResolutor.resolveScreenControler("controllerClass")).thenReturn(mock(ScreenController.class));
    when(instanceResolutor.resolveScreenGenerator("interfaceConstructor2")).thenReturn(interfaceConstructor2);
    when(instanceResolutor.resolveScreenControler("controllerClass2")).thenReturn(mock(ScreenController.class));

    tested.addScreenDefinition(sc1);
    tested.addScreenDefinition(sc2);
    tested.addScreenDefinition(sc3);

    tested.addFlowDefinition("root", Optional.<String>absent(), newArrayList("screen1", "screen2"));
    assertEquals(tested.nextScreen(), "root:screen1");
    tested.setNextScreenHint(ScreenFlowManager.NEXT);
    assertEquals(tested.nextScreen(), "root:screen2");
    tested.setNextScreenHint(ScreenFlowManager.PREV);
    assertEquals(tested.nextScreen(), "root:screen1");
}
 
开发者ID:albertonavarro,项目名称:nifty-flow,代码行数:25,代码来源:ScreenFlowManagerTest.java

示例3: shouldNotMoveWithoutHints

import de.lessvoid.nifty.screen.ScreenController; //导入依赖的package包/类
@Test
public void shouldNotMoveWithoutHints() throws Exception  {
    ScreenDefinition sc1 = new ScreenDefinition("screen1", "controllerClass", "interfaceConstructor");
    ScreenDefinition sc2 = new ScreenDefinition("screen2", "controllerClass2", "interfaceConstructor2");
    ScreenDefinition sc3 = new ScreenDefinition("screen3", "controllerClass", "interfaceConstructor2");

    ScreenGenerator interfaceConstructor = mock(ScreenGenerator.class);
    ScreenGenerator interfaceConstructor2 = mock(ScreenGenerator.class);

    when(instanceResolutor.resolveScreenGenerator("interfaceConstructor")).thenReturn(interfaceConstructor);
    when(instanceResolutor.resolveScreenControler("controllerClass")).thenReturn(mock(ScreenController.class));
    when(instanceResolutor.resolveScreenGenerator("interfaceConstructor2")).thenReturn(interfaceConstructor2);
    when(instanceResolutor.resolveScreenControler("controllerClass2")).thenReturn(mock(ScreenController.class));

    tested.addScreenDefinition(sc1);
    tested.addScreenDefinition(sc2);
    tested.addScreenDefinition(sc3);

    tested.addFlowDefinition("root", Optional.<String>absent(), newArrayList("screen1", "screen2", "screen3"));
    assertEquals(tested.nextScreen(), "root:screen1");
    tested.setNextScreenHint(ScreenFlowManager.NEXT);
    assertEquals(tested.nextScreen(), "root:screen2");
    //If next screen is invoked, without hints, we expect the same screen.
    assertEquals(tested.nextScreen(), "root:screen2");
}
 
开发者ID:albertonavarro,项目名称:nifty-flow,代码行数:26,代码来源:ScreenFlowManagerTest.java

示例4: shouldNotMoveWithWrongHints

import de.lessvoid.nifty.screen.ScreenController; //导入依赖的package包/类
@Test
public void shouldNotMoveWithWrongHints() throws Exception {
    ScreenDefinition sc1 = new ScreenDefinition("screen1", "controllerClass", "interfaceConstructor");
    ScreenDefinition sc2 = new ScreenDefinition("screen2", "controllerClass2", "interfaceConstructor2");
    ScreenDefinition sc3 = new ScreenDefinition("screen3", "controllerClass", "interfaceConstructor2");

    ScreenGenerator interfaceConstructor = mock(ScreenGenerator.class);
    ScreenGenerator interfaceConstructor2 = mock(ScreenGenerator.class);

    when(instanceResolutor.resolveScreenGenerator("interfaceConstructor")).thenReturn(interfaceConstructor);
    when(instanceResolutor.resolveScreenControler("controllerClass")).thenReturn(mock(ScreenController.class));
    when(instanceResolutor.resolveScreenGenerator("interfaceConstructor2")).thenReturn(interfaceConstructor2);
    when(instanceResolutor.resolveScreenControler("controllerClass2")).thenReturn(mock(ScreenController.class));

    tested.addScreenDefinition(sc1);
    tested.addScreenDefinition(sc2);
    tested.addScreenDefinition(sc3);

    tested.addFlowDefinition("root", Optional.<String>absent(), newArrayList("screen1", "screen2", "screen3"));
    assertEquals(tested.nextScreen(), "root:screen1");
    tested.setNextScreenHint(ScreenFlowManager.PREV);
    assertEquals(tested.nextScreen(), "root:screen1");
}
 
开发者ID:albertonavarro,项目名称:nifty-flow,代码行数:24,代码来源:ScreenFlowManagerTest.java

示例5: shouldSkipForwards

import de.lessvoid.nifty.screen.ScreenController; //导入依赖的package包/类
@Test
public void shouldSkipForwards() throws Exception  {
    ScreenDefinition sc1 = new ScreenDefinition("screen1", "controllerClass", "interfaceConstructor");
    ScreenDefinition sc2 = new ScreenDefinition("screen2", "controllerClass2", "interfaceConstructor2");
    ScreenDefinition sc3 = new ScreenDefinition("screen3", "controllerClass", "interfaceConstructor2");

    ScreenGenerator interfaceConstructor = mock(ScreenGenerator.class);
    ScreenGenerator interfaceConstructor2 = mock(ScreenGenerator.class);

    when(instanceResolutor.resolveScreenGenerator("interfaceConstructor")).thenReturn(interfaceConstructor);
    when(instanceResolutor.resolveScreenControler("controllerClass")).thenReturn(mock(ScreenController.class));
    when(instanceResolutor.resolveScreenGenerator("interfaceConstructor2")).thenReturn(interfaceConstructor2);
    when(instanceResolutor.resolveScreenControler("controllerClass2")).thenReturn(mock(ScreenController.class));

    tested.addScreenDefinition(sc1);
    tested.addScreenDefinition(sc2);
    tested.addScreenDefinition(sc3);

    tested.addFlowDefinition("root", Optional.<String>absent(), newArrayList("screen1", "screen2", "screen3"));
    assertEquals(tested.nextScreen(), "root:screen1");
    tested.setNextScreenHint(ScreenFlowManager.NEXT);
    assertEquals(tested.nextScreen(), "root:screen2");
    tested.setNextScreenHint(ScreenFlowManager.SKIP);
    assertEquals(tested.nextScreen(), "root:screen3");
}
 
开发者ID:albertonavarro,项目名称:nifty-flow,代码行数:26,代码来源:ScreenFlowManagerTest.java

示例6: shouldReturnChildren

import de.lessvoid.nifty.screen.ScreenController; //导入依赖的package包/类
@Test
public void shouldReturnChildren() throws Exception {
    ScreenDefinition sc1 = new ScreenDefinition("screen1", "controllerClass", "interfaceConstructor");
    ScreenDefinition sc2 = new ScreenDefinition("screen2", "controllerClass2", "interfaceConstructor2");

    ScreenGenerator interfaceConstructor = mock(ScreenGenerator.class);
    ScreenGenerator interfaceConstructor2 = mock(ScreenGenerator.class);

    when(instanceResolutor.resolveScreenGenerator("interfaceConstructor")).thenReturn(interfaceConstructor);
    when(instanceResolutor.resolveScreenControler("controllerClass")).thenReturn(mock(ScreenController.class));
    when(instanceResolutor.resolveScreenGenerator("interfaceConstructor2")).thenReturn(interfaceConstructor2);
    when(instanceResolutor.resolveScreenControler("controllerClass2")).thenReturn(mock(ScreenController.class));

    tested.addScreenDefinition(sc1);
    tested.addScreenDefinition(sc2);

    tested.addFlowDefinition("root", Optional.<String>absent(), newArrayList("screen1", "screen2"));
    tested.addFlowDefinition("child1", of("root:screen2"), newArrayList("screen1", "screen2"));
    tested.setNextScreenHint(ScreenFlowManager.NEXT);
    assertEquals(tested.nextScreen(), "root:screen2");

    Collection<String> children = tested.getChildren();
    assertFalse(children.isEmpty());
}
 
开发者ID:albertonavarro,项目名称:nifty-flow,代码行数:25,代码来源:ScreenFlowManagerTest.java

示例7: shouldSkipBackwards

import de.lessvoid.nifty.screen.ScreenController; //导入依赖的package包/类
@Test
public void shouldSkipBackwards() throws Exception  {
    ScreenDefinition sc1 = new ScreenDefinition("screen1", "controllerClass", "interfaceConstructor");
    ScreenDefinition sc2 = new ScreenDefinition("screen2", "controllerClass2", "interfaceConstructor2");
    ScreenDefinition sc3 = new ScreenDefinition("screen3", "controllerClass", "interfaceConstructor2");

    ScreenGenerator interfaceConstructor = mock(ScreenGenerator.class);
    ScreenGenerator interfaceConstructor2 = mock(ScreenGenerator.class);

    when(instanceResolutor.resolveScreenGenerator("interfaceConstructor")).thenReturn(interfaceConstructor);
    when(instanceResolutor.resolveScreenControler("controllerClass")).thenReturn(mock(ScreenController.class));
    when(instanceResolutor.resolveScreenGenerator("interfaceConstructor2")).thenReturn(interfaceConstructor2);
    when(instanceResolutor.resolveScreenControler("controllerClass2")).thenReturn(mock(ScreenController.class));


    tested.addScreenDefinition(sc1);
    tested.addScreenDefinition(sc2);
    tested.addScreenDefinition(sc3);

    tested.addFlowDefinition("root", Optional.<String>absent(), newArrayList("screen1", "screen2", "screen3"));
    assertEquals(tested.nextScreen(), "root:screen1");
    tested.setNextScreenHint(ScreenFlowManager.NEXT);
    assertEquals(tested.nextScreen(), "root:screen2");
    tested.setNextScreenHint(ScreenFlowManager.SKIP);
    assertEquals(tested.nextScreen(), "root:screen3");
    tested.setNextScreenHint(ScreenFlowManager.PREV);
    assertEquals(tested.nextScreen(), "root:screen2");
    tested.setNextScreenHint(ScreenFlowManager.SKIP);
    assertEquals(tested.nextScreen(), "root:screen1");
}
 
开发者ID:albertonavarro,项目名称:nifty-flow,代码行数:31,代码来源:ScreenFlowManagerTest.java

示例8: loadXml

import de.lessvoid.nifty.screen.ScreenController; //导入依赖的package包/类
public void loadXml(String filename, String startScreen, ScreenController... controllers) {
	Log.info("[NIFTY] Loading '" + filename + "'");
	nifty.fromXml(filename, Loader.getResourceAsStream("assets/gui/" + filename), startScreen, controllers);
}
 
开发者ID:roryclaasen,项目名称:sandbox,代码行数:5,代码来源:NiftyHandler.java

示例9: createDesktop

import de.lessvoid.nifty.screen.ScreenController; //导入依赖的package包/类
ScreenBuilder createDesktop(final String title, final String message) {
    final ScreenController controller = this;

    return new ScreenBuilder(SCREEN_ID) {
        {
            controller(controller);
            layer(new LayerBuilder("foreground") {
                {
                    childLayoutCenter();
                    panel(new PanelBuilder("panel") {
                        {
                            style("nifty-panel-simple");
                            childLayoutAbsolute();

                            width("400");
                            height("125");

                            control(new LabelBuilder("title", title) {
                                {
                                    x("0");
                                    y("0");
                                    width("400");
                                    height("30");
                                }
                            });

                            control(new TextFieldBuilder("message") {
                                {
                                    x("0");
                                    y("45");

                                    width("100%");
                                    height("30");
                                    text(message);
                                }
                            });
                        }
                    });
                }
            });
        }
    };
}
 
开发者ID:matthewseal,项目名称:MoleculeViewer,代码行数:44,代码来源:TextDialog.java

示例10: createMobile

import de.lessvoid.nifty.screen.ScreenController; //导入依赖的package包/类
ScreenBuilder createMobile(final String title, final String message) {
    final ScreenController controller = this;

    return new ScreenBuilder(SCREEN_ID) {
        {
            controller(controller);
            layer(new LayerBuilder("foreground") {
                {
                    childLayoutCenter();
                    panel(new PanelBuilder("panel") {
                        {
                            style("nifty-panel-simple");
                            childLayoutAbsolute();

                            width("90%");
                            height("300");

                            control(new LabelBuilder("title", title) {
                                {
                                    x("0");
                                    y("0");
                                    width("100%");
                                    height("60");
                                }
                            });

                            control(new TextFieldBuilder("message") {
                                {
                                    x("0");
                                    y("150");

                                    width("100%");
                                    height("60");
                                    text(message);
                                }
                            });
                        }
                    });
                }
            });
        }
    };
}
 
开发者ID:matthewseal,项目名称:MoleculeViewer,代码行数:44,代码来源:TextDialog.java

示例11: createAndroid

import de.lessvoid.nifty.screen.ScreenController; //导入依赖的package包/类
private ScreenBuilder createAndroid(final String message) {
    final ScreenController This = this;

    return new ScreenBuilder(SCREEN_ID) {
        {
            controller(This);
            layer(new LayerBuilder("foreground") {
                {
                    childLayoutCenter();
                    panel(new PanelBuilder("panel") {
                        {
                            style("nifty-panel-simple");
                            childLayoutAbsolute();
                            //x("100px");
                            //y("100px");
                            width("750px");
                            height("175px");

                            control(new LabelBuilder("title", message) {
                                {
                                    x("0");
                                    y("0");
                                    width("600px");
                                    height("60px");
                                }
                            });
                            control(new TextFieldBuilder("textField") {
                                {
                                    maxLength(20);
                                    x("10");
                                    y("75");
                                    width("450px");
                                    height("60px");
                                }
                            });
                            control(new ButtonBuilder("enter", "Enter") {
                                {
                                    x("500");
                                    y("75");
                                    height("60px");
                                    width("200px");
                                    interactOnClick("enter()");
                                }
                            });
                        }
                    });
                }
            });
        }
    };
}
 
开发者ID:matthewseal,项目名称:MoleculeViewer,代码行数:52,代码来源:TextinputDialog.java

示例12: createDesktop

import de.lessvoid.nifty.screen.ScreenController; //导入依赖的package包/类
private ScreenBuilder createDesktop(final String message) {
    final ScreenController This = this;
    return new ScreenBuilder(SCREEN_ID) {
        {
            controller(This);
            layer(new LayerBuilder("foreground") {
                {
                    childLayoutCenter();
                    panel(new PanelBuilder("panel") {
                        {
                            style("nifty-panel-simple");
                            childLayoutAbsolute();
                            //x("100px");
                            // y("100px");
                            width("350px");
                            height("100px");

                            control(new LabelBuilder("title", message) {
                                {
                                    x("0");
                                    y("0");
                                    width("350px");
                                    height("40px");
                                }
                            });
                            control(new TextFieldBuilder("textField") {
                                {
                                    maxLength(20);
                                    x("10");
                                    y("45");
                                    width("200px");
                                    height("25px");
                                }
                            });
                            control(new ButtonBuilder("enter", "Enter") {
                                {
                                    x("225");
                                    y("45");
                                    height("25px");
                                    interactOnClick("enter()");
                                }
                            });
                        }
                    });
                }
            });
        }
    };
}
 
开发者ID:matthewseal,项目名称:MoleculeViewer,代码行数:50,代码来源:TextinputDialog.java

示例13: bind

import de.lessvoid.nifty.screen.ScreenController; //导入依赖的package包/类
@Override
public void bind(Nifty nifty, Screen screen) {
    this.nifty = nifty;
    final ScreenController This = this;
    Screen dialog = new ScreenBuilder(SCREEN_ID) {
        {
            controller(This);
            layer(new LayerBuilder("foreground") {
                {
                    childLayoutCenter();

                    control(new ListBoxBuilder("moleculeList") {
                        {
                            childLayoutVertical();
                            set("horizontal", "false");
                            displayItems(10);
                            selectionModeSingle();
                            optionalVerticalScrollbar();
                            optionalHorizontalScrollbar();
                            width("85%");
                            height("85%");
                            x("8%");
                            y("10%");
                        }
                    });

                }
            });
        }
    }.build(nifty);

    //Element e = dialog.findElementByName("foreground");

    /*CreateListBoxControl clistBox = new CreateListBoxControl("listBoxDynamic");
     clistBox.set("horizontal", "false");
     clistBox.setWidth("85%");
     clistBox.setHeight("85%");
     //clistBox.setY("10%");
     //clistBox.setX("8%");
     clistBox.setChildLayout("vertical");
     clistBox.set("displayItems", "10");
     clistBox.set("vertical", "optional");
     clistBox.set("horizontal", "optional");


     listBox = clistBox.create(nifty, dialog, e);

     File dir = Constants.getMoleculeLocation();
     File[] fs = dir.listFiles();
     if (fs == null) {
     fs = new File[0];
     }
     for (File f : fs) {
     String name = FileTools.getFileName(f);
     listBox.addItem(name);
     }*/
    ListBox box = dialog.findNiftyControl("moleculeList", ListBox.class);
    // add items; box.addItem

    File dir = Constants.getMoleculeLocation();
    String[] fs = FileTools.listSubFiles(dir);

    for (String subF : fs) {
        box.addItem(subF);
    }

    nifty.addScreen(SCREEN_ID, dialog);
    nifty.gotoScreen(SCREEN_ID);
}
 
开发者ID:matthewseal,项目名称:MoleculeViewer,代码行数:70,代码来源:MoleculeDialog.java

示例14: Generator2

import de.lessvoid.nifty.screen.ScreenController; //导入依赖的package包/类
public Generator2(Nifty nifty, ScreenController screenController) {
    this.nifty = nifty;
    this.screenController = screenController;
}
 
开发者ID:albertonavarro,项目名称:nifty-flow,代码行数:5,代码来源:Generator2.java

示例15: addController

import de.lessvoid.nifty.screen.ScreenController; //导入依赖的package包/类
public void addController(String name, ScreenController sc) {
    controllers.put(name, sc);
}
 
开发者ID:albertonavarro,项目名称:nifty-flow,代码行数:4,代码来源:LiveInstanceResolutor.java


注:本文中的de.lessvoid.nifty.screen.ScreenController类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。