Tabnine Logo
ModuleItem.getName
Code IndexAdd Tabnine to your IDE (free)

How to use
getName
method
in
org.scijava.module.ModuleItem

Best Java code snippets using org.scijava.module.ModuleItem.getName (Showing top 20 results out of 315)

origin: org.scijava/scijava-common

/**
 * Adds an output. Intended to be called from overridden
 * {@link #parseParameters()} methods.
 */
protected void registerOutput(final ModuleItem<?> output) {
  outputMap.put(output.getName(), output);
  outputList.add(output);
}
origin: org.scijava/scijava-common

/**
 * Adds an input. Intended to be called from overridden
 * {@link #parseParameters()} methods.
 */
protected void registerInput(final ModuleItem<?> input) {
  inputMap.put(input.getName(), input);
  inputList.add(input);
}
origin: org.scijava/scijava-common

@Override
public String getWidgetLabel() {
  // Do this dynamically. Don't cache this result.
  // Some controls change their labels at runtime.
  final String label = item.getLabel();
  if (label != null && !label.isEmpty()) return label;
  final String name = item.getName();
  return name.substring(0, 1).toUpperCase() + name.substring(1);
}
origin: org.scijava/scijava-common

  private String prefKey(final ModuleItem<?> item) {
    final String persistKey = item.getPersistKey();
    return persistKey == null || persistKey.isEmpty() ? //
      item.getName() : persistKey;
  }
}
origin: org.scijava/scijava-common

private String defaultName(final ModuleItem<?> item) {
  final String label = item.getLabel();
  if (label != null && !label.isEmpty()) return label;
  final String name = item.getName();
  if (name != null && !name.isEmpty()) return name;
  return "Unnamed";
}
origin: org.scijava/scijava-common

@Override
public void addInput(final ModuleItem<?> input) {
  inputMap().put(input.getName(), input);
  inputList().add(input);
}
origin: org.scijava/scijava-common

  @Override
  public void removeOutput(final ModuleItem<?> output) {
    outputMap().remove(output.getName());
    outputList().remove(output);
  }
}
origin: org.scijava/scijava-common

@Override
public void addOutput(final ModuleItem<?> output) {
  outputMap().put(output.getName(), output);
  outputList().add(output);
}
origin: org.scijava/scijava-common

@Override
public void removeInput(final ModuleItem<?> input) {
  inputMap().remove(input.getName());
  inputList().remove(input);
}
origin: org.scijava/scijava-common

private Map<String, Object> createMap(final Iterable<ModuleItem<?>> items,
  final boolean outputMap)
{
  final Map<String, Object> map = new HashMap<>();
  for (final ModuleItem<?> item : items) {
    final String name = item.getName();
    final Object value = outputMap ? getOutput(name) : getInput(name);
    map.put(name, value);
  }
  return map;
}
origin: org.scijava/scijava-common

  private ModuleItem<?> getInputItem(final String name) {
    for (final ModuleItem<?> item : getInfo().inputs()) {
      if (item.getName().equals(name)) return item;
    }
    return null;
  }
}
origin: org.scijava/scijava-common

protected void updateInput(final ModuleItem<?> item) {
  final ModuleItem<Display<?>> displayItem = asDisplay(item);
  if (displayItem != null) updateDisplay(displayItem);
  else {
    log.warn("Input '" + item.getName() + "' (" + item.getClass().getName() +
      ") is not supported");
  }
}
origin: org.scijava/scijava-common

  /** 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);
    }
  }
}
origin: org.scijava/scijava-common

private <S extends Service> void setServiceValue(final Context context,
  final Module module, final ModuleItem<S> input)
{
  final S service = context.getService(input.getType());
  input.setValue(module, service);
  module.resolveInput(input.getName());
}
origin: org.scijava/scijava-common

  private void resetState() {
    // NB: Clear "resolved" status of all inputs.
    // Otherwise, no inputs are harvested on next run.
    for (final ModuleItem<?> input : getInfo().inputs()) {
      unresolveInput(input.getName());
    }

    // NB: Clear "canceled" status.
    // Otherwise, the command cannot run again.
    uncancel();
  }
}
origin: org.scijava/batch-processor

@SuppressWarnings("unchecked")
@Override
public <I> void fillInput(Module module, ModuleItem<?> moduleItem, I inputObject) {
  BatchInputProvider<File> handler = (BatchInputProvider<File>) getHandler(new BatchInput(File.class, moduleItem));
  if (handler == null) {
    log.error("No handler found for input: " + moduleItem.getName());
    return;
  }
  handler.populateInput(module, moduleItem, (File) inputObject);
}
origin: org.scijava/scijava-common

private <T> void assignDefaultValue(final Module module,
  final ModuleItem<T> item)
{
  if (module.isInputResolved(item.getName())) return;
  final T nullValue = Types.nullValue(item.getType());
  if (!Objects.equals(item.getValue(module), nullValue)) return;
  final T defaultValue = moduleService.getDefaultValue(item);
  if (defaultValue == null) return;
  item.setValue(module, defaultValue);
}
origin: org.scijava/scijava-common

@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.");
    }
  }
}
origin: org.scijava/scijava-common

/** Loads the value of the given module item from persistent storage. */
private <T> void loadValue(final Module module, final ModuleItem<T> item) {
  // skip input that has already been resolved
  if (module.isInputResolved(item.getName())) return;
  final T prefValue = moduleService.load(item);
  final Class<T> type = item.getType();
  final T defaultValue = item.getValue(module);
  final T value = getBestValue(prefValue, defaultValue, type);
  item.setValue(module, value);
}
origin: org.scijava/scijava-common

@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);
  }
}
org.scijava.moduleModuleItemgetName

Popular methods of ModuleItem

  • getType
    Gets the type of the item.
  • getWidgetStyle
    Gets the preferred widget style to use when rendering the item in a user interface.
  • getValue
    Gets the item's current value with respect to the given module.
  • isRequired
    Gets whether the item value must be specified (i.e., no default).
  • getColumnCount
    Gets the preferred width of the input field in characters (if applicable).
  • getGenericType
    Gets the type of the item, including Java generic parameters. For many modules, this may be the same
  • getLabel
  • getVisibility
    Gets the visibility of the item.
  • setValue
    Sets the item's current value with respect to the given module.
  • get
  • getChoices
    Gets the list of possible values.
  • getDefaultValue
    Gets the default value.
  • getChoices,
  • getDefaultValue,
  • getDescription,
  • getIOType,
  • getMaximumValue,
  • getMinimumValue,
  • getPersistKey,
  • getSoftMaximum,
  • getSoftMinimum

Popular in Java

  • Finding current android device location
  • getApplicationContext (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • findViewById (Activity)
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • BoxLayout (javax.swing)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now