List of usage examples for com.badlogic.gdx.scenes.scene2d.ui ScrollPane ScrollPane
public ScrollPane(Actor widget, Skin skin, String styleName)
From source file:com.digitale.screens.ShipScreen.java
License:Open Source License
public ShipScreen(Stage stage) { Stardust3d.MyDataOp.getShipFitting(Stardust3d.myCharacter.getUid()); for (int i = 0; i < Stardust3d.charList.length; i++) { listEntries[i] = (Stardust3d.charList[i].getFirstname() + " \n" + Stardust3d.charList[i].getSurname() + " \n " + "10000c "); listEntries[i] = listEntries[i] + ("System " + Stardust3d.charList[i].getSystem() + " \nSta " + Stardust3d.charList[i].getStamina() + " Int " + Stardust3d.charList[i].getIntelligence() + " Soc " + Stardust3d.charList[i].getSocial() + " Dex " + Stardust3d.charList[i].getDexterity() + " Led " + Stardust3d.charList[i].getLeadership() + " Rec " + Stardust3d.charList[i].getRecuperation() + " \nFlying: " + Util.asCapFirstChar(Stardust3d.charList[i].getShipname())); }//from www. j a va 2s .c o m skin = new Skin(Gdx.files.internal("data/uiskin.json"), Gdx.files.internal("data/uiskin.png")); sticklebackTexture = Stardust3d.manager.get("data/stickleback.png", Pixmap.class); salxTexture = Stardust3d.manager.get("data/salx.png", Pixmap.class); cynomysTexture = Stardust3d.manager.get("data/cynomys.png", Pixmap.class); squirrelTexture = Stardust3d.manager.get("data/squirrelicon.png", Pixmap.class); Texture shipimage; Gdx.input.setInputProcessor(stage); // Group.debug = true; final Label shipNameLabel = new Label(Stardust3d.myCharacter.getShipname(), skin.getStyle(LabelStyle.class), "shipnamelable"); final Button buttonClose = new TextButton("Close", skin.getStyle(TextButtonStyle.class), "button-close"); final SelectBox dropdown = new SelectBox(listEntries, skin.getStyle(SelectBoxStyle.class), "combo"); final Table gridEquipment = initGridEquipment(); final List list = new List(listEntries, skin.getStyle(ListStyle.class), "list"); final ScrollPane scrollPane2 = new ScrollPane(gridEquipment, skin.getStyle(ScrollPaneStyle.class), "scroll"); //scrollPane2.setWidget(list); final Label statsLabel = new Label("Stats", skin.getStyle(LabelStyle.class), "statslabel"); final Label equipLabel = new Label("Equipment", skin.getStyle(LabelStyle.class), "equiplabel"); if (Stardust3d.myCharacter.getShipname().equals("salx")) { shipimage = new Texture(salxTexture); } else if (Stardust3d.myCharacter.getShipname().equals("stickleback")) { shipimage = new Texture(sticklebackTexture); } else if (Stardust3d.myCharacter.getShipname().equals("squirrel")) { shipimage = new Texture(squirrelTexture); } else { shipimage = new Texture(cynomysTexture); } final Image imageActor = new Image(shipimage); selectedCharacter = ("Character: " + Stardust3d.charList[0].getFirstname() + " \n" + Stardust3d.charList[0].getSurname()); Window window = new Window("Ship Screen", skin.getStyle(WindowStyle.class), "shipWindow"); if (Stardust3d.DEBUG) window.debug(); window.x = window.y = 0; window.setFillParent(true); window.setMovable(false); window.defaults().pad(5); window.defaults().spaceBottom(5); window.row().fill().expandX().height(32); window.add(); window.add(); window.add(); window.add(buttonClose).height(32); window.row(); window.add(shipNameLabel); window.add(statsLabel); window.add(equipLabel); window.row(); window.add(imageActor).size(128, 128); window.add(); window.add(scrollPane2).colspan(2).fill().expandY(); window.row(); // window.row(); //window.add(splitPane).colspan(4); window.row(); window.row(); window.pack(); // stage.addActor(new Button("Behind Window", skin)); stage.addActor(window); dropdown.setSelectionListener(new SelectionListener() { @Override public void selected(Actor actor, int index, String value) { SoundManager.playuiclick(); selectedCharacter = ("Character: " + Stardust3d.charList[index].getFirstname() + " \n" + Stardust3d.charList[index].getSurname()); Stardust3d.currencharacteruid = "" + Stardust3d.charList[index].getUid(); } }); buttonClose.setClickListener(new ClickListener() { public void click(Actor actor, float x, float y) { System.out.println("Shipscreen Close"); SoundManager.playuiclick(); Stardust3d.stationScreen = 106; doneflag = true; } }); }
From source file:com.digitale.screens.Solar.java
License:Open Source License
public Solar() { for (int i = 0; i < Stardust3d.charList.length; i++) { listEntries[i] = (Stardust3d.charList[i].getFirstname() + " \n" + Stardust3d.charList[i].getSurname() + " \n " + "10000c "); listEntries[i] = listEntries[i] + ("System " + Stardust3d.charList[i].getSystem() + " \nSta " + Stardust3d.charList[i].getStamina() + " Int " + Stardust3d.charList[i].getIntelligence() + " Soc " + Stardust3d.charList[i].getSocial() + " Dex " + Stardust3d.charList[i].getDexterity() + " Led " + Stardust3d.charList[i].getLeadership() + " Rec " + Stardust3d.charList[i].getRecuperation() + " \nFlying: " + Util.asCapFirstChar(Stardust3d.charList[i].getShipname())); }//from ww w. j av a 2 s.co m batch = new SpriteBatch(); skin = new Skin(Gdx.files.internal("data/uiskin.json"), Gdx.files.internal("data/uiskin.png")); texture1 = new Texture(Gdx.files.internal("data/badlogicsmall.jpg")); texture2 = new Texture(Gdx.files.internal("data/badlogic.jpg")); TextureRegion image = new TextureRegion(texture1); TextureRegion image2 = new TextureRegion(texture2); stage = new Stage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false); Gdx.input.setInputProcessor(stage); // Group.debug = true; final Label nameLabel = new Label( Stardust3d.myCharacter.getFirstname() + " \n" + Stardust3d.myCharacter.getSurname(), skin.getStyle(LabelStyle.class), "namelable"); final Label IntelligenceLabel = new Label("Inteligence " + Stardust3d.myCharacter.getIntelligence(), skin.getStyle(LabelStyle.class), "intelligencelable"); final Button buttonEnterGame = new TextButton("Enter Game", skin.getStyle(TextButtonStyle.class), "button-enter-game"); final Button buttonNewCharacter = new TextButton("New Character", skin.getStyle(TextButtonStyle.class), "button-enter-game"); final Button buttonDeleteCharacter = new TextButton("Delete Character", skin.getStyle(TextButtonStyle.class), "button-enter-game"); final TextField textfield = new TextField("", "Click here!", skin.getStyle(TextFieldStyle.class), "textfield"); final SelectBox dropdown = new SelectBox(listEntries, skin.getStyle(SelectBoxStyle.class), "combo"); final Image imageActor = new Image(image2); final FlickScrollPane scrollPane = new FlickScrollPane(imageActor, "flickscroll"); final List list = new List(listEntries, skin.getStyle(ListStyle.class), "list"); final ScrollPane scrollPane2 = new ScrollPane(list, skin.getStyle(ScrollPaneStyle.class), "scroll"); scrollPane2.setWidget(list); final SplitPane splitPane = new SplitPane(scrollPane, scrollPane2, false, skin.getStyle("default-horizontal", SplitPaneStyle.class), "split"); final Label fpsLabel = new Label("fps:", skin.getStyle(LabelStyle.class), "label"); selectedCharacter = ("Character: " + Stardust3d.charList[0].getFirstname() + " \n" + Stardust3d.charList[0].getSurname()); // window.debug(); Window window = new Window("Solar Info Screen", skin.getStyle(WindowStyle.class), "window"); window.x = window.y = 0; window.setFillParent(true); window.setMovable(false); window.defaults().pad(5); window.defaults().spaceBottom(5); window.row().fill().expandX(); window.add(buttonNewCharacter); window.add(buttonDeleteCharacter); window.add(buttonEnterGame); window.row(); window.add(nameLabel); window.row(); window.add(IntelligenceLabel); window.add(IntelligenceLabel); window.add(IntelligenceLabel); window.add(IntelligenceLabel); window.add(IntelligenceLabel); window.row(); // window.add(setWidget(list)); window.row(); window.add(splitPane).colspan(4); window.row(); window.row(); window.add(fpsLabel).colspan(4); window.pack(); // stage.addActor(new Button("Behind Window", skin)); stage.addActor(window); textfield.setTextFieldListener(new TextFieldListener() { public void keyTyped(TextField textField, char key) { if (key == '\n') textField.getOnscreenKeyboard().show(false); } }); dropdown.setSelectionListener(new SelectionListener() { @Override public void selected(Actor actor, int index, String value) { SoundManager.playuiclick(); selectedCharacter = ("Character: " + Stardust3d.charList[index].getFirstname() + " \n" + Stardust3d.charList[index].getSurname()); Stardust3d.currencharacteruid = "" + Stardust3d.charList[index].getUid(); } }); buttonEnterGame.setClickListener(new ClickListener() { public void click(Actor actor, float x, float y) { System.out.println("Charpicker Close"); SoundManager.playuiclick(); // populate game from db, based on this char Stardust3d.gameMode = 4; // Stardust3d.character="35"; /* Stardust3d.MyDataOp.get3dChar(Integer .valueOf(Stardust3d.currencharacteruid)); Stardust3d.MyDataOp.getInventory(Integer .valueOf(Stardust3d.currencharacteruid)); Stardust3d.MyDataOp.getSolarSystem( Stardust3d.myCharacter.getX(), Stardust3d.myCharacter.getY(), Stardust3d.myCharacter.getZ());*/ doneflag = true; } }); }
From source file:com.digitale.screens.SpaceInventory.java
License:Open Source License
public SpaceInventory(Stage stage) { Stardust3d.myInventory.clear();//from w ww . ja v a2 s . co m Stardust3d.MyDataOp.get3dChar(Integer.valueOf(Stardust3d.currencharacteruid)); Stardust3d.MyDataOp.getInventory(Integer.valueOf(Stardust3d.currencharacteruid), false); skin = new Skin(Gdx.files.internal("data/uiskin.json"), Gdx.files.internal("data/uiskin.png")); Gdx.input.setInputProcessor(stage); // Group.debug = true; final Label cargoLabel = new Label("Cargo", skin.getStyle(LabelStyle.class), "cargolable"); final Button buttonClose = new TextButton("Close", skin.getStyle(TextButtonStyle.class), "button-close"); final Label balance = new Label(Stardust3d.myCharacter.getCredits() + " $D", skin.getStyle(LabelStyle.class), "balancelable"); final Table gridCargo = initGridCargo(); final ScrollPane paneCargo = new ScrollPane(gridCargo, skin.getStyle(ScrollPaneStyle.class), "cargo"); Window window = new Window("Space Inventory Screen", skin.getStyle(WindowStyle.class), "spaceInventoryWindow"); if (Stardust3d.DEBUG) window.debug(); window.x = window.y = 0; window.setFillParent(true); window.setMovable(false); window.defaults().pad(5); window.defaults().spaceBottom(5); window.row().fill().expandX(); window.add(balance); window.add(); window.add(); window.add(buttonClose).minWidth(200); window.row(); window.add(cargoLabel).colspan(2); window.add().colspan(2); window.row().fill().expandY(); window.add(paneCargo).colspan(4); window.pack(); stage.addActor(window); buttonClose.setClickListener(new ClickListener() { public void click(Actor actor, float x, float y) { System.out.println("inventory Close"); SoundManager.playuiclick(); Stardust3d.MyDataOp.getInventory(Integer.valueOf(Stardust3d.currencharacteruid), false); Stardust3d.stationScreen = 103; Renderer.stage.clear(); } }); }
From source file:com.digitale.screens.StationInventory.java
License:Open Source License
public StationInventory(Stage stage) { Stardust3d.myInventory.clear();//w ww . jav a2 s . c o m Stardust3d.MyDataOp.get3dChar(Integer.valueOf(Stardust3d.currencharacteruid)); Stardust3d.MyDataOp.getInventory(Integer.valueOf(Stardust3d.currencharacteruid), false); skin = new Skin(Gdx.files.internal("data/uiskin.json"), Gdx.files.internal("data/uiskin.png")); Gdx.input.setInputProcessor(stage); // Group.debug = true; final Label warehouseLabel = new Label("Warehouse", skin.getStyle(LabelStyle.class), "warehouselable"); final Label cargoLabel = new Label("Cargo", skin.getStyle(LabelStyle.class), "cargolable"); final Button buttonClose = new TextButton("Close", skin.getStyle(TextButtonStyle.class), "button-close"); final Button buttonAllToWarehouse = new TextButton("Cargo > Warehouse", skin.getStyle(TextButtonStyle.class), "buttoncargotowarehouse"); final Label balance = new Label(Stardust3d.myCharacter.getCredits() + " $D", skin.getStyle(LabelStyle.class), "balancelable"); final Table gridCargo = initGridCargo(); final Table gridWarehouse = initGridWarehouse(); final ScrollPane paneCargo = new ScrollPane(gridCargo, skin.getStyle(ScrollPaneStyle.class), "cargo"); final ScrollPane paneWarehouse = new ScrollPane(gridWarehouse, skin.getStyle(ScrollPaneStyle.class), "warehouse"); final SplitPane splitPane = new SplitPane(paneCargo, paneWarehouse, false, skin.getStyle("default-horizontal", SplitPaneStyle.class), "split"); Window window = new Window("Station Inventory Screen", skin.getStyle(WindowStyle.class), "stationInventoryWindow"); if (Stardust3d.DEBUG) window.debug(); window.x = window.y = 0; window.setFillParent(true); window.setMovable(false); window.defaults().pad(5); window.defaults().spaceBottom(5); window.row().fill().expandX(); window.add(balance); window.add(); window.add(buttonAllToWarehouse).minWidth(150); window.add(buttonClose).minWidth(150); window.row(); window.add(cargoLabel).colspan(2); window.add(warehouseLabel).colspan(2); window.row().fill().expandY(); window.add(splitPane).colspan(4); window.pack(); stage.addActor(window); buttonClose.setClickListener(new ClickListener() { public void click(Actor actor, float x, float y) { System.out.println("inventory Close"); SoundManager.playuiclick(); Stardust3d.MyDataOp.getInventory(Integer.valueOf(Stardust3d.currencharacteruid), false); Stardust3d.stationScreen = 102; Renderer.stage.clear(); } }); buttonAllToWarehouse.setClickListener(new ClickListener() { public void click(Actor actor, float x, float y) { System.out.println("dump cargo to warehouse"); SoundManager.playuiclick(); Stardust3d.MyDataOp.newRequest("movealltowarehouse#"); for (int i = 0; i < Stardust3d.myInventory.size(); i++) { Inventory item = Stardust3d.myInventory.get(i); if (item.getSlot_id() == 0) { if (Renderer.stage.findActor("" + item.getInventoryid()) != null) { Renderer.stage.findActor("" + item.getInventoryid()).remove(); } } } } }); }
From source file:com.digitale.screens.UIStuff.java
License:Open Source License
public UIStuff(Application app) { batch = new SpriteBatch(); skin = new Skin(Gdx.files.internal("data/uiskin.json"), Gdx.files.internal("data/uiskin.png")); texture1 = new Texture(Gdx.files.internal("data/badlogicsmall.jpg")); texture2 = new Texture(Gdx.files.internal("data/badlogic.jpg")); TextureRegion image = new TextureRegion(texture1); TextureRegion image2 = new TextureRegion(texture2); stage = new Stage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false); Gdx.input.setInputProcessor(stage);/* ww w . ja va2s .c om*/ // Group.debug = true; final Button button = new TextButton("Single", skin.getStyle(TextButtonStyle.class), "button-sl"); final Button buttonMulti = new TextButton("Multi\nLine\nToggle", skin.getStyle("toggle", TextButtonStyle.class), "button-ml-tgl"); final Button imgButton = new Button(new Image(image), skin.getStyle(ButtonStyle.class)); final Button imgToggleButton = new Button(new Image(image), skin.getStyle("toggle", ButtonStyle.class)); final CheckBox checkBox = new CheckBox("Check me", skin.getStyle(CheckBoxStyle.class), "checkbox"); final Slider slider = new Slider(0, 10, 1, skin.getStyle(SliderStyle.class), "slider"); final TextField textfield = new TextField("", "Click here!", skin.getStyle(TextFieldStyle.class), "textfield"); final SelectBox dropdown = new SelectBox(new String[] { "Android", "Windows", "Linux", "OSX" }, skin.getStyle(SelectBoxStyle.class), "combo"); final Image imageActor = new Image(image2); final FlickScrollPane scrollPane = new FlickScrollPane(imageActor, "flickscroll"); final List list = new List(listEntries, skin.getStyle(ListStyle.class), "list"); final ScrollPane scrollPane2 = new ScrollPane(list, skin.getStyle(ScrollPaneStyle.class), "scroll"); final SplitPane splitPane = new SplitPane(scrollPane, scrollPane2, false, skin.getStyle("default-horizontal", SplitPaneStyle.class), "split"); final Label fpsLabel = new Label("fps:", skin.getStyle(LabelStyle.class), "label"); // configures an example of a TextField in password mode. final Label passwordLabel = new Label("Textfield in password mode: ", skin); final TextField passwordTextField = new TextField("", "password", skin); passwordTextField.setPasswordCharacter('*'); passwordTextField.setPasswordMode(true); // window.debug(); Window window = new Window("Dialog", skin.getStyle(WindowStyle.class), "window"); window.x = window.y = 0; window.defaults().spaceBottom(5); window.row().fill().expandX(); window.add(button).fill(0f, 0f); window.add(buttonMulti); window.add(imgButton); window.add(imgToggleButton); window.row(); window.add(checkBox); window.add(slider).minWidth(100).fillX().colspan(3); window.row(); window.add(dropdown); window.add(textfield).minWidth(100).expandX().fillX().colspan(3); window.row(); window.add(splitPane).fill().expand().colspan(4).maxHeight(150); window.row(); window.add(passwordLabel).colspan(2); window.add(passwordTextField).minWidth(100).expandX().fillX().colspan(2); window.row(); window.add(fpsLabel).colspan(4); window.pack(); // stage.addActor(new Button("Behind Window", skin)); stage.addActor(window); textfield.setTextFieldListener(new TextFieldListener() { public void keyTyped(TextField textField, char key) { if (key == '\n') textField.getOnscreenKeyboard().show(false); } }); slider.setValueChangedListener(new ValueChangedListener() { public void changed(Slider slider, float value) { Gdx.app.log("UITest", "slider: " + value); } }); }
From source file:com.digitale.screens.Vendor.java
License:Open Source License
public Vendor(Stage stage) { Stardust3d.myInventory.clear();/*from w ww. j av a 2s. c o m*/ Stardust3d.MyDataOp.get3dChar(Integer.valueOf(Stardust3d.currencharacteruid)); Stardust3d.MyDataOp.getInventory(Integer.valueOf(Stardust3d.currencharacteruid), false); Stardust3d.vendorInventory.clear(); Stardust3d.MyDataOp.getVendorInventory(Integer.valueOf("-450")); skin = new Skin(Gdx.files.internal("data/uiskin.json"), Gdx.files.internal("data/uiskin.png")); Gdx.input.setInputProcessor(stage); // Group.debug = true; final Label warehouseLabel = new Label("Vendor", skin.getStyle(LabelStyle.class), "vendorlable"); final Label cargoLabel = new Label("Warehouse", skin.getStyle(LabelStyle.class), "warehouselable"); final Button buttonClose = new TextButton("Close", skin.getStyle(TextButtonStyle.class), "button-close"); final Label balance = new Label(Stardust3d.myCharacter.getCredits() + " $D", skin.getStyle(LabelStyle.class), "balancelable"); final Table gridCargo = initGridCargo(); final Table gridWarehouse = initGridWarehouse(); final ScrollPane paneCargo = new ScrollPane(gridCargo, skin.getStyle(ScrollPaneStyle.class), "cargo"); final ScrollPane paneWarehouse = new ScrollPane(gridWarehouse, skin.getStyle(ScrollPaneStyle.class), "warehouse"); final SplitPane splitPane = new SplitPane(paneCargo, paneWarehouse, false, skin.getStyle("default-horizontal", SplitPaneStyle.class), "split"); Window window = new Window("Vendor Screen", skin.getStyle(WindowStyle.class), "vendorwindow"); if (Stardust3d.DEBUG) window.debug(); window.x = window.y = 0; window.setFillParent(true); window.setMovable(false); window.defaults().pad(5); window.defaults().spaceBottom(5); window.row().fill().expandX(); window.add(balance); window.add(buttonClose); window.row(); window.add(cargoLabel); window.add(warehouseLabel); window.row().fill().expandY(); window.add(splitPane).colspan(2); window.pack(); stage.addActor(window); buttonClose.setClickListener(new ClickListener() { public void click(Actor actor, float x, float y) { System.out.println("inventory Close"); SoundManager.playuiclick(); Stardust3d.MyDataOp.getInventory(Integer.valueOf(Stardust3d.currencharacteruid), false); Stardust3d.stationScreen = 101; Renderer.stage.clear(); } }); }
From source file:es.eucm.ead.mockup.core.control.screens.gallery.ElementGallery.java
License:Open Source License
@Override public void create() { setPreviousScreen(Screens.PROJECT_MENU); navigationGroup = UIAssets.getNavigationGroup(); super.root = new Group(); root.setVisible(false);//w w w . j ava 2 s. c om topToolbar = new ToolBar(skin); ToolBar bottomToolbar = new ToolBar(skin); topToolbar.right(); String search = "Buscar por ...";// TODO use i18n! TextField searchtf = new TextField("", skin); searchtf.setMessageText(search); searchtf.setMaxLength(search.length()); String[] orders = new String[] { "Ordenar por ...", "nombre A-Z", "nombre Z-A", "ms recientes", "menos recientes" };// TODO use // i18n! SelectBox order = new SelectBox(orders, skin); /* filter panel */ Button applyFilter = new TextButton("Filtrar", skin); CheckBox[] tags = new CheckBox[] { new CheckBox("Almohada", skin), new CheckBox("Camilla", skin), new CheckBox("Doctor", skin), new CheckBox("Enfermera", skin), new CheckBox("Guantes", skin), new CheckBox("Habitacin", skin), new CheckBox("Hospital", skin), new CheckBox("Quirfano", skin), new CheckBox("Medicamentos", skin), new CheckBox("Mdico", skin), new CheckBox("Paciente", skin), new CheckBox("Vehculo", skin) }; Table tagList = new Table(skin); tagList.left(); tagList.defaults().left(); for (int i = 0; i < tags.length; ++i) { tagList.add(tags[i]); if (i < tags.length - 1) tagList.row(); } ScrollPane tagScroll = new ScrollPane(tagList, skin, "opaque"); final Panel filterPanel = new Panel(skin); filterPanel.setVisible(false); final float panelw = stagew * .26f, panelx = stagew - panelw; filterPanel.add(tagScroll).fill().colspan(3).left(); filterPanel.row(); filterPanel.add(applyFilter).colspan(3).expandX(); filterPanel.setBounds(panelx, topToolbar.getHeight(), panelw, stageh - topToolbar.getHeight() * 2f); Button filterButton = new TextButton("Filtrar por tags", skin); ClickListener closeFilterListenerTmp = new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { if (filterPanel.isVisible()) { mockupController.hide(filterPanel); } else { mockupController.show(filterPanel); } } }; applyFilter.addListener(closeFilterListenerTmp); filterButton.addListener(closeFilterListenerTmp); Label nombre = new Label("Galera de elementos", skin); topToolbar.add(nombre).expandX().left().padLeft(UIAssets.NAVIGATION_BUTTON_WIDTH_HEIGHT * 1.1f); topToolbar.add(order); topToolbar.add(filterButton); topToolbar.add(searchtf).width(skin.getFont("default-font").getBounds(search).width + 50); // FIXME // hardcoded // fixed // value /***/ final int COLS = 4, ROWS = 6; gridPanel = new GalleryGrid<Actor>(skin, ROWS, COLS, root, new ToolBar[] { topToolbar, bottomToolbar }) { @Override protected void entityClicked(InputEvent event) { Actor target = event.getTarget(); if (target instanceof Image) { ElementEdition.setELEMENT_INDEX((Integer) target.getUserObject()); exitAnimation(Screens.ELEMENT_EDITION); } else if (target instanceof Label) { ElementEdition.setELEMENT_INDEX(null); exitAnimation(Screens.ELEMENT_EDITION); } } }; boolean first = true; for (int i = 0; i < ROWS; ++i) { for (int j = 0; j < COLS; ++j) { if (first) { first = false; gridPanel.addItem(new TextButton("Imagen en blanco", skin), 0, 0).fill(); } else { int rand = MathUtils.random(Loading.demoElementsThumbnail.length - 1); GalleryEntity auxImg = new GalleryEntity(Loading.demoElementsThumbnail[rand]); auxImg.setUserObject(Integer.valueOf(rand)); gridPanel.addItem(auxImg, i, j);// .size(auxWidth, // auxHeight); } } } ScrollPane scrollPane = new ScrollPane(gridPanel); scrollPane.setScrollingDisabled(true, false); scrollPane.setBounds(0, topToolbar.getHeight(), stagew, stageh - 2 * topToolbar.getHeight()); final float DEFAULT_ICON_LABEL_SPACE = 10f; final Button picButton = new Button(skin); picButton.defaults().space(DEFAULT_ICON_LABEL_SPACE); Label picLabel = new Label("Nuevo desde cmara", skin); Image picImage = new Image(skin.getDrawable("ic_photocamera")); picButton.add(picImage); picButton.add(picLabel); ClickListener mTransitionLIstener = new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { final Screens next = getNextScreen(event.getListenerActor()); if (next == null) { return; } exitAnimation(next); } private Screens getNextScreen(Actor target) { Screens next = null; if (target == picButton) { next = Screens.PICTURE; } return next; } }; picButton.addListener(mTransitionLIstener); bottomToolbar.setY(0); bottomToolbar.add(picButton).expandX().left(); root.addActor(topToolbar); root.addActor(bottomToolbar); root.addActor(scrollPane); root.addActor(filterPanel); stage.addActor(root); }
From source file:es.eucm.ead.mockup.core.control.screens.gallery.Gallery.java
License:Open Source License
@Override public void create() { setPreviousScreen(Screens.PROJECT_MENU); navigationGroup = UIAssets.getNavigationGroup(); super.root = new Group(); root.setVisible(false);//ww w. j a va 2 s . c om topToolbar = new ToolBar(skin); ToolBar bottomToolbar = new ToolBar(skin); topToolbar.right(); String search = "Buscar por ...";// TODO use i18n! TextField searchtf = new TextField("", skin); searchtf.setMessageText(search); searchtf.setMaxLength(search.length()); String[] orders = new String[] { "Ordenar por ...", "nombre A-Z", "nombre Z-A", "ms recientes", "menos recientes" };// TODO use // i18n! SelectBox order = new SelectBox(orders, skin); /* filter panel */ CheckBox cbs = new CheckBox("Escenas", skin); cbs.setChecked(true); CheckBox cbe = new CheckBox("Elementos", skin); cbe.setChecked(true); CheckBox cbi = new CheckBox("Imgenes", skin); cbi.setChecked(true);// TODO use i18n! Button applyFilter = new TextButton("Filtrar", skin); CheckBox[] tags = new CheckBox[] { new CheckBox("Almohada", skin), new CheckBox("Camilla", skin), new CheckBox("Doctor", skin), new CheckBox("Enfermera", skin), new CheckBox("Guantes", skin), new CheckBox("Habitacin", skin), new CheckBox("Hospital", skin), new CheckBox("Quirfano", skin), new CheckBox("Medicamentos", skin), new CheckBox("Mdico", skin), new CheckBox("Paciente", skin), new CheckBox("Vehculo", skin) }; Table tagList = new Table(skin); tagList.left(); tagList.defaults().left(); for (int i = 0; i < tags.length; ++i) { tagList.add(tags[i]); if (i < tags.length - 1) tagList.row(); } ScrollPane tagScroll = new ScrollPane(tagList, skin, "opaque"); final Panel filterPanel = new Panel(skin); filterPanel.setVisible(false); final float panelw = stagew * .45f, panelx = stagew - panelw; filterPanel.setBounds(panelx, topToolbar.getHeight(), panelw, stageh - topToolbar.getHeight() * 2f); filterPanel.add(cbe).expandX(); filterPanel.add(cbs).expandX(); filterPanel.add(cbi).expandX(); filterPanel.row(); filterPanel.add(tagScroll).fill().colspan(3).left(); filterPanel.row(); filterPanel.add(applyFilter).colspan(3).expandX(); Button filterButton = new TextButton("Filtrar por tags", skin); ClickListener closeFilterListenerTmp = new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { if (filterPanel.isVisible()) { mockupController.hide(filterPanel); } else { mockupController.show(filterPanel); } } }; applyFilter.addListener(closeFilterListenerTmp); filterButton.addListener(closeFilterListenerTmp); Label nombre = new Label("Galera", skin); topToolbar.add(nombre).expandX().left().padLeft(UIAssets.NAVIGATION_BUTTON_WIDTH_HEIGHT * 1.1f); topToolbar.add(order); topToolbar.add(filterButton); topToolbar.add(searchtf).width(skin.getFont("default-font").getBounds(search).width + 50); // FIXME // hardcoded // fixed // value /***/ final int COLS = 4, ROWS = 6; gridPanel = new GalleryGrid<Actor>(skin, ROWS, COLS, root, new ToolBar[] { topToolbar, bottomToolbar }) { @Override protected void entityClicked(InputEvent event) { Actor target = event.getTarget(); if (target instanceof Image) { // TODO distinguish between elements and scenes String[] auxAttr = String.valueOf(target.getUserObject()).split(" "); Integer index = Integer.valueOf(auxAttr[0]); if (Boolean.valueOf(auxAttr[1])) { // isElement ElementEdition.setELEMENT_INDEX(index); exitAnimation(Screens.ELEMENT_EDITION); } else { SceneEdition.setSCENE_INDEX(index); exitAnimation(Screens.SCENE_EDITION); } } else if (target instanceof Label) { // We've clicked new from blank page... // TODO ask for choise SCENE_EDITION = true; showDialog(); } } }; boolean first = true; for (int i = 0; i < ROWS; ++i) { for (int j = 0; j < COLS; ++j) { if (first) { first = false; gridPanel.addItem(new TextButton("Crear nuevo\nen blanco", skin), 0, 0).fill(); } else { Texture tex; int rand; boolean isElement; if (MathUtils.randomBoolean()) { isElement = false; rand = MathUtils.random(Loading.demoScenesThumbnail.length - 1); tex = Loading.demoScenesThumbnail[rand]; } else { isElement = true; rand = MathUtils.random(Loading.demoElementsThumbnail.length - 1); tex = Loading.demoElementsThumbnail[rand]; } GalleryEntity auxImg = new GalleryEntity(tex); auxImg.setUserObject(rand + " " + isElement); gridPanel.addItem(auxImg, i, j); } } } ScrollPane scrollPane = new ScrollPane(gridPanel); scrollPane.setScrollingDisabled(true, false); scrollPane.setBounds(0, topToolbar.getHeight(), stagew, stageh - 2 * topToolbar.getHeight()); final float DEFAULT_ICON_LABEL_SPACE = 10f; final Button picButton = createButton("Nuevo desde cmara", "ic_photocamera", DEFAULT_ICON_LABEL_SPACE, false); final Button vidButton = createButton("Grabar desde Escena", "ic_videocamera", DEFAULT_ICON_LABEL_SPACE, true); ClickListener showDialogListener = new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { SCENE_EDITION = false; exitAnimation(Screens.PICTURE); } }; picButton.addListener(showDialogListener); vidButton.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { exitAnimation(Screens.RECORDING); } }); // Coice dialog panel mDialogPanel = new Panel(skin, "dialog"); mDialogPanel.setVisible(false); mDialogPanel.setModal(true); mDialogPanel.pad(DEFAULT_ICON_LABEL_SPACE); mDialogPanel.defaults().space(DEFAULT_ICON_LABEL_SPACE).uniform().expand().fill(); final float PANEL_W = stagew * .3f, PANEL_H = UIAssets.NAVIGATION_BUTTON_WIDTH_HEIGHT * 3f, PANEL_X = halfstagew - PANEL_W * .5F, PANEL_Y = halfstageh - PANEL_H * .5f; mDialogPanel.setBounds(PANEL_X, PANEL_Y, PANEL_W, PANEL_H); final Button newElement = createButton("Nuevo elemento", "ic_editelement", DEFAULT_ICON_LABEL_SPACE, false); final Button newScene = createButton("Escena nueva", "ic_editstage", DEFAULT_ICON_LABEL_SPACE, false); mDialogPanel.add(newScene); mDialogPanel.row(); mDialogPanel.add(newElement); ClickListener mTransitionLIstener = new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { final Screens next = getNextScreen(event.getListenerActor()); if (next == null) { return; } exitAnimation(next); } private Screens getNextScreen(Actor target) { Screens next = null; if (SCENE_EDITION) { // We've clicked NewBlankImage if (target == newElement) { next = Screens.ELEMENT_EDITION; SCENE_EDITION = false; } else if (target == newScene) { next = Screens.SCENE_EDITION; } } return next; } }; newElement.addListener(mTransitionLIstener); newScene.addListener(mTransitionLIstener); bottomToolbar.setY(0); bottomToolbar.add(picButton).expandX().left(); bottomToolbar.add(vidButton).expandX().right(); root.addActor(topToolbar); root.addActor(bottomToolbar); root.addActor(scrollPane); root.addActor(filterPanel); root.addActor(mDialogPanel); stage.addActor(root); }
From source file:es.eucm.ead.mockup.core.control.screens.gallery.SceneGallery.java
License:Open Source License
@Override public void create() { setPreviousScreen(Screens.PROJECT_MENU); navigationGroup = UIAssets.getNavigationGroup(); super.root = new Group(); root.setVisible(false);// w ww . ja v a2 s. co m topToolbar = new ToolBar(skin); ToolBar bottomToolBar = new ToolBar(skin); topToolbar.right(); String search = "Buscar por ...";// TODO use i18n! TextField searchtf = new TextField("", skin); searchtf.setMessageText(search); searchtf.setMaxLength(search.length()); String[] orders = new String[] { "Ordenar por ...", "nombre A-Z", "nombre Z-A", "ms recientes", "menos recientes" };// TODO use // i18n! SelectBox order = new SelectBox(orders, skin); /* filter panel */ Button applyFilter = new TextButton("Filtrar", skin); CheckBox[] tags = new CheckBox[] { new CheckBox("Almohada", skin), new CheckBox("Camilla", skin), new CheckBox("Doctor", skin), new CheckBox("Enfermera", skin), new CheckBox("Guantes", skin), new CheckBox("Habitacin", skin), new CheckBox("Hospital", skin), new CheckBox("Quirfano", skin), new CheckBox("Medicamentos", skin), new CheckBox("Mdico", skin), new CheckBox("Paciente", skin), new CheckBox("Vehculo", skin) }; Table tagList = new Table(skin); tagList.left(); tagList.defaults().left(); for (int i = 0; i < tags.length; ++i) { tagList.add(tags[i]); if (i < tags.length - 1) tagList.row(); } ScrollPane tagScroll = new ScrollPane(tagList, skin, "opaque"); final Panel filterPanel = new Panel(skin); filterPanel.setVisible(false); final float panelw = stagew * .26f, panelx = stagew - panelw; filterPanel.add(tagScroll).fill().colspan(3).left(); filterPanel.row(); filterPanel.add(applyFilter).colspan(3).expandX(); filterPanel.setBounds(panelx, topToolbar.getHeight(), panelw, stageh - topToolbar.getHeight() * 2f); Button filterButton = new TextButton("Filtrar por tags", skin); ClickListener closeFilterListenerTmp = new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { if (filterPanel.isVisible()) { mockupController.hide(filterPanel); } else { mockupController.show(filterPanel); } } }; applyFilter.addListener(closeFilterListenerTmp); filterButton.addListener(closeFilterListenerTmp); name = new Label("Galera de escenas", skin); topToolbar.add(name).expandX().left().padLeft(UIAssets.NAVIGATION_BUTTON_WIDTH_HEIGHT * 1.1f); topToolbar.add(order); topToolbar.add(filterButton); topToolbar.add(searchtf).width(skin.getFont("default-font").getBounds(search).width + 50); // FIXME // hardcoded // fixed // value /***/ final int COLS = 4, ROWS = 6; gridPanel = new GalleryGrid<Actor>(skin, ROWS, COLS, root, new ToolBar[] { topToolbar, bottomToolBar }) { @Override protected void entityClicked(InputEvent event) { Actor target = event.getTarget(); if (target instanceof Image) { if (ProjectMenu.getFROM_INITIAL_SCENE()) { exitAnimation(Screens.PROJECT_MENU); } else { SceneEdition.setSCENE_INDEX((Integer) target.getUserObject()); exitAnimation(Screens.SCENE_EDITION); } } else if (target instanceof Label) { SceneEdition.setSCENE_INDEX(null); exitAnimation(Screens.SCENE_EDITION); } } }; boolean first = true; for (int i = 0; i < ROWS; ++i) { for (int j = 0; j < COLS; ++j) { if (first) { first = false; gridPanel.addItem(new TextButton("Imagen en blanco", skin), 0, 0).fill(); } else { int rand = MathUtils.random(Loading.demoScenesThumbnail.length - 1); GalleryEntity auxImg = new GalleryEntity(Loading.demoScenesThumbnail[rand]); auxImg.setUserObject(Integer.valueOf(rand)); gridPanel.addItem(auxImg, i, j); } } } ScrollPane scrollPane = new ScrollPane(gridPanel); scrollPane.setScrollingDisabled(true, false); scrollPane.setBounds(0, topToolbar.getHeight(), stagew, stageh - 2 * topToolbar.getHeight()); final float DEFAULT_ICON_LABEL_SPACE = 10f; final Button picButton = new Button(skin); picButton.defaults().space(DEFAULT_ICON_LABEL_SPACE); Label picLabel = new Label("Nuevo desde cmara", skin); Image picImage = new Image(skin.getDrawable("ic_photocamera")); picButton.add(picImage); picButton.add(picLabel); final Button vidButton = new Button(skin); vidButton.defaults().space(DEFAULT_ICON_LABEL_SPACE); Label vidLabel = new Label("Grabar desde Escena", skin); Image vidImage = new Image(skin.getDrawable("ic_videocamera")); vidButton.add(vidImage); vidButton.add(vidLabel); ClickListener mTransitionLIstener = new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { final Screens next = getNextScreen(event.getListenerActor()); if (next == null) { return; } exitAnimation(next); } private Screens getNextScreen(Actor target) { Screens next = null; if (target == picButton) { next = Screens.PICTURE; } else if (target == vidButton) { next = Screens.RECORDING; } return next; } }; picButton.addListener(mTransitionLIstener); vidButton.addListener(mTransitionLIstener); bottomToolBar.setY(0); bottomToolBar.add(picButton).expandX().left(); bottomToolBar.add(vidButton).expandX().right(); root.addActor(topToolbar); root.addActor(bottomToolBar); root.addActor(scrollPane); root.addActor(filterPanel); stage.addActor(root); }
From source file:mobi.shad.s3lib.gui.GuiResource.java
License:Apache License
/** * @param widget//from www .j av a 2 s. c o m * @param name * @return */ public static ScrollPane scrollPaneTransparent(Actor widget, String name) { if (S3Constans.INFO) { S3Log.log(TAG, "Create guiScrollPaneTransparent: " + name); } ScrollPane scrollPane = new ScrollPane(widget, S3Skin.skin, "default-no-background"); scrollPane.setName(name); return scrollPane; }