Search in sources :

Example 1 with CategoryModel

use of net.sourceforge.usbdm.deviceEditor.model.CategoryModel in project usbdm-eclipse-plugins by podonoghue.

the class ParseMenuXML method parseChildModel.

/**
 * Parse element containing: <ul>
 *   <li> &lt;fragment&gt; referencing only elements below
 *   <li> &lt;intOption&gt;
 *   <li> &lt;bitmaskOption&gt;
 *   <li> &lt;floatOption&gt;
 *   <li> &lt;binaryOption&gt;
 *   <li> &lt;irqOption&gt;
 *   <li> &lt;choiceOption&gt;
 *   <li> &lt;stringOption&gt;
 *   <li> &lt;numericListOption&gt;
 *   <li> &lt;pinListOption&gt;
 *   <li> &lt;aliasOption&gt;
 *   <li> &lt;constant&gt;
 *   <li> &lt;section&gt;
 *   <li> &lt;signals&gt;
 *   <li> Control items...
 *</ul>
 *
 * Elements found are added as children of the parentModel
 *
 * @param  parentModel  Model to attach children to
 * @param  menuElement  Menu element to parse
 *
 * @throws Exception
 */
void parseChildModel(BaseModel parentModel, Element element) throws Exception {
    String tagName = element.getTagName();
    String name = element.getAttribute("name");
    String toolTip = getToolTip(element);
    // System.err.println("parseChildModel(): " + tagName + ", " + element.getAttribute("name"));
    if (tagName == "fragment") {
        parseChildModels(parentModel, element);
    } else if (tagName == "category") {
        BaseModel model = new CategoryModel(parentModel, name, toolTip);
        parseChildModels(model, element);
    } else if (tagName == "indexedCategory") {
        parseIndexedCategoryOption(parentModel, element);
    } else if (tagName == "intOption") {
        parseLongOption(parentModel, element);
    } else if (tagName == "bitmaskOption") {
        parseBitmaskOption(parentModel, element);
    } else if (tagName == "floatOption") {
        parseDoubleOption(parentModel, element);
    } else if (tagName == "binaryOption") {
        parseBinaryOption(parentModel, element);
    } else if (tagName == "irqOption") {
        parseIrqOption(parentModel, element);
    } else if (tagName == "choiceOption") {
        parseChoiceOption(parentModel, element);
    } else if (tagName == "stringOption") {
        parseStringOption(parentModel, element);
    } else if (tagName == "numericListOption") {
        parseNumericListOption(parentModel, element);
    } else if (tagName == "pinListOption") {
        parsePinListOption(parentModel, element);
    } else if (tagName == "aliasOption") {
        parseAliasOption(parentModel, element);
    } else if (tagName == "constant") {
        parseConstant(parentModel, element);
    } else if (tagName == "section") {
        BaseModel model = new ParametersModel(parentModel, name, toolTip);
        parseChildModels(model, element);
    } else if (tagName == "list") {
        BaseModel model = new ListModel(parentModel, name);
        parseSectionsOrOther(model, element);
    } else if (tagName == "signals") {
        parseSignalsOption(parentModel, element);
    } else {
        parseControlItem(element);
    }
}
Also used : BaseModel(net.sourceforge.usbdm.deviceEditor.model.BaseModel) ParametersModel(net.sourceforge.usbdm.deviceEditor.model.ParametersModel) CategoryModel(net.sourceforge.usbdm.deviceEditor.model.CategoryModel) IndexedCategoryModel(net.sourceforge.usbdm.deviceEditor.model.IndexedCategoryModel)

Example 2 with CategoryModel

use of net.sourceforge.usbdm.deviceEditor.model.CategoryModel in project usbdm-eclipse-plugins by podonoghue.

the class PeripheralValidator method validateMappedPins.

/**
 * Checks if signals are mapped to pins<br>
 * If not then a warning is attached to pins category
 *
 * @param  requiredSignals Array of required signals as index into the signal table
 * @param  table           Peripheral signal table to use
 *
 * @throws Exception
 */
protected void validateMappedPins(int[] requiredSignals, Vector<Signal> table) throws Exception {
    CategoryModel pinModel = getPeripheral().getPinModel();
    Status unmappedSignals = null;
    for (int pinNum : requiredSignals) {
        Signal signal = table.get(pinNum);
        if ((signal == null) || (signal.getMappedPin().getPin() == Pin.UNASSIGNED_PIN)) {
            unmappedSignals = UNMAPPED_PIN_STATUS;
            break;
        }
    }
    pinModel.setStatus(unmappedSignals);
    pinModel.update();
}
Also used : Status(net.sourceforge.usbdm.deviceEditor.model.Status) Signal(net.sourceforge.usbdm.deviceEditor.information.Signal) CategoryModel(net.sourceforge.usbdm.deviceEditor.model.CategoryModel)

Aggregations

CategoryModel (net.sourceforge.usbdm.deviceEditor.model.CategoryModel)2 Signal (net.sourceforge.usbdm.deviceEditor.information.Signal)1 BaseModel (net.sourceforge.usbdm.deviceEditor.model.BaseModel)1 IndexedCategoryModel (net.sourceforge.usbdm.deviceEditor.model.IndexedCategoryModel)1 ParametersModel (net.sourceforge.usbdm.deviceEditor.model.ParametersModel)1 Status (net.sourceforge.usbdm.deviceEditor.model.Status)1