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

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

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

origin: imagej/imagej-ops

  /**
   * As {@link #paramString(Iterable, ModuleItem, String)} with a toggle to control
   * if inputs are types only or include the names.
   */
  private static String paramString(final Iterable<ModuleItem<?>> items,
    final ModuleItem<?> special, final String delim, final boolean typeOnly)
  {
    final StringBuilder sb = new StringBuilder();
    boolean first = true;
    for (final ModuleItem<?> item : items) {
      if (first) first = false;
      else sb.append(delim);
      sb.append("\n");
      if (item == special) sb.append("==>"); // highlight special item
      sb.append("\t\t");
      sb.append(item.getType().getSimpleName());

      if (!typeOnly){
        sb.append(" " + item.getName());
        if (!item.isRequired()) sb.append("?");
      }
    }
    return sb.toString();
  }
}
origin: imagej/imagej-ops

/** Helper method of {@link #match(OpCandidate, Object[])}. */
private boolean canAssign(final OpCandidate candidate, final Object arg,
  final ModuleItem<?> item)
{
  if (arg == null) {
    if (item.isRequired()) {
      candidate.setStatus(StatusCode.REQUIRED_ARG_IS_NULL, null, item);
      return false;
    }
    return true;
  }
  final Type type = item.getGenericType();
  if (!canConvert(arg, type)) {
    candidate.setStatus(StatusCode.CANNOT_CONVERT, arg.getClass().getName() +
      " => " + type, item);
    return false;
  }
  return true;
}
origin: imagej/imagej-ops

/**
 * Determines if the candidate has some arguments missing.
 * <p>
 * Helper method of {@link #filterMatches(List)}.
 * </p>
 */
private boolean missArgs(final OpCandidate candidate) {
  int i = 0;
  for (final ModuleItem<?> item : candidate.inputs()) {
    if (candidate.getArgs()[i++] == null && item.isRequired()) {
      candidate.setStatus(StatusCode.REQUIRED_ARG_IS_NULL, null, item);
      return true;
    }
  }
  return false;
}
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: 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: imagej/imagej-ops

for (final ModuleItem<?> item : candidate.inputs()) {
  inputCount++;
  if (item.isRequired()) requiredCount++;
int argIndex = 0, paddedIndex = 0, optionalIndex = 0;
for (final ModuleItem<?> item : candidate.inputs()) {
  if (!item.isRequired() && optionalIndex++ >= optionalsToFill) {
origin: imagej/imagej-ops

args.append(className);
for (final ModuleItem<?> input : info.inputs()) {
  if (!input.isRequired()) {
origin: net.imagej/imagej-legacy

  @Override
  public void process(final Module module) {
    // assign singleton RoiManager to single RoiManager input
    final ModuleItem<RoiManager> roiManagerInput = moduleService.getSingleInput(
      module, RoiManager.class);
    if (roiManagerInput != null) {
      RoiManager roiManager;
      if (roiManagerInput.isRequired()) {
        roiManager = RoiManager.getRoiManager();
      }
      else {
        roiManager = RoiManager.getInstance();
      }
      if (roiManager == null) return;
      module.setInput(roiManagerInput.getName(), roiManager);
      module.resolveInput(roiManagerInput.getName());
    }
  }
}
origin: org.scijava/scijava-common

private <T> WidgetModel addInput(final InputPanel<P, W> inputPanel,
  final Module module, final ModuleItem<T> item) throws ModuleException
{
  final String name = item.getName();
  final boolean resolved = module.isInputResolved(name);
  if (resolved) return null; // skip resolved inputs
  final Class<T> type = item.getType();
  final WidgetModel model =
    widgetService.createModel(inputPanel, module, item, getObjects(type));
  final Class<W> widgetType = inputPanel.getWidgetComponentType();
  final InputWidget<?, ?> widget = widgetService.create(model);
  if (widget == null) {
    log.debug("No widget found for input: " + model.getItem().getName());
  }
  if (widget != null && widget.getComponentType() == widgetType) {
    @SuppressWarnings("unchecked")
    final InputWidget<?, W> typedWidget = (InputWidget<?, W>) widget;
    inputPanel.addWidget(typedWidget);
    return model;
  }
  if (item.isRequired()) {
    throw new ModuleException("A " + type.getSimpleName() +
      " is required but none exist.");
  }
  // item is not required; we can skip it
  return null;
}
origin: scijava/scijava-common

private <T> WidgetModel addInput(final InputPanel<P, W> inputPanel,
  final Module module, final ModuleItem<T> item) throws ModuleException
{
  final String name = item.getName();
  final boolean resolved = module.isInputResolved(name);
  if (resolved) return null; // skip resolved inputs
  final Class<T> type = item.getType();
  final WidgetModel model =
    widgetService.createModel(inputPanel, module, item, getObjects(type));
  final Class<W> widgetType = inputPanel.getWidgetComponentType();
  final InputWidget<?, ?> widget = widgetService.create(model);
  if (widget == null) {
    log.debug("No widget found for input: " + model.getItem().getName());
  }
  if (widget != null && widget.getComponentType() == widgetType) {
    @SuppressWarnings("unchecked")
    final InputWidget<?, W> typedWidget = (InputWidget<?, W>) widget;
    inputPanel.addWidget(typedWidget);
    return model;
  }
  if (item.isRequired()) {
    throw new ModuleException("A " + type.getSimpleName() +
      " is required but none exist.");
  }
  // item is not required; we can skip it
  return null;
}
origin: imagej/imagej-ops

int requiredCount = 0, inputCount = 0;
for (final ModuleItem<?> input : info.inputs()) {
  if (input.isRequired()) requiredCount++;
  inputCount++;
origin: org.scijava/scijava-common

/** Creates a new module item with the same values as the given item. */
public DefaultMutableModuleItem(final ModuleInfo info,
  final ModuleItem<T> item)
{
  super(info);
  name = item.getName();
  type = item.getType();
  genericType = item.getGenericType();
  ioType = item.getIOType();
  visibility = item.getVisibility();
  required = item.isRequired();
  persisted = item.isPersisted();
  persistKey = item.getPersistKey();
  initializer = item.getInitializer();
  validater = item.getValidater();
  callback = item.getCallback();
  widgetStyle = item.getWidgetStyle();
  minimumValue = item.getMinimumValue();
  maximumValue = item.getMaximumValue();
  softMinimum = item.getSoftMinimum();
  softMaximum = item.getSoftMaximum();
  stepSize = item.getStepSize();
  columnCount = item.getColumnCount();
  final List<T> itemChoices = item.getChoices();
  if (itemChoices != null) choices.addAll(itemChoices);
  label = item.getLabel();
  description = item.getDescription();
}
origin: scijava/scijava-common

/** Creates a new module item with the same values as the given item. */
public DefaultMutableModuleItem(final ModuleInfo info,
  final ModuleItem<T> item)
{
  super(info);
  name = item.getName();
  type = item.getType();
  genericType = item.getGenericType();
  ioType = item.getIOType();
  visibility = item.getVisibility();
  required = item.isRequired();
  persisted = item.isPersisted();
  persistKey = item.getPersistKey();
  initializer = item.getInitializer();
  validater = item.getValidater();
  callback = item.getCallback();
  widgetStyle = item.getWidgetStyle();
  minimumValue = item.getMinimumValue();
  maximumValue = item.getMaximumValue();
  softMinimum = item.getSoftMinimum();
  softMaximum = item.getSoftMaximum();
  stepSize = item.getStepSize();
  columnCount = item.getColumnCount();
  final List<T> itemChoices = item.getChoices();
  if (itemChoices != null) choices.addAll(itemChoices);
  label = item.getLabel();
  description = item.getDescription();
}
origin: scijava/scijava-common

private void assertItem(final String name, final Class<?> type,
  final String label, final ItemIO ioType, final boolean required,
  final boolean persist, final String persistKey, final String style,
  final Object value, final Object min, final Object max,
  final Object softMin, final Object softMax, final Number stepSize,
  final List<?> choices, final ModuleItem<?> item)
{
  assertEquals(name, item.getName());
  assertSame(type, item.getType());
  assertEquals(label, item.getLabel());
  assertSame(ioType, item.getIOType());
  assertEquals(required, item.isRequired());
  assertEquals(persist, item.isPersisted());
  assertEquals(persistKey, item.getPersistKey());
  assertEquals(style, item.getWidgetStyle());
  assertEquals(value, item.getDefaultValue());
  assertEquals(min, item.getMinimumValue());
  assertEquals(max, item.getMaximumValue());
  assertEquals(softMin, item.getSoftMinimum());
  assertEquals(softMax, item.getSoftMaximum());
  assertEquals(stepSize, item.getStepSize());
  assertEquals(choices, item.getChoices());
}
org.scijava.moduleModuleItemisRequired

Javadoc

Gets whether the item value must be specified (i.e., no default).

Popular methods of ModuleItem

  • getName
  • 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.
  • 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

  • Reactive rest calls using spring rest template
  • getResourceAsStream (ClassLoader)
  • getContentResolver (Context)
  • setContentView (Activity)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • JOptionPane (javax.swing)
  • CodeWhisperer alternatives
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