Set the designated container for objects packed by this instance.

@param cont
the Container to use to add the components to when .pack() or
.add() is invoked.
@exception IllegalAccessException
if container already set
354446
public Packer setContainer(final Container cont) throws IllegalAccessException {
        if (container != null) {
            final Packer p = (Packer) clone();
            container.setLayout(p);
        }
        container = cont;
        cont.setLayout(this);
        return this;
    }
628014
@javax.annotation.Nonnull
  public com.simiacryptus.util.MonitoredObject addConst(final String key, final Object item) {
    items.put(key, item);
    return this;
  }
765030
public PackingPlanBuilder addInstance(Integer containerId,
                                        String componentName) throws ConstraintViolationException {
    // create container if not existed
    initContainer(containerId);

    Integer taskId = taskIds.isEmpty() ? 1 : taskIds.last() + 1;
    Integer componentIndex = componentIndexes.containsKey(componentName)
        ? componentIndexes.get(componentName).last() + 1 : 0;
    InstanceId instanceId = new InstanceId(componentName, taskId, componentIndex);

    Resource instanceResource = componentResourceMap.getOrDefault(componentName,
        defaultInstanceResource);

    Container container = containers.get(containerId);
    PackingPlan.InstancePlan instancePlan
        = new PackingPlan.InstancePlan(instanceId, instanceResource);

    // Check constraints
    for (InstanceConstraint constraint : instanceConstraints) {
      constraint.validate(instancePlan);
    }
    for (PackingConstraint constraint : packingConstraints) {
      constraint.validate(container, instancePlan);
    }
    addToContainer(container, instancePlan, this.componentIndexes, this.taskIds);

    LOG.finest(String.format("Added to container %d instance %s", containerId, instanceId));
    return this;
  }
629161
public void addComponents(Container container, Vector<Component> vector)
    {
        int components = container.getComponentCount();
        int[] componentOrder = this.getComponentOrder(container);
        for (int i = 0; i < components; i++)
        {
            Component component = container.getComponent(componentOrder[i]);
            if (component instanceof JMenuBar)
                continue;   // Never print this
            if (component instanceof JScrollPane)
            {
                component = ((JScrollPane)component).getViewport().getView();
                if (!(component instanceof JTable))
                {
                    vector.add(component);
                    component = null;
                }
            }
            if (component instanceof JTable)
            {
                JComponent header = ((JTable)component).getTableHeader();
                if (header != null)
                    vector.add(header);
                vector.add(component);
                component = null;
            }
            if (component instanceof JToolBar)
            {
                vector.add(component);
                component = null;
            }
            if (component instanceof Container)
                this.addComponents(((Container)component), vector);
        }
    }
535441
public Packer pack(final Component cp) {
        if (container != null) {
            container.add(cp);
        }
        comp = cp;
        gc = new GridBagConstraints();
        setConstraints(comp, gc);
        return this;
    }
432473
public void setContainer(final String container) {
        if (container != null)
            attrMixin.setAttribute(CONTAINER, container);
        else
            attrMixin.removeAttribute(CONTAINER);
    }
955039
public void setPendingContainer(AckingContainer container) {
        Preconditions.checkNotNull(m_pendingContainer.get() != null, "Pending container must be null.");
        if (m_closed) {
            // A very slow export decoder must have noticed the export processor shutting down
            exportLog.info("Discarding stale pending container");
            container.internalDiscard();
        } else {
            m_pendingContainer.set(container);
        }
    }
250424
public void setContentPane(Container contentPanel) {
        if (contentPanel == null) {
            throw new IllegalArgumentException("Content pane can't be null");
        }

        if (wrapper != null) {
            super.remove(wrapper);
        }
        wrapper = new WrapperContainer(contentPanel);
        super.addImpl(wrapper, BorderLayout.CENTER, -1);
    }
781369
@Override
    public void init(final CONFIG config) throws InitializationException, InterruptedException {
        synchronized (CONFIG_LOCK) {
            try {
                if (config == null) {
                    throw new NotAvailableException("config");
                }
                currentScope = detectScope(config);
                try {
                    applyConfigUpdate(config);
                } catch (CouldNotPerformException ex) {
                    ExceptionPrinter.printHistory("Could not apply config update for " + this, ex, logger);
                    try {
                        if (JPService.getProperty(JPTestMode.class).getValue()) {
                            throw new FatalImplementationErrorException("Could not apply config update for " + this, this, ex);
                        }
                    } catch (JPNotAvailableException ex1) {
                        // to nothing if property could not be resovled.
                    }
                }
                super.init(currentScope);
            } catch (CouldNotPerformException ex) {
                throw new InitializationException(this, ex);
            }
        }
    }
440625
function addToContainer(container, key, val) {
  if (container instanceof Array) {
    container.push(val);
  } else if (container instanceof Object) {
    container[key] = val;
  }
}
940107
static Class<?> normalizeContainerType(Class<?> containerType) {
        if (containerType == Iterable.class ||
            containerType == List.class ||
            containerType == Collection.class) {
            return ArrayList.class;
        }
        if (containerType == Set.class) {
            return LinkedHashSet.class;
        }
        if (List.class.isAssignableFrom(containerType) ||
            Set.class.isAssignableFrom(containerType)) {
            try {
                // Only if there is a default constructor.
                containerType.getConstructor();
                return containerType;
            } catch (Throwable cause) {
                throw new IllegalArgumentException("Unsupported container type: " + containerType.getName(),
                                                   cause);
            }
        }
        throw new IllegalArgumentException("Unsupported container type: " + containerType.getName());
    }
519113
protected void fillContainer(boolean showIndirect) {

        m_container.removeAllContainerFilters();
        m_container.removeAllItems();
        for (CmsGroup group : m_groups) {
            if (!m_indirects.contains(group)) {
                Item item = m_container.addItem(group);
                m_app.fillGroupItem(item, group, m_indirects);
            }
        }
        if (showIndirect) {
            for (CmsGroup group : m_indirects) {
                Item item = m_container.addItem(group);
                m_app.fillGroupItem(item, group, m_indirects);
            }
        }
    }
742057
public void addLayoutComponent (Component comp, Object constraints)
    {
        if (!(constraints instanceof Point ||
              constraints instanceof Rectangle)) {
            throw new IllegalArgumentException("Constraints must be " +
                                               "Point or Rectangle");
        }
        _constraints.put(comp, constraints);
    }
353691
public void layoutContainer (Container parent)
    {
        Insets insets = parent.getInsets();
        int pcount = parent.getComponentCount();
        for (int ii = 0; ii < pcount; ii++) {
            Component comp = parent.getComponent(ii);
            if (!comp.isVisible()) {
                continue;
            }

            Object constr = _constraints.get(comp);
            if (constr == null) {
                log.warning("No constraints for child!?", "cont", parent, "comp", comp);
                continue;
            }

            if (constr instanceof Rectangle) {
                Rectangle r = (Rectangle)constr;
                comp.setBounds(insets.left + r.x, insets.top + r.y,
                               r.width, r.height);

            } else {
                Point p = (Point)constr;
                Dimension d = comp.getPreferredSize();
                comp.setBounds(insets.left + p.x, insets.top + p.y,
                               d.width, d.height);
            }
        }
    }
92736
@Override
    public void setContent(final InputStream content, final String contentType,
                           final Collection<URI> checksums, final String originalFileName,
                           final StoragePolicyDecisionPoint storagePolicyDecisionPoint)
            throws UnsupportedOperationException {
        throw new UnsupportedOperationException(
                "Cannot call setContent() on local file, call setExternalContent() instead");
    }
639270
public PackingPlan createPackingPlan(final Config config, final Config runtime)
    throws PackingException {
    // Create an instance of the packing class
    String packingClass = Context.packingClass(config);
    IPacking packing;
    try {
      // create an instance of the packing class
      packing = ReflectionUtils.newInstance(packingClass);
    } catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) {
      throw new PackingException(String.format(
          "Failed to instantiate packing instance using packing class %s", packingClass), e);
    }

    try {
      TopologyAPI.Topology topology = Runtime.topology(runtime);
      packing.initialize(config, topology);
      return packing.pack();
    } finally {
      SysUtils.closeIgnoringExceptions(packing);
    }
  }
1326551
private void assignInstancesToContainers(PackingPlanBuilder planBuilder,
                                           Map<String, Integer> parallelismMap,
                                           PolicyType policyType)
      throws ConstraintViolationException {
    for (String componentName : parallelismMap.keySet()) {
      int numInstance = parallelismMap.get(componentName);
      for (int i = 0; i < numInstance; ++i) {
        policyType.assignInstance(planBuilder, componentName, this);
      }
    }
  }