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


Java HostServices类代码示例

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


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

示例1: showPackageContents

import javafx.application.HostServices; //导入依赖的package包/类
private void showPackageContents(PackageContents packageContents) {
    packageConfirmPanel.setVisible(false);
    downloadingPane.setVisible(false);
    analysisPane.setVisible(true);
    pkgContents = packageContents;

    downloadFileLabel.setText(packageContents.getFile().getPath());
    fileCountLabel.setText(String.valueOf(packageContents.getFileCount()));
    folderCountLabel.setText(String.valueOf(packageContents.getFolderCount()));
    rootSummaryTable.setItems(FXCollections.observableArrayList(packageContents.getBaseCounts().entrySet()));
    typeSummaryTable.setItems(FXCollections.observableArrayList(packageContents.getFilesByType().entrySet()));

    downloadFileLabel.setOnMouseClicked(evt -> {
        if (evt.getButton() == MouseButton.PRIMARY && evt.getClickCount() == 2) {
            String path;
            if (evt.isShiftDown() || evt.isControlDown()) {
                path = packageContents.getFile().getParent();
            } else {
                path = packageContents.getFile().getPath();
            }
            HostServices services = ApplicationState.getInstance().getApplication().getHostServices();
            services.showDocument(path);
        }
    });
}
 
开发者ID:Adobe-Consulting-Services,项目名称:aem-epic-tool,代码行数:26,代码来源:PackageInfoController.java

示例2: showAboutView

import javafx.application.HostServices; //导入依赖的package包/类
/**
 * Shows the about view in a separate window.
 *
 * @param theme the theme to be applied.
 * @param hostServices the host services to be aggregated.
 * @return the controller for the view.
 */
static AboutViewController showAboutView(CSS.Theme theme, HostServices hostServices) {

    if (hostServices == null) {
        throw new NullPointerException("Host services must not be null.");
    }

    FXMLLoader fxmlLoader = initFXMLLoader(ABOUT_VIEW_RES);
    AboutViewController controller = new AboutViewController(theme, hostServices);
    fxmlLoader.setController(controller);

    final Stage aboutView = new Stage();
    aboutView.initModality(Modality.APPLICATION_MODAL);
    controller.setPrimaryStage(aboutView);

    try {
        aboutView.getIcons().add(BaseController._frameImage);
        aboutView.setTitle(I18N.getString("aboutViewTitle.text"));
        aboutView.setScene(loadScene(fxmlLoader, theme));
        aboutView.showAndWait();
    } catch (IOException ex) {
        handleErrorLoadingView(ex, theme);
    }
    return controller;
}
 
开发者ID:turbolocust,项目名称:GZipper,代码行数:32,代码来源:ViewControllers.java

示例3: StartUpView

import javafx.application.HostServices; //导入依赖的package包/类
public StartUpView( HostServices hostServices,
                    Stage stage,
                    Consumer<File> openFile ) {
    VBox box = new AboutLogFXView( hostServices ).createNode();

    String metaKey = FxUtils.isMac() ? "⌘" : "Ctrl+";

    Hyperlink link = new Hyperlink( String.format( "Open file (%sO)", metaKey ) );
    link.getStyleClass().add( "large-background-text" );
    link.setOnAction( ( event ) -> new FileOpener( stage, openFile ) );

    Text dropText = new Text( "Or drop files here" );
    dropText.getStyleClass().add( "large-background-text" );

    StackPane fileDropPane = new StackPane( dropText );
    fileDropPane.getStyleClass().add("drop-file-pane");

    FileDragAndDrop.install( fileDropPane, openFile );

    box.getChildren().addAll( link, fileDropPane );
    getChildren().addAll( box );
}
 
开发者ID:renatoathaydes,项目名称:LogFX,代码行数:23,代码来源:StartUpView.java

示例4: getEventHander

import javafx.application.HostServices; //导入依赖的package包/类
public static EventHandler<ActionEvent> getEventHander(HostServices services, String uri){
        return new EventHandler<ActionEvent>() {
                public void handle(ActionEvent t) {
                        if (!PlatformUtils.isUnix()) {
                                if (services!= null) {
                                        services.showDocument(uri);
                                } else {
                                        logger.warn("No services object");
                                }
                        }else{
                                String cmd = PlatformUtils.getFileBrowserCommand() + " " + uri;
                                try {
                                        Runtime.getRuntime().exec(cmd);
                                } catch (IOException e) {
                                        logger.warn("Error executing browser");
                                }
                        }
                }
        };
}
 
开发者ID:daisy,项目名称:pipeline-gui,代码行数:21,代码来源:Links.java

示例5: MainWindow

import javafx.application.HostServices; //导入依赖的package包/类
public MainWindow(ScriptRegistry scriptRegistry, 
	JobManagerFactory jobManagerFactory, Client client, EventBusProvider eventBusProvider,
	HostServices hostServices, DatatypeRegistry datatypeRegistry) {
super();

this.eventBusProvider = eventBusProvider;
this.scriptRegistry = scriptRegistry;
this.jobManager = jobManagerFactory.createFor(client);
this.hostServices = hostServices;

currentJobProperty = new SimpleObjectProperty<ObservableJob>();
addCurrentJobChangeListener();

jobData = FXCollections.observableArrayList();
scriptData = FXCollections.observableArrayList();
dataManager = new DataManager(this, datatypeRegistry);
this.eventBusListener = new EventBusListener(this);	
eventBusProvider.get().register(eventBusListener);

buildWindow();	
  }
 
开发者ID:daisy,项目名称:pipeline-gui,代码行数:22,代码来源:MainWindow.java

示例6: openUrl

import javafx.application.HostServices; //导入依赖的package包/类
@EventListener
public void openUrl(OpenUrlRequest event) {
    HostServices services = getHostServices();
    if (nonNull(services)) {
        try {
            services.showDocument(event.getUrl());
        } catch (NullPointerException npe) {
            // service delegate can be null but there's no way to check it first so we have to catch the npe
            LOG.info("Unable to open url using HostServices, trying fallback");
            try {
                Runtime.getRuntime().exec(getOpenCmd(event.getUrl()));
            } catch (IOException e) {
                LOG.warn("Unable to open the url", e);
            }
        }
    } else {
        LOG.warn("Unable to open '{}', please copy and paste the url to your browser.", event.getUrl());
    }
}
 
开发者ID:torakiki,项目名称:pdfsam,代码行数:20,代码来源:PdfsamApp.java

示例7: AppController

import javafx.application.HostServices; //导入依赖的package包/类
public AppController(AllAppList appList, UserAppList userApp, HostServices hostServices)
{
    this.allAppList = appList;
    this.userAppList = userApp;
    this.noGameSelected = true;
    this.imageCache = new HashMap<>();
    this.dragDelta = new Point();
    this.hostServices = hostServices;
    this.filterMode = false;
    this.modified = false;
    imageCacheHandler = new ImageCacheHandler(imageCache);
    csvImportTool = new CSVImportTool(userAppList);

}
 
开发者ID:Matthieu42,项目名称:Steam-trader-tools,代码行数:15,代码来源:AppController.java

示例8: AboutDialog

import javafx.application.HostServices; //导入依赖的package包/类
public AboutDialog(HostServices hostServices) throws IOException {
    this.hostServices = hostServices;

    setTitle( "About" );
    setHeaderText( null );
    setResizable( false );

    getDialogPane().getButtonTypes().addAll( ButtonType.OK );

    FXMLLoader fxmlLoader = new FXMLLoader();
    fxmlLoader.setController( this );
    Pane aboutContentPane = fxmlLoader.load(getClass().getResourceAsStream("/fxml/about.fxml"));

    getDialogPane().setContent( aboutContentPane );
}
 
开发者ID:dneves,项目名称:thrift-ui-fx,代码行数:16,代码来源:AboutDialog.java

示例9: AboutAlert

import javafx.application.HostServices; //导入依赖的package包/类
public AboutAlert(final HostServices hostServices, final ResourceBundle bundle) {
    super(AlertType.NONE);
    this.HOSTSERVICES = hostServices;
    this.BUNDLE = bundle;
    setTitle(BUNDLE.getString("menu.about"));
    initStyle(StageStyle.UTILITY);
    initModality(Modality.NONE);
    setAndHideButton();
    getDialogPane().setContent(createContent());
}
 
开发者ID:theovier,项目名称:lernplattform-crawler,代码行数:11,代码来源:AboutAlert.java

示例10: shouldDownloadNewVersion

import javafx.application.HostServices; //导入依赖的package包/类
@Test
public void shouldDownloadNewVersion() throws Exception {
    HostServices existingHostServices = GUIState.getHostServices();
    ReflectionTestUtils.setField(GUIState.class, "hostServices", mockHostServices);

    spyUpdateManager.downloadNewVersion();

    // Wait for invocation
    Thread.sleep(500);

    ReflectionTestUtils.setField(GUIState.class, "hostServices", existingHostServices);

    verify(mockHostServices, times(1)).showDocument(websiteUrl);
}
 
开发者ID:mpcontracting,项目名称:rpmjukebox,代码行数:15,代码来源:UpdateManagerTest.java

示例11: start

import javafx.application.HostServices; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
    Injector.setModelOrService(HostServices.class, getHostServices());
    final FixpadView mainView = new FixpadView();
    final Scene scene = new Scene( mainView.getView() );
    primaryStage.setTitle( "FixPad" );
    primaryStage.setScene( scene );
    primaryStage.show();
}
 
开发者ID:tools4j,项目名称:fix4j-fixpad,代码行数:10,代码来源:Main.java

示例12: MainViewController

import javafx.application.HostServices; //导入依赖的package包/类
/**
 * Constructs a controller for Main View with the specified CSS theme and
 * host services.
 *
 * @param theme the {@link CSS} theme to apply.
 * @param hostServices the host services to aggregate.
 */
public MainViewController(CSS.Theme theme, HostServices hostServices) {
    super(theme, hostServices);
    _archiveName = DEFAULT_ARCHIVE_NAME;
    _compressionLevel = Deflater.DEFAULT_COMPRESSION;
    _activeTasks = new ConcurrentHashMap<>();
    Log.i("Default archive name set to: {0}", _archiveName, false);
}
 
开发者ID:turbolocust,项目名称:GZipper,代码行数:15,代码来源:MainViewController.java

示例13: start

import javafx.application.HostServices; //导入依赖的package包/类
@Override
public void start(final Stage stage) {
        Platform.runLater(new Runnable() {
                @Override
                public void run(){
                        try {
                                ServiceRegistry.getInstance().notifyReady(PipelineApplication.this);
                                ServiceRegistry services=PipelineApplication.this.services;
                                HostServices hostServices = getHostServices();
                                Client client = services.getWebserviceStorage().getClientStorage().defaultClient();
                                MainWindow mainWindow = new MainWindow(
                                        services.getScriptRegistry(),
                                        services.getJobManagerFactory(),
                                        client, 
                                        services.getEventBusProvider(), 
                                        hostServices,
                                        services.getDatatypeRegistry());

                                stage.setScene(mainWindow.getScene());
                                stage.setTitle("DAISY Pipeline 2");
                                stage.show();

                        }
                        catch (InterruptedException e) {
                                logger.error("Interrupted while wating for services",e);
                        }

                }
        });
}
 
开发者ID:daisy,项目名称:pipeline-gui,代码行数:31,代码来源:PipelineApplication.java

示例14: getJavaFxParent

import javafx.application.HostServices; //导入依赖的package包/类
private MarkdownToJavafx.JavaFxParent getJavaFxParent(final Pane parent){
        return new MarkdownToJavafx.JavaFxParent(){
                @Override
                public void addChild(Node node) {
                        node.getStyleClass().add("help");
                        parent.getChildren().add(node);

                        //make sure the text is displayed correctly
                        if (node instanceof Text){
                                Text text = (Text)node;
                                //if (parent instanceof VBox){
                                        //wrapCorrectly(text, (VBox)parent);
                                //}else{
                                        //wrapCorrectly(text);
                                        //
                                //}
                                text.setWrappingWidth(200);

                        }
                }

                @Override
                public HostServices getHostServices() {
                        return GridPaneHelper.this.main.getHostServices();
                }

        };
}
 
开发者ID:daisy,项目名称:pipeline-gui,代码行数:29,代码来源:GridPaneHelper.java

示例15: TipPanel

import javafx.application.HostServices; //导入依赖的package包/类
public TipPanel(HostServices hostServices) {
    this.hostServices = hostServices;
    
    tipbarTimeline = new Timeline(
            new KeyFrame(Duration.ZERO,
                    new KeyValue(tipPanel.translateYProperty(), 0, Interpolator.EASE_BOTH)),
            new KeyFrame(slideTime,
                    new KeyValue(tipPanel.translateYProperty(), -40, Interpolator.EASE_BOTH))
    );
    tipbarTimeline.setAutoReverse(false);

    new Timeline(new KeyFrame(Duration.minutes(1), e -> showTipBar())).play();

}
 
开发者ID:shemnon,项目名称:FollowTheBitcoin,代码行数:15,代码来源:TipPanel.java


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