Refine search
@Override public void process(final Module module) { if (uiService == null) return; // no UI service available final UserInterface ui = uiService.getDefaultUI(); if (ui == null) return; // no default UI for (final ModuleItem<?> input : module.getInfo().inputs()) { if (!input.isAutoFill()) continue; // cannot auto-fill this input final Class<?> type = input.getType(); if (type.isAssignableFrom(ui.getClass())) { // input is a compatible UI final String name = input.getName(); module.setInput(name, ui); module.resolveInput(name); } } }
private String menuLabel(final Module module) { final MenuPath menuPath = module.getInfo().getMenuPath(); if (menuPath != null) { final MenuEntry menuLeaf = menuPath.getLeaf(); if (menuLeaf != null) return menuLeaf.getName(); } return module.getInfo().getTitle(); } }
final ModuleInfo info = list.get(row); if (column == 0) { final String iconPath = info.getIconPath(); if (iconPath == null) return null; final URL iconURL = getClass().getResource(iconPath); return iconURL == null ? null : new JLabel(new ImageIcon(iconURL)); if (column == 1) return info.getTitle(); if (column == 2) { final MenuPath menuPath = info.getMenuPath(); return menuPath == null ? "" : menuPath.getMenuString(false); final MenuPath menuPath = info.getMenuPath(); final MenuEntry menuLeaf = menuPath == null ? null : menuPath.getLeaf(); return menuLeaf == null ? "" : menuLeaf.getAccelerator(); if (column == 4) return info.getDelegateClassName(); if (column == 5) { final URL location = ClassUtils.getLocation(info.getDelegateClassName()); final File file = FileUtils.urlToFile(location); final String path = file == null ? null : file.getAbsolutePath(); if (column == 6) return info.getDescription(); if (column == 7) return info.getPriority(); return null;
private String details(final ModuleInfo info) { if (info == null) return "<null>"; String className, classLocation; try { final Class<?> c = info.loadDelegateClass(); className = c.getName(); classLocation = Types.location(c).toString(); } catch (final ClassNotFoundException exc) { className = info.getDelegateClassName(); classLocation = "<invalid>"; } return info.getMenuPath() + " : " + className + " [" + classLocation + "]"; }
private String getMenuPath(boolean includeLeaf, String separator) { final String menuRoot = info.getMenuRoot(); final boolean isContextMenu = menuRoot != null && // !menuRoot.equals(UIDetails.APPLICATION_MENU_ROOT); final String prefix = isContextMenu ? "[" + menuRoot + "]" : ""; final MenuPath menuPath = info.getMenuPath(); if (menuPath == null) return prefix; final String menuString = menuPath.getMenuString(includeLeaf); return prefix + " " + menuString.replace(" > ", separator); } }
/** * Gets the single unresolved {@link File} input parameter. If there is not * exactly one unresolved {@link File} input parameter, or if there are other * types of unresolved parameters, this method returns null. */ private ModuleItem<File> getFileInput(final Module module) { ModuleItem<File> result = null; for (final ModuleItem<?> input : module.getInfo().inputs()) { if (module.isInputResolved(input.getName())) continue; final Class<?> type = input.getType(); if (!File.class.isAssignableFrom(type)) { // not a File parameter; abort return null; } if (result != null) { // second File parameter; abort return null; } @SuppressWarnings("unchecked") final ModuleItem<File> fileInput = (ModuleItem<File>) input; result = fileInput; } return result; }
module.getInfo().outputs().forEach(output -> { final String name = output.getName(); if (module.isOutputResolved(name)) return; if (module.getOutput(name) == null) return; if (!isSimple(module, output)) return; outputs.add(output); if (outputs.size() == 1 && Types.isText(outputs.get(0).getType())) { final String name = output.getName(); names.addValue(name); values.addValue(module.getOutput(name)); final String title = module.getInfo().getTitle(); ui.show(title, outputTable);
@Override public void process(final Module module) { for (final ModuleItem<?> input : module.getInfo().inputs()) { if (input.isRequired() && input.getValue(module) == null) { cancel("'" + input.getName() + "' is required but unset."); } } }
/** Sets the given module's input values to those in the given map. */ private void assignInputs(final Module module, final Map<String, Object> inputMap) { if (inputMap == null) return; // no inputs to assign for (final String name : inputMap.keySet()) { final ModuleItem<?> input = module.getInfo().getInput(name); final Object value = inputMap.get(name); final Object converted; if (input == null) { // inputs whose name starts with a dot are implicitly known by convention if (!name.startsWith(".")) { log.warn("Unmatched input: " + name); } converted = value; } else { final Class<?> type = input.getType(); converted = convertService.convert(value, type); if (value != null && converted == null) { log.error("For input " + name + ": incompatible object " + value.getClass().getName() + " for type " + type.getName()); continue; } } module.setInput(name, converted); module.resolveInput(name); } }
@Override public void process(final Module module) { if (displayService == null) return; for (final ModuleItem<?> outputItem : module.getInfo().outputs()) { if (module.isOutputResolved(outputItem.getName())) continue; final Object value = outputItem.getValue(module); final String name = defaultName(outputItem); final boolean resolved = handleOutput(name, value); if (resolved) module.resolveOutput(name); } }
/** Does any needed processing, after input values have been harvested. */ @SuppressWarnings("unused") default void processResults(final InputPanel<P, W> inputPanel, final Module module) throws ModuleException { final Iterable<ModuleItem<?>> inputs = module.getInfo().inputs(); for (final ModuleItem<?> item : inputs) { final String name = item.getName(); module.resolveInput(name); } } }
@Override public void process(final Module module) { for (final ModuleItem<?> input : module.getInfo().inputs()) { if (!input.isAutoFill()) continue; // cannot auto-fill this input final Class<?> type = input.getType(); if (Gateway.class.isAssignableFrom(type)) { // input is a gateway @SuppressWarnings("unchecked") final ModuleItem<? extends Gateway> gatewayInput = (ModuleItem<? extends Gateway>) input; setGatewayValue(getContext(), module, gatewayInput); } } }
/** * Extract the Axis from the {@link Dataset}. * * @param model A {@link WidgetModel} * @return The Axis of the {@link Dataset} or null if no {@link Dataset} was * found. */ private TypedAxis[] extractAxis(final WidgetModel model) { final Module module = model.getModule(); for (final ModuleItem<?> moduleItem : module.getInfo().inputs()) { if (TypedSpace.class.isAssignableFrom(moduleItem.getType())) { final TypedSpace<?> space = (TypedSpace<?>) moduleItem.getValue(module); final TypedAxis[] axis = new TypedAxis[space.numDimensions()]; for (int i = 0; i < space.numDimensions(); i++) { axis[i] = space.axis(i); } return axis; } } return null; }
@Override public void process(final Module module) { if (legacyService == null) return; final IJ1Helper ij1Helper = legacyService.getIJ1Helper(); if (ij1Helper == null) return; if (ij1Helper.isMacro()) return; // do not record while in macro mode final Set<String> excludedInputs = // MacroRecorderExcludedInputs.retrieve(module); for (final ModuleItem<?> input : module.getInfo().inputs()) { final String name = input.getName(); if (excludedInputs != null && excludedInputs.contains(name)) continue; if (excludedFromRecording(input)) continue; final Object value = module.getInput(name); if (value != null) ij1Helper.recordOption(name, toString(value)); } ij1Helper.finishRecording(); }