Java 类org.apache.commons.lang3.builder.Builder 实例源码

项目:pdfsam    文件:BaseTaskExecutionModule.java   
protected final void initModuleSettingsPanel(VBox panel) {
    panel.getStyleClass().addAll(Style.DEAULT_CONTAINER.css());
    panel.getStyleClass().addAll(Style.MODULE_CONTAINER.css());
    panel.getChildren().add(footer);

    footer.runButton().setOnAction(event -> {
        ErrorTracker errorTracker = new ErrorTracker();
        Builder<? extends AbstractParameters> builder = getBuilder(errorTracker
                .andThen(s -> eventStudio().broadcast(new AddNotificationRequestEvent(NotificationType.ERROR, s,
                        DefaultI18nContext.getInstance().i18n("Invalid parameters")))));
        if (!errorTracker.errorOnBuild) {
            eventStudio().broadcast(new TaskExecutionRequestEvent(id(), builder.build()));
        }
    });
    modulePanel.setCenter(panel);
    eventStudio().addAnnotatedListeners(this);
}
项目:Trackables    文件:ErrorActivity.java   
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final int resTitleId = getArguments().getInt(PARAM_RESOURCE_TITLE);
    final int resTextId = getArguments().getInt(PARAM_RESOURCE_TEXT);
    final String additionalMessage = getArguments().getString(PARAM_ADDITIONAL_MESSAGE);
    final Intent intent = getArguments().getParcelable(PARAM_INTENT);

    MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity())
                    .title(resTitleId)
                    .positiveText(R.string.button_ok);

    if (resTextId != 0) {
        builder.content(getString(resTextId, StringUtils.defaultString(additionalMessage)));
    } else {
        builder.content(StringUtils.defaultString(additionalMessage));
    }

    builder.callback(new MaterialDialog.ButtonCallback() {
        @Override
        public void onPositive(MaterialDialog dialog) {
            if (intent != null) {
                getActivity().startActivity(intent);
            }
            getActivity().finish();
        }
    });

    return builder.build();
}
项目:pdfsam    文件:SplitBySizeModule.java   
@Override
protected Builder<SplitBySizeParameters> getBuilder(Consumer<String> onError) {
    SplitBySizeParametersBuilder builder = new SplitBySizeParametersBuilder();
    splitOptions.apply(builder, onError);
    selectionPane.apply(builder, onError);
    destinationDirectoryField.apply(builder, onError);
    destinationPane.apply(builder, onError);
    prefix.apply(builder, onError);
    return builder;
}
项目:pdfsam    文件:SplitByBookmarksModule.java   
@Override
protected Builder<SplitByOutlineLevelParameters> getBuilder(Consumer<String> onError) {
    SplitByOutlineLevelParametersBuilder builder = new SplitByOutlineLevelParametersBuilder();
    splitOptions.apply(builder, onError);
    selectionPane.apply(builder, onError);
    destinationDirectoryField.apply(builder, onError);
    destinationPane.apply(builder, onError);
    prefix.apply(builder, onError);
    return builder;
}
项目:pdfsam    文件:SplitModule.java   
@Override
protected Builder<? extends AbstractSplitByPageParameters> getBuilder(Consumer<String> onError) {
    Optional<SinglePdfSourceMultipleOutputParametersBuilder<? extends AbstractSplitByPageParameters>> builder = Optional
            .ofNullable(splitOptions.getBuilder(onError));
    builder.ifPresent(b -> {
        selectionPane.apply(b, onError);
        destinationDirectoryField.apply(b, onError);
        destinationPane.apply(b, onError);
        prefix.apply(b, onError);
    });
    return builder.orElse(null);
}
项目:pdfsam    文件:BaseTaskExecutionModule.java   
/**
 * @param onError
 *            function to be called in case of error while building the task parameters
 * @return a {@link Builder} for the parameters to be used to perform a pdf manipulation
 */
protected abstract Builder<? extends AbstractParameters> getBuilder(Consumer<String> onError);