/** * Mostra la finestra per impostare le preferenze dell'animazione. * @param e evento scatenante. * @return Void. */ public static Void showPrefWindow(Event e) { try { Parent root = FXMLLoader.load(Singleton.getInstance().mainViewController.getClass().getResource("applicationSettingsView.fxml")); Stage stage = new Stage(); stage.setTitle("Animation Settings"); stage.setScene(new Scene(root, 400, 150)); stage.show(); stage.setResizable(false); } catch (IOException exc) { exc.printStackTrace(); } return null; }
public void getAllRelations(){ log.debug("in get all relations."); for(Npc n: (List<Npc>)(List<?>)npcRelation.getList()){ log.debug("\t" + n.getID()); } region.setInteractions(new ArrayList<Interaction>((List<Interaction>)(List<?>)interactionController.getAllInteractions())); region.setGods(new ArrayList<God>((List<God>)(List<?>)godRelation.getList())); region.setNpcs(new ArrayList<Npc>((List<Npc>)(List<?>)npcRelation.getList())); region.setSubRegions(new ArrayList<Region>((List<Region>)(List<?>)regionRelation.getList())); region.setEvents(new ArrayList<com.forj.fwm.entity.Event>((List<com.forj.fwm.entity.Event>)(List<?>)eventRelation.getList())); region.setTemplates(new ArrayList<Template>((List<Template>)(List<?>)templateRelation.getList())); if (!superRelation.getList().isEmpty()){ Region newRegion = (new ArrayList<Region>((List<Region>)(List<?>)superRelation.getList())).get(0); region.setSuperRegion(newRegion); log.debug("spitting out super region IDS."); log.debug(newRegion.getID()); } log.debug("spitting out sub region IDS."); for(Region r: region.getSubRegions()){ log.debug(r.getID()); } }
private void addMemberAction(Event e) { AddMemberDialog dialog = new AddMemberDialog(organization); Optional<Member> result = dialog.showAndWait(); if (result.isPresent()) { try { organization.addMember(result.get().getId()); forceUpdateMemberList(); } catch (JSONException | WebApiException | IOException | HttpException e1) { ErrorUtils.getAlertFromException(e1).show(); e1.printStackTrace(); } } }
private void removeAction(Event e) { Alert conf = new Alert(AlertType.CONFIRMATION, "Do you really want to delete this organization ?\n" + "Every server and member association will be lost."); Optional<ButtonType> result = conf.showAndWait(); if (result.isPresent() && result.get().equals(ButtonType.OK)) { try { wsp.removeOrganization(orgas.selectionModelProperty().get().getSelectedItem().getOrganization()); forceOrganizationListRefresh(); App.getCurrentInstance().refreshWSPTabs(); } catch(Exception e1) { ErrorUtils.getAlertFromException(e1).show(); } } }
private void searchAction(Event e) { String query = queryField.getText(); searchList.clear(); try { List<Member> orgaMemberList = organization.getMemberList(); ArrayList<MemberView> result = new ArrayList<>(organization.getWsp().searchMembers(query, 0, RESULT_SIZE).stream().map(m -> new MemberView(m)).collect(Collectors.toList())); result.forEach(mv -> { if (!orgaMemberList.stream().anyMatch(m -> m.getId() == mv.getId())) { searchList.add(mv); } }); resultCount.setText(getResultCountText(searchList.size())); } catch (JSONException | IOException | HttpException | WebApiException e1) { new Alert(AlertType.ERROR, "Error while fetching member list. " + e1.getClass() + " : " + e1.getMessage()).show(); e1.printStackTrace(); } }
private void editWSPAction(Event e) { EditWSPDialog dialog = new EditWSPDialog(wsp); Optional<WebServiceProvider> result = dialog.showAndWait(); if (result.isPresent()) { try { wsp = result.get(); wsp.fetchConfiguration(); writeWSP(wsp); } catch (JSONException | WebApiException | IOException | HttpException e1) { Alert a = ErrorUtils.getAlertFromException(e1); a.show(); e1.printStackTrace(); } } else { new Alert(AlertType.ERROR, "Wrong WSP information"); } }
@FXThread private void handleRequestToCloseEditor(@NotNull final FileEditor editor, @NotNull final Tab tab, @NotNull final Event event) { if (!editor.isDirty()) { return; } final String question = Messages.EDITOR_AREA_SAVE_FILE_QUESTION.replace("%file_name%", editor.getFileName()); final ConfirmDialog dialog = new ConfirmDialog(result -> { if (result == null) return; if (result) { editor.save(fileEditor -> getTabs().remove(tab)); } else { getTabs().remove(tab); } }, question); dialog.show(); event.consume(); }
public void changeHiddenPower(Event event) { if (event instanceof MouseEvent) { MouseEvent mouseEvent = (MouseEvent) event; MouseButton mouseButton = mouseEvent.getButton(); if (mouseEvent.isShiftDown() || mouseButton.equals(MouseButton.SECONDARY)) { pokemon.setHiddenPower(hiddenPowerCalculator.updateToNext()); } else if (mouseButton.equals(MouseButton.PRIMARY)) { pokemon.setHiddenPower(hiddenPowerCalculator.updateToPrevious()); } else if (mouseButton.equals(MouseButton.MIDDLE)) { pokemon.setHiddenPower(hiddenPowerCalculator.setUnknown()); } } else if (event instanceof ScrollEvent) { double delta = ((ScrollEvent) event).getDeltaY(); if (delta > 0) { pokemon.setHiddenPower(hiddenPowerCalculator.updateToNext()); } else if (delta < 0) { pokemon.setHiddenPower(hiddenPowerCalculator.updateToPrevious()); } } }
/** * Öffnet ein Fenster mit einer Hilfe * @param e Das Event * @param type Die Hilfe, die angezeigt werden soll */ public void presentHelpWindow(Event e, HelpType type) { try { FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource("helpWindow.fxml")); AnchorPane root = (AnchorPane)loader.load(); helpController = loader.getController(); helpController.setType(type); helpStage = new Stage(); helpStage.setResizable(false); helpStage.setTitle("Vier Gewinnt Hilfe"); helpStage.setScene(new Scene(root)); helpStage.show(); helpController.display(); } catch (IOException exception) { exception.printStackTrace(); } }
/** * Zeigt den Connect-Dialog an * @param e Das Event */ public void presentConnectToServerWindow(Event e) { try { FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource("connectToServer.fxml")); GridPane root = (GridPane)loader.load(); connectToServerController = loader.getController(); connectToServerController.setCompletedRunnable((run) -> { /*String ip = connectToServerController.getIpAdressTextField().getText(); String port = connectToServerController.getPortTextField().getText();*/ String ip = (String) UserDefaults.sharedDefaults().valueForKey(UserDefaults.ADRESS_KEY); int port = (int) UserDefaults.sharedDefaults().valueForKey(UserDefaults.PORT_KEY); String userID = (String)UserDefaults.sharedDefaults().valueForKey(UserDefaults.NAME_KEY); this.client = new Client(ip, port, userID); this.client.setDelegate(this); this.client.connect(); connectToServerCallback = run; }); connectToServerStage = new Stage(); connectToServerStage.setResizable(false); connectToServerStage.setTitle("Connect to server"); connectToServerStage.setScene(new Scene(root)); connectToServerStage.show(); } catch (IOException e1) { e1.printStackTrace(); } }
/** * Esegue uno step dell'animazione * @param e evento per cui è stato richiamato il metodo. * @return Void */ public static Void nextStep(Event e) { if (!Singleton.getInstance().isAnimating) return null; // ottengo il thread GraphVisiter bfs = (GraphVisiter) Singleton.getInstance().getThreadByName(AnimationSettings.THREAD_NAME); // se il thread esiste ed è ancora in esecuzione, lo riprendo if (bfs != null && bfs.isAlive()) { synchronized (bfs) { bfs.notify(); } } return null; }
/** * Create editor area pane. */ @FXThread protected void createEditorAreaPane() { editorAreaPane = new StackPane(); editorAreaPane.setOnDragOver(this::handleDragOverEvent); editorAreaPane.setOnDragDropped(this::handleDragDroppedEvent); editor3DArea = new BorderPane(); editor3DArea.setOnMousePressed(event -> editor3DArea.requestFocus()); editor3DArea.setOnKeyReleased(Event::consume); editor3DArea.setOnKeyPressed(Event::consume); FXUtils.addToPane(editor3DArea, editorAreaPane); FXUtils.addClassTo(editorAreaPane, CSSClasses.FILE_EDITOR_EDITOR_AREA); }
@Override public Optional<ButtonType> delete(Optional<ButtonType> option) { if (!option.isPresent() || option.get() != FXUIUtils.YES_ALL) { option = FXUIUtils.showConfirmDialog(null, "Do you want to delete the entry `" + entry.getName() + "`?", "Confirm", AlertType.CONFIRMATION, ButtonType.YES, ButtonType.NO, FXUIUtils.YES_ALL, ButtonType.CANCEL); } if (option.isPresent() && (option.get() == ButtonType.YES || option.get() == FXUIUtils.YES_ALL)) { GroupResource parent = (GroupResource) getParent(); parent.deleteEntry(this); try { Group.updateFile(parent.getSuite()); Event.fireEvent(parent, new ResourceModificationEvent(ResourceModificationEvent.UPDATE, parent)); } catch (IOException e) { e.printStackTrace(); return option; } } return option; }
private EventHandler<Event> buildEvent() { return e -> { // if((e.getEventType() == MouseEvent.MOUSE_ENTERED_TARGET ||e.getEventType() == MouseEvent.MOUSE_ENTERED || // e.getEventType() == MouseEvent.MOUSE_MOVED || e.getEventType() == GazeEvent.GAZE_ENTERED || // e.getEventType() == GazeEvent.GAZE_MOVED) && anniOff) { if (animationStopped && (e.getEventType() == MouseEvent.MOUSE_ENTERED || e.getEventType() == GazeEvent.GAZE_ENTERED)) { animationStopped = false; enter(e); } }; }
@FXML public void startImport(Event event) { config.setBlockEnd(blockEnd.getText()); config.setStartBlock(blockStart.getText()); config.setBlockIndex(blockIndex.getText()); config.setTxIndex(txIndex.getText()); config.setBlockImport(importBlocks.isSelected()); config.setTxImport(importTx.isSelected()); config.setIpc(endpoint.getText()); config.setStorage( ApplicationConfig.StorageType.valueOf( storageType.getSelectionModel().getSelectedItem())); config.save(); if (config.isBlockImport() || config.isTxImport()) { Async.setScene(IMPORTING_FXML); } else { Form.showInfoAlert( "Configuration", "Nothing selected for import, please select to import blocks or transactions."); } }
public ColorPickerSample() { final ColorPicker colorPicker = new ColorPicker(Color.GRAY); ToolBar standardToolbar = ToolBarBuilder.create().items(colorPicker).build(); final Text coloredText = new Text("Colors"); Font font = new Font(53); coloredText.setFont(font); final Button coloredButton = new Button("Colored Control"); Color c = colorPicker.getValue(); coloredText.setFill(c); coloredButton.setStyle(createRGBString(c)); colorPicker.setOnAction(new EventHandler() { public void handle(Event t) { Color newColor = colorPicker.getValue(); coloredText.setFill(newColor); coloredButton.setStyle(createRGBString(newColor)); } }); VBox coloredObjectsVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(20).children(coloredText, coloredButton).build(); VBox outerVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(150).padding(new Insets(0, 0, 120, 0)).children(standardToolbar, coloredObjectsVBox).build(); getChildren().add(outerVBox); }
private void openTwitch(Event event) { DirectoryChooser chooser = new DirectoryChooser(); if (OperatingSystem.isWindows()) { File twitch = new File(System.getenv("APPDATA"), "Twitch/"); JsonObject settings = JsonUtil.read(new File(twitch, "Minecraft.settings"), JsonObject.class); File instances = new File(settings.get("InstanceRoot").getAsString()); OneClientLogging.info("{}", instances); chooser.setInitialDirectory(instances); } File directory = chooser.showDialog(null); if (directory != null) { findTwitch(directory); } }
public void startRelationalList() throws Exception { fam.clear(); fam.addAll(Backend.getNpcDao().getFamily(npc)); accordion.getPanes().clear(); npcRelation = RelationalList.createRelationalList(this, App.toListSearchable(fam), "Family", false, false, tabType, SearchList.EntitiesToSearch.NPC); accordion.getPanes().add((TitledPane) npcRelation.getOurRoot()); eventRelation = RelationalList.createRelationalList(this, App.toListSearchable(npc.getEvents()), com.forj.fwm.entity.Event.WHAT_IT_DO + "s", true, true, tabType, SearchList.EntitiesToSearch.EVENT); accordion.getPanes().add((TitledPane) eventRelation.getOurRoot()); regionRelation = RelationalList.createRelationalList(this, App.toListSearchable(npc.getRegions()), "Regions", true, true, tabType, SearchList.EntitiesToSearch.REGION); accordion.getPanes().add((TitledPane) regionRelation.getOurRoot()); myGod.clear(); if (npc.getGod() != null){ if (!Backend.getGodDao().queryForEq("ID", npc.getGod().getID()).isEmpty()){ npc.getGod().setName(Backend.getGodDao().queryForEq("ID", npc.getGod().getID()).get(0).getName()); npc.getGod().setImageFileName(Backend.getGodDao().queryForEq("ID", npc.getGod().getID()).get(0).getImageFileName()); myGod.add(npc.getGod()); } } godRelation = RelationalField.createRelationalList(this, App.toListSearchable(myGod), "God", true, true, tabType, SearchList.EntitiesToSearch.GOD); godPane.getChildren().add(godRelation.getOurRoot()); }
public void addRowComment(Event event) { int index = tableView.getSelectionModel().getSelectedIndex(); if (index < 0) { return; } TableColumn<HybridRow, ?> tableColumn = tableView.getColumns().get(1); CommentPopOverManager popOverManager = new CommentPopOverManager(hybridSpec.getRows().get(index), hybridSpec.isEditable(), tableColumn.getGraphic(), 0, 200); }
public void startRelationalList() throws Exception { log.debug("god.getNpcs.size: " + god.getNpcs().size()); panth.clear(); panth.addAll(Backend.getGodDao().getPantheon(god)); accordion.getPanes().clear(); npcRelation = RelationalList.createRelationalList(this, App.toListSearchable(god.getNpcs()), "Worshippers", true, true, tabType, SearchList.EntitiesToSearch.NPC); accordion.getPanes().add((TitledPane) npcRelation.getOurRoot()); godRelation = RelationalList.createRelationalList(this, App.toListSearchable(panth), "Pantheon", false, false, tabType, SearchList.EntitiesToSearch.GOD); accordion.getPanes().add((TitledPane) godRelation.getOurRoot()); eventRelation = RelationalList.createRelationalList(this, App.toListSearchable(god.getEvents()), com.forj.fwm.entity.Event.WHAT_IT_DO + "s", true, true, tabType, SearchList.EntitiesToSearch.EVENT); accordion.getPanes().add((TitledPane) eventRelation.getOurRoot()); regionRelation = RelationalList.createRelationalList(this, App.toListSearchable(god.getRegions()), "Regions", true, true, tabType, SearchList.EntitiesToSearch.REGION); accordion.getPanes().add((TitledPane) regionRelation.getOurRoot()); templateRelation = RelationalList.createRelationalList(this, App.toListSearchable(god.getTemplates()), "Templates", true, true, tabType, SearchList.EntitiesToSearch.TEMPLATE); accordion.getPanes().add((TitledPane) templateRelation.getOurRoot()); }
public Lighting(int x, int y, int pixelWidth, int lightingLength, Color lightingColor) { X = x; Y = y; this.lightingLength = lightingLength * 1000; this.lightingColor = lightingColor; pixel = new Rectangle(x, y, pixelWidth, pixelWidth); // pixel.setFill(new Color(Math.random(), Math.random(), Math.random(), 1)); pixel.setFill(Color.BLACK); this.getChildren().add(pixel); enterEvent = new EventHandler<Event>() { @Override public void handle(Event e) { if ((e.getEventType() == MouseEvent.MOUSE_ENTERED || e.getEventType() == MouseEvent.MOUSE_MOVED || e.getEventType() == GazeEvent.GAZE_ENTERED || e.getEventType() == GazeEvent.GAZE_MOVED)) { enter(); } } }; this.addEventFilter(MouseEvent.ANY, enterEvent); this.addEventHandler(GazeEvent.ANY, enterEvent); }
/** * Inizializzazione dei dati del Singleton e dei gestori di eventi della finestra. * @param stage scena principale. */ private void initData(Stage stage) { Singleton.getInstance().setCurrentGraph(new Graph<CoordinateNode>()); Singleton.getInstance().animPrefs = new AnimationSettings(); // imposto l'icona dell'applicazione // non funziona ancora madonna postina stage.getIcons().add(new Image("file:resources/images/logo.png")); // gestore per gli eventi scatenati dalla pressione di un tasto della tastiera stage.addEventHandler(KeyEvent.KEY_PRESSED, (KeyEvent event) -> { if (!event.isControlDown()) return; Function<Event, Void> handler = null; switch(event.getCode()) { case N: handler = MainController::nextStep; handler.apply(event); break; // sia nel caso S che nel caso R chiamo il metodo run // sarà poi compito di quel metodo di discriminare i due casi case S: case R: handler = MainController::run; handler.apply(event); break; case P: handler = MainController::showPrefWindow; handler.apply(event); case X: handler = MainController::stop; handler.apply(event); break; default: break; } }); }
public void startRelationalList() throws Exception { superList.clear(); if (region.getSuperRegion() != null){ if (!Backend.getRegionDao().queryForEq("ID", region.getSuperRegion().getID()).isEmpty()) { region.getSuperRegion().setName(Backend.getRegionDao().queryForEq("ID", region.getSuperRegion().getID()).get(0).getName()); superList.add(region.getSuperRegion()); } } superRelation = RelationalField.createRelationalList(this, App.toListSearchable(superList), "Super Region", true, true, tabType, SearchList.EntitiesToSearch.REGION); superRegionPane.getChildren().add(superRelation.getOurRoot()); accordion.getPanes().clear(); regionRelation = RelationalList.createRelationalList(this, App.toListSearchable(region.getSubRegions()), "Sub Regions", true, true, tabType, SearchList.EntitiesToSearch.REGION); accordion.getPanes().add((TitledPane) regionRelation.getOurRoot()); npcRelation = RelationalList.createRelationalList(this, App.toListSearchable(region.getNpcs()), "NPCs", true, true, tabType, SearchList.EntitiesToSearch.NPC); accordion.getPanes().add((TitledPane) npcRelation.getOurRoot()); godRelation = RelationalList.createRelationalList(this, App.toListSearchable(region.getGods()), "Gods", true, true, tabType, SearchList.EntitiesToSearch.GOD); accordion.getPanes().add((TitledPane) godRelation.getOurRoot()); eventRelation = RelationalList.createRelationalList(this, App.toListSearchable(region.getEvents()), com.forj.fwm.entity.Event.WHAT_IT_DO + "s", true, true, tabType, SearchList.EntitiesToSearch.EVENT); accordion.getPanes().add((TitledPane) eventRelation.getOurRoot()); templateRelation = RelationalList.createRelationalList(this, App.toListSearchable(region.getTemplates()), "Templates", true, true, tabType, SearchList.EntitiesToSearch.TEMPLATE); accordion.getPanes().add((TitledPane) templateRelation.getOurRoot()); }
@FXML public void newFromTemplate() throws Exception{ Npc n = template.newFromTemplate(); n.setEvents(new ArrayList<com.forj.fwm.entity.Event>()); n.setInteractions(new ArrayList<Interaction>()); n.setRegions(new ArrayList<Region>()); open.open(n); }
@FXML protected void bakersDozenButtonClick(Event e) throws IOException { Node node = (Node) e.getSource(); Stage main = (Stage) node.getScene().getWindow(); Parent bakersDozenFXML = FXMLLoader.load(getClass().getResource("/fxml/bakersDozenGame.fxml")); bakersDozenFXML.getStylesheets().add("/stylesheets/bakersDozenGame.css"); Scene bakersDozenScene = new Scene(bakersDozenFXML); main.setOnCloseRequest(b -> { boolean response = ExitWindow.display("Confirm", "Are you sure you want to quit now?"); if(response) main.close(); b.consume(); }); main.setScene(bakersDozenScene); main.show(); }
@Override protected void editButtonAction(Event e) { EditServerDialog dial = new EditServerDialog(server); Optional<LocalServer> result = dial.showAndWait(); if (result.isPresent()) { server.changeInformations(result.get()); serverInfo.refreshAll(); this.setText(server.getName()); tabs.writeServerList(); } }
public void connectButtonAction(Event e) { connectButton.setText("Connection..."); connectButton.setDisable(true); piConnect.setVisible(true); editButton.setDisable(true); Pool.submit(() -> { Exception lastException = null; for (int i = 0; i < CONNECTION_ATTEMPS; i++) { try { connect(); break; } catch (Exception e1) { e1.printStackTrace(); lastException = e1; } } if (!server.isConnected()) { switchToDisconnected(); Alert alert = ErrorUtils.newErrorAlert("Server connection error", "Connection to \"" + server + "\" has failed.", lastException.getClass() + " : " + lastException.getMessage()); alert.show(); } Platform.runLater(() -> { connectButton.setText("Connect"); connectButton.setDisable(false); piConnect.setVisible(false); editButton.setDisable(false); tabs.refreshButtonAvailability(this); }); }); }
@FXML private void showModPopup(Event event) throws IOException { ModDataRow current = mods.getCurrent(); if (current == null) { return; } getPopup().setTitle("Description: " + current.getName()); description.getEngine().loadContent(current.getDescription()); getPopup().showAndWait(); }
private void enableKitsAction(Event e) { try { tab.getServer().enableAllKits(); } catch (RCONServerException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } }
private void disableKitsAction(Event e) { try { tab.getServer().disableAllKits(); } catch (RCONServerException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } }
private void changeMapAction(Event e) { MapSelectorDialog dial = new MapSelectorDialog("Map selector"); Optional<String> result = dial.showAndWait(); if (result.isPresent()) { try { tab.getServer().changeMap(result.get()); } catch (RCONServerException e1) { logError(e1); } } }
private void resetSlomoAction(Event e) { try { tab.getServer().resetSlomo(); } catch (RCONServerException e1) { logError(e1); } }
private void sendManualCommandAction(Event e) { String cmd = manualCommandField.getText().trim(); if (!cmd.isEmpty()) { addLog("> " + cmd); try { tab.getServer().executeCommand(cmd, false); } catch (RCONServerException e1) { logError(e1); } manualCommandField.setText(""); } }
@Override @BackgroundThread protected void readImpl(@NotNull final ConnectionOwner owner, @NotNull final ByteBuffer buffer) { final Path assetPath = Paths.get(readString(buffer)); final Path fileToOpen = Paths.get(readString(buffer)); final EditorConfig editorConfig = EditorConfig.getInstance(); final Path currentAsset = editorConfig.getCurrentAsset(); if (currentAsset != null && assetPath.equals(currentAsset)) { EXECUTOR_MANAGER.addFXTask(() -> openFile(fileToOpen)); } else { EXECUTOR_MANAGER.addFXTask(() -> { final OpenAssetAction action = new OpenAssetAction(); action.openAssetFolder(assetPath); final EventHandler<Event> eventHandler = new EventHandler<Event>() { @Override public void handle(final Event event) { FX_EVENT_MANAGER.removeEventHandler(AssetComponentLoadedEvent.EVENT_TYPE, this); openFile(fileToOpen); } }; FX_EVENT_MANAGER.addEventHandler(AssetComponentLoadedEvent.EVENT_TYPE, eventHandler); }); } }
/** * Constructor for all SkinBase instances. * * @param control The control for which this Skin should attach to. */ public LogPaneSkin(LogPane control, TableView<LogItem> table) { super(control); TextArea textArea = new TextArea(); textArea.addEventFilter(KeyEvent.ANY, Event::consume); BorderPane tablePane = new BorderPane(); tablePane.setTop(createToolBar()); tablePane.setCenter(table); MasterDetailPane container = new MasterDetailPane(); container.setMasterNode(tablePane); container.setDetailNode(textArea); container.setDetailSide(Side.RIGHT); container.setDividerPosition(0.65); container.setShowDetailNode(false); control.getSelectedItems().addListener((Observable obs) -> { List<LogItem> item = control.getSelectedItems(); if (item == null || item.isEmpty() || item.size() > 1 || item.get(0).getException() == null) { textArea.setText(null); container.setShowDetailNode(false); } else { StringWriter stackTraceWriter = new StringWriter(); item.get(0).getException().printStackTrace(new PrintWriter(stackTraceWriter)); textArea.setText(stackTraceWriter.toString()); container.setShowDetailNode(true); } }); getChildren().add(container); }
public Target(RandomPositionGenerator randomPositionGenerator, Hand hand, Stats stats, Image[] availableImages) { super(radius, randomPositionGenerator, availableImages); this.randomPositionGenerator = randomPositionGenerator; this.hand = hand; this.availableImages = availableImages; this.stats = stats; enterEvent = new EventHandler<Event>() { @Override public void handle(Event e) { if ((e.getEventType() == MouseEvent.MOUSE_ENTERED || e.getEventType() == MouseEvent.MOUSE_MOVED || e.getEventType() == GazeEvent.GAZE_ENTERED || e.getEventType() == GazeEvent.GAZE_MOVED) && anniOff) { anniOff = false; stats.incNbGoals(); enter(); } } }; GazeUtils.addEventFilter(this); this.addEventFilter(MouseEvent.ANY, enterEvent); this.addEventFilter(GazeEvent.ANY, enterEvent); stats.start(); }
private void editServerAction(Event e) { ServerView selectedServer = serverTable.selectionModelProperty().get().getSelectedItem(); if (selectedServer == null) { new Alert(AlertType.ERROR, "No selected server.").show(); return; } EditServerDialog dialog = new EditServerDialog(new LocalServer(selectedServer.getName(), selectedServer.getServer().getAddress(), selectedServer.getServer().getPort(), "")); Optional<LocalServer> result = dialog.showAndWait(); if (result.isPresent()) { try { organization.editServer(selectedServer.getServer().getServerId(), result.get()); oms.forceOrganizationListRefresh(); forceUpdateServerList(); App.getCurrentInstance().refreshWSPTabs(); serverTable.refresh(); } catch(Exception e1) { ErrorUtils.getAlertFromException(e1).show(); } } }
public static ConfigurationButton createConfigurationButton(ConfigurationContext configurationContext) { ConfigurationButton configurationButton = new ConfigurationButton(); configurationButton.addEventHandler(MouseEvent.MOUSE_CLICKED, (EventHandler<Event>) e -> { configurationContext.getGazePlay().onDisplayConfigurationManagement(configurationContext); }); return configurationButton; }
@SuppressWarnings({ "rawtypes", "unchecked" }) private void setAnimation(){ // Initially hiding the Top Pane clipRect = new Rectangle(); clipRect.setWidth(boxBounds.getWidth()); clipRect.setHeight(0); clipRect.translateYProperty().set(boxBounds.getWidth()); laytable.setClip(clipRect); laytable.translateYProperty().set(-boxBounds.getWidth()); // Animation for bouncing effect. final Timeline timelineBounce = new Timeline(); timelineBounce.setCycleCount(2); timelineBounce.setAutoReverse(true); final KeyValue kv1 = new KeyValue(clipRect.heightProperty(), (boxBounds.getHeight()-15)); final KeyValue kv2 = new KeyValue(clipRect.translateYProperty(), 15); final KeyValue kv3 = new KeyValue(laytable.translateYProperty(), -15); final KeyFrame kf1 = new KeyFrame(Duration.millis(100), kv1, kv2, kv3); timelineBounce.getKeyFrames().add(kf1); // Event handler to call bouncing effect after the scroll down is finished. EventHandler onFinished = new EventHandler() { @Override public void handle(Event event) { timelineBounce.play(); } }; timelineDown = new Timeline(); timelineUp = new Timeline(); // Animation for scroll down. timelineDown.setCycleCount(1); timelineDown.setAutoReverse(true); final KeyValue kvDwn1 = new KeyValue(clipRect.heightProperty(), boxBounds.getWidth()); final KeyValue kvDwn2 = new KeyValue(clipRect.translateYProperty(), 0); final KeyValue kvDwn3 = new KeyValue(laytable.translateYProperty(), 0); final KeyFrame kfDwn = new KeyFrame(Duration.millis(1000), onFinished, kvDwn1, kvDwn2, kvDwn3); timelineDown.getKeyFrames().add(kfDwn); // Animation for scroll up. timelineUp.setCycleCount(1); timelineUp.setAutoReverse(true); final KeyValue kvUp1 = new KeyValue(clipRect.heightProperty(), 0); final KeyValue kvUp2 = new KeyValue(clipRect.translateYProperty(), boxBounds.getHeight()); final KeyValue kvUp3 = new KeyValue(laytable.translateYProperty(), -boxBounds.getHeight()); final KeyFrame kfUp = new KeyFrame(Duration.millis(1000), kvUp1, kvUp2, kvUp3); timelineUp.getKeyFrames().add(kfUp); }
@FXML public void refreshGameList(Event e) { if (this.client.isConnected()) { this.client.enqueueTask(new CommunicationTask(new ClientMessage("info", "requestGames", new ArrayList<>()), (success, response) -> { if (success && response.getDomain().equals("success")) { handleGameRequestResponse(success, response); } })); } }