下面列出了javafx.scene.control.SeparatorMenuItem#javafx.event.ActionEvent 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public void handle(ActionEvent event) {
Project project = Project.getCurrentProject();
EditProjectSettingsDialog dialog = new EditProjectSettingsDialog(project);
dialog.show();
if (dialog.wasCancelled()) {
return;
}
project.setProjectName(dialog.getProjectName());
project.setProjectDescription(dialog.getProjectDescription());
if (dialog.moveProjectDirectory()) {
try {
ApplicationManager.instance.setProjectDirectoryName(project, dialog.getProjectName());
} catch (IOException ignore) {
ResourceBundle bundle = Lang.ApplicationBundle();
new SimpleErrorDialog<>(
ArmaDialogCreator.getPrimaryStage(),
bundle.getString("Popups.EditProjectSettings.couldnt_move_project_dir_short"),
null,
new Label(bundle.getString("Popups.EditProjectSettings.couldnt_move_project_dir"))
).show();
}
}
}
@FXML
void btnStaffMgmt(ActionEvent event){
try {
AnchorPane user = FXMLLoader.load(getClass().getResource(("/sms/view/fxml/StaffManagement.fxml")));
root.getChildren().setAll(user);
}catch(IOException e){
System.out.println(e);
}
/*Parent root = null;
try {
root = FXMLLoader.load(getClass().getResource("/sms/view/fxml/StaffManagement.fxml"));
Stage stage = new Stage();
stage.setTitle("School Information");
stage.setScene(new Scene(root));
stage.getIcons().add(new Image(getClass().getResourceAsStream("/sms/other/img/HikmaLogo.jpg")));
stage.show();
} catch (IOException e) {
e.printStackTrace();
}*/
}
/**
* 画面の更新
*
* @param e ActionEvent
*/
@FXML
void update(ActionEvent e) {
List<Ship> ndockList = ShipCollection.get()
.getShipMap()
.values()
.stream()
.filter(this::filter)
.collect(Collectors.toList());
if (this.ndocksHashCode == ndockList.hashCode()) {
this.ndocks.forEach(RequireNdock::update);
} else {
this.ndocks.clear();
ndockList.stream()
.sorted(Comparator.comparing(Ship::getNdockTime, Comparator.reverseOrder()))
.map(RequireNdock::toRequireNdock)
.forEach(this.ndocks::add);
this.ndocksHashCode = ndockList.hashCode();
}
}
@Override
public void openTarget(ActionEvent event) {
try {
if (tableData == null || tableData.isEmpty()) {
return;
}
File f = new File(tableData.get(0).getFileName());
if (f.isDirectory()) {
browseURI(new File(f.getPath()).toURI());
} else {
browseURI(new File(f.getParent()).toURI());
}
recordFileOpened(f);
} catch (Exception e) {
logger.error(e.toString());
}
}
public void startRecording() {
recordAudioButton.setSelected(true);
recording = true;
// getItems().add(pb);
getItems().add(recordingPathTextField);
recordAudioButton.setText("Recording...");
recordAudioButton.setSelected(true);
recordingsHandler = new RecordButtonHandler();
recordingsHandler.passVariables("rec", pb, recordingPathTextField, recordAudioButton);
final int interval = 1000; // 1000 ms
recCount = new Timer(interval, (java.awt.event.ActionEvent e) -> {
recTime += interval;
setTime(recTime, recordAudioButton);
});
recCount.start();
}
@FXML
private void activeAction(ActionEvent event) {
ObservableList<AlarmClock> selected = alarmClocksView.getSelectionModel().getSelectedItems();
if (selected == null || selected.isEmpty()) {
return;
}
for (AlarmClock alarm : selected) {
alarm.setIsActive(true);
alarm.setStatus(AppVariables.message("Active"));
AlarmClock.calculateNextTime(alarm);
alarm.setNext(DateTools.datetimeToString(alarm.getNextTime()));
AlarmClock.scehduleAlarmClock(alarm);
}
AlarmClock.writeAlarmClocks(selected);
alarmClocksView.refresh();
activeButton.setDisable(true);
inactiveButton.setDisable(false);
}
private void onOK(final ActionEvent ignored)
{
Toggle selectedToggle = toggleGroup.getSelectedToggle();
Logging.debugPrint("selected toggle is " + selectedToggle);
if (selectedToggle != null)
{
Integer whichItemId = (Integer)selectedToggle.getUserData();
InfoFacade selectedItem = chooser.getAvailableList().getElementAt(whichItemId);
chooser.addSelected(selectedItem);
}
if (chooser.isRequireCompleteSelection() && (chooser.getRemainingSelections().get() > 0))
{
Dialog<ButtonType> alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle(chooser.getName());
alert.setContentText(LanguageBundle.getFormattedString("in_chooserRequireComplete",
chooser.getRemainingSelections().get()));
alert.showAndWait();
return;
}
chooser.commit();
committed = true;
this.dispose();
}
/**
* 保存连接
*
* @param event
*/
public void saveConnection(ActionEvent event) {
LOG.debug("执行保存数据库连接...");
DatabaseConfig config = getDatabaseConfig();
if (config == null) {
LOG.debug("连接数据库的数据为null,取消保存操作!!!");
return;
}
try {
ConfigUtil.saveDatabaseConfig(config.getConnName(), config);
getDialogStage().close();
indexController.loadTVDataBase();
LOG.debug("保存数据库连接成功!");
} catch (Exception e) {
LOG.error("保存数据库连接失败!!!" , e);
AlertUtil.showErrorAlert(e.getMessage());
}
}
/**
* バージョン情報
*
* @param e ActionEvent
*/
@FXML
void version(ActionEvent e) {
try {
InternalFXMLLoader.showWindow("logbook/gui/version.fxml", this.parentController.getWindow(), "バージョン情報",
root -> new Scene(root, Color.TRANSPARENT),
null,
stage -> {
stage.initStyle(StageStyle.TRANSPARENT);
stage.focusedProperty().addListener((ob, o, n) -> {
if (!n) {
stage.close();
}
});
});
} catch (Exception ex) {
LoggerHolder.get().error("設定の初期化に失敗しました", ex);
}
}
@FXML
private void onClose(ActionEvent actionEvent) {
if (canClose()) {
tagBoard.setModel(null);
undoManager.forgetHistory();
mediaPane.clear();
}
}
@FXML
public void updateFormInfo(ActionEvent event) throws SQLException {
String customer = customerid.getText();
String lostkoffer = lostluggageid.getText();
String deliverer = deivererid.getText();
String email = emailid.getText();
String adres = adresid.getText();
String id = this.formtextid.getText();
if (!id.isEmpty()) {
int updateInfo = DB.executeUpdateQuery("UPDATE passenger "
+ " JOIN lostluggage ON lostluggage.passengerId = passenger.passengerId "
+ " JOIN matched on lostluggage.registrationNr = matched.lostluggage "
+ " SET passenger.name = '" + customer + "', passenger.email = '" + email + "', passenger.address = '" + adres + "', matched.delivery = '" + deliverer + "' "
+ " WHERE lostluggage.registrationNr = '" + lostkoffer + "'");
alertHeader = "Updated!";
headerColor = "#f03e3e";
alert = "The delivered luggage is updated";
buttonText = "Ok";
showAlertMessage();
} else {
alertHeader = "Something went wrong!";
headerColor = "#f03e3e";
alert = "Please select a row before updating details";
buttonText = "Try again";
showAlertMessage();
}
}
@FXML
public void userGuideDesktopTools(ActionEvent event) {
try {
String link = "https://github.com/Mararsh/MyBox/releases/download/v"
+ CommonValues.AppDocVersion + "/MyBox-UserGuide-" + CommonValues.AppDocVersion
+ "-DesktopTools-" + AppVariables.getLanguage() + ".pdf";
browseURI(new URI(link));
} catch (Exception e) {
logger.error(e.toString());
}
}
private void configureTimeline() {
time.setCycleCount(Timeline.INDEFINITE);
KeyFrame keyFrame = new KeyFrame(Duration.millis(47), new EventHandler<ActionEvent>() {
public void handle(ActionEvent event) {
calculate();
}
});
time.getKeyFrames().add(keyFrame);
}
@FXML
void closeAction(ActionEvent event) {
try {
controller.removeChatObserver(chatObserver);
controller.updateClientList();
} catch (RemoteException e) {
e.printStackTrace();
}
Runtime.getRuntime().exit(0);
((Stage)btnClose.getScene().getWindow()).close();
}
/**
* Handle setting menu
*/
@FXML
private void updateSetting(ActionEvent e) throws IOException {
var dialog = new MainSettingDialog();
dialog.mainSettingProperty().setValue(context.serverSetting());
var newConfig = dialog.showAndWait();
if (newConfig.isPresent()) {
var task = new SaveSettingTask(context, newConfig.get(), context.keyStoreSetting(),
context.proxySetting());
UIUtils.runTaskWithProcessDialog(task, "append settings failed");
}
}
@FXML
private void showMainActionM(ActionEvent evt) {
MenuItem btn = (MenuItem) (evt.getSource());
String actionType;
if (btn.getText().equals("Registro de Vendas")) {
actionType = "Venda";
} else {
actionType = "Compra";
}
GUIController.getInstance().showMainActionScreen(actionType, false);
}
@FXML
private void showMainActionM(ActionEvent evt) {
MenuItem btn = (MenuItem) (evt.getSource());
String actionType;
if (btn.getText().equals("Registro de Vendas")) {
actionType = "Venda";
} else {
actionType = "Compra";
}
GUIController.getInstance().showMainActionScreen(actionType, false);
}
private void onSeqTrace(ActionEvent ae) {
ModFunc func = selectedItem.get();
if(func == null)
return;
dbgController.seqTrace(func);
ErlyBerly.showPane("Seq Trace", new SeqTraceView(dbgController.getSeqTraceLogs()));
}
/**
* 打开设置CustomProperty
*
* @param event
*/
public void onSetCustomProperty(ActionEvent event) {
SetCustomPropertyController controller = (SetCustomPropertyController) loadFXMLPage("SetCustomProperty Setting",
FXMLPage.SET_CUSTOM_PROPERTY, false);
controller.setIndexController(this);
controller.showDialogStage();
controller.init();
}
@FXML
void logOutButtonClicked(ActionEvent event) throws Exception {
Stage window = (Stage) ((Node)event.getSource()).getScene().getWindow();
window.setTitle("Login");
Parent root = FXMLLoader.load(getClass().getResource("LoginScreen.fxml"));
window.setScene(new Scene(root, ScreenSizesConstants.LoginScreenWidth, ScreenSizesConstants.LoginScreenHeight));
DBManager.initialize();
window.show();
}
public void saveProfile(ActionEvent event) {
if (application == null){
// We are running in isolated FXML, possibly in Scene Builder.
// NO-OP.
animateMessage();
return;
}
User loggedUser = application.getLoggedUser();
loggedUser.setEmail(email.getText());
loggedUser.setPhone(phone.getText());
loggedUser.setSubscribed(subscribed.isSelected());
loggedUser.setAddress(address.getText());
animateMessage();
}
public void loadDocuments(ActionEvent event) {
RememberingLatestFileChooserWrapper fileChooser = FileChoosers.getFileChooser(
DefaultI18nContext.getInstance().i18n("Select pdf documents to load"), FileType.PDF);
List<File> chosenFiles = fileChooser.showOpenMultipleDialog(this.getScene().getWindow());
if (chosenFiles != null && !chosenFiles.isEmpty()) {
PdfLoadRequestEvent loadEvent = new PdfLoadRequestEvent(getOwnerModule());
chosenFiles.stream().map(PdfDocumentDescriptor::newDescriptorNoPassword).forEach(loadEvent::add);
eventStudio().broadcast(loadEvent, getOwnerModule());
}
}
@FXML
private void loadNeuralNetwork(ActionEvent event) {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Select Neural Network");
nnetSrc = fileChooser.showOpenDialog(rootPane.getScene().getWindow());
if (nnetSrc != null) {
nnIndicator.setSelected(true);
}
}
@FXML
private void opentomp2p(ActionEvent event) {
String tomp2p = "http://tomp2p.net/";
try {
BrowserUtils.openURL(tomp2p);
} catch (Exception e) {
logger.warn("Could not open TomP2P URL: '{}'", tomp2p, e);
}
}
@FXML
void pauseClicked(ActionEvent event) {
Application.invokeLater(() -> {
if (Emulator.computer.isRunning()) {
Emulator.computer.pause();
} else {
Emulator.computer.resume();
}
});
}
/**
* 添加自定义属性
*
* @param event
*/
public void onAddPropertyToTable(ActionEvent event) {
LOG.debug("执行添加自定义属性...");
TableAttributeKeyValue attribute = new TableAttributeKeyValue(txtKey.getText(), txtValue.getText(), txtDescribe.getText());
tblPropertyValues.add(attribute);
LOG.debug("添加自定义属性-->成功!");
}
public void upPriority(ActionEvent fxevent){
if (awardCategory.getPriority()> 0) {
awardCategory.getRaceAward().awardCategoriesProperty().remove(awardCategory);
awardCategory.getRaceAward().awardCategoriesProperty().add(awardCategory.getPriority()-1, awardCategory);
awardCategory.getRaceAward().recalcPriorities();
awardCategory.getRaceAward().awardCategoriesProperty().forEach(a -> raceDAO.updateAwardCategory(a));
}
}
@FXML
public void newOrderButtonClicked(ActionEvent event) throws Exception {
Stage window = (Stage) ((Node)event.getSource()).getScene().getWindow();
window.setTitle("New Order");
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("ChooseParkingSlotScreen.fxml"));
Parent root = (Parent)fxmlLoader.load();
ChooseParkingSlotController controller = fxmlLoader.<ChooseParkingSlotController>getController();
controller.setUserId(userId);
window.setScene(new Scene(root, ScreenSizesConstants.MapScreenWidth, ScreenSizesConstants.MapScreenHeight));
window.show();
}
@FxThread
@Override
protected void execute(@Nullable ActionEvent event) {
super.execute(event);
var newEvent = new RequestedOpenFileEvent(getElement().getFile());
newEvent.setDescription(description);
FX_EVENT_MANAGER.notify(newEvent);
}
/**
* キャプチャ
*
* @param e ActionEvent
*/
@FXML
void capture(ActionEvent e) {
try {
InternalFXMLLoader.showWindow("logbook/gui/capture.fxml", this.parentController.getWindow(), "キャプチャ");
} catch (Exception ex) {
LoggerHolder.get().error("キャプチャの初期化に失敗しました", ex);
}
}