/** * Determine if the current target Gem only has arguments that we can provide editors for. * * @return boolean true if we can provide all the arguments, false if we can't */ private boolean targetHasProvidableArgs() { // Get the target's arguments first List<Gem.PartInput> args = targetDisplayedGem.getTargetArguments(); // If we have no arguments, then we at least have providable args (we can easily // provided none at all!) if (args == null) { return true; } // Check all the argument types for being ones that we can provide int numArgs = args.size(); Gem.PartInput sinkPart; for (int i = 0; i < numArgs; i++) { // Get this part sinkPart = args.get(i); // Can we deal with this type? if (!valueEditorHierarchyManager .getValueEditorManager() .canInputDefaultValue(sinkPart.getType())) { // Oops, can't provide an editor for this type return false; } } // If we haven't found any dodgy ones, then we can provide all of them! return true; }
/** Cache the values entered by the user in VEPs dynamically-displayed on VM start. */ void cacheArgumentValues() { // Collect the value entry panels which correspond to target arguments in the TableTop List<ValueEditor> argPanels = getArgumentPanels(); List<Gem.PartInput> argParts = targetDisplayedGem.getTargetArguments(); int numArgs = argParts.size(); // sanity check if (numArgs != argPanels.size()) { throw new IllegalStateException( "Programming Error: matching " + numArgs + " arguments and " + argPanels.size() + " argument panels."); } for (int i = 0; i < numArgs; i++) { Gem.PartInput argPart = argParts.get(i); ValueEditor argPanel = argPanels.get(i); ValueNode argNode = argPanel.getValueNode(); gemCutter.getTableTop().cacheArgValue(argPart, argNode); } }
/** * Determine if the current target Gem has any arguments. * * @return boolean whether the current target has any arguments. */ private boolean targetHasArgs() { return (!targetDisplayedGem.getTargetArguments().isEmpty()); }