void Element::setAttribute(const AtomicString& name, const AtomicString& value, ExceptionCode& ec)
{
    if (!Document::isValidName(name)) {
        ec = INVALID_CHARACTER_ERR;
        return;
    }

    const AtomicString& localName = (shouldIgnoreAttributeCase(this) && !name.string().impl()->isLower()) ? AtomicString(name.string().lower()) : name;

    // allocate attributemap if necessary
    Attribute* old = attributes(false)->getAttributeItem(localName, false);

    document()->incDOMTreeVersion();

    if (localName == idAttr.localName())
        updateId(old ? old->value() : nullAtom, value);
    
    if (old && value.isNull())
        namedAttrMap->removeAttribute(old->name());
    else if (!old && !value.isNull())
        namedAttrMap->addAttribute(createAttribute(QualifiedName(nullAtom, localName, nullAtom), value));
    else if (old && !value.isNull()) {
        old->setValue(value);
        attributeChanged(old);
    }
}
Beispiel #2
0
void Element::cloneAttributesFromElement(const Element& other)
{
    other.synchronizeAllAttributes();
    if (!other.m_elementData) {
        m_elementData.clear();
        return;
    }

    const AtomicString& oldID = getIdAttribute();
    const AtomicString& newID = other.getIdAttribute();

    if (!oldID.isNull() || !newID.isNull())
        updateId(oldID, newID);

    // If 'other' has a mutable ElementData, convert it to an immutable one so we can share it between both elements.
    // We can only do this if there are no presentation attributes and sharing the data won't result in different case sensitivity of class or id.
    if (other.m_elementData->isUnique())
        const_cast<Element&>(other).m_elementData = toUniqueElementData(other.m_elementData)->makeShareableCopy();

    if (!other.m_elementData->isUnique())
        m_elementData = other.m_elementData;
    else
        m_elementData = other.m_elementData->makeUniqueCopy();

    AttributeCollection attributes = m_elementData->attributes();
    AttributeCollection::iterator end = attributes.end();
    for (AttributeCollection::iterator it = attributes.begin(); it != end; ++it)
        attributeChangedFromParserOrByCloning(it->name(), it->value(), ModifiedByCloning);
}
void Element::setAttributeMap(PassRefPtr<NamedAttrMap> list)
{
    document()->incDOMTreeVersion();

    // If setting the whole map changes the id attribute, we need to call updateId.

    Attribute* oldId = namedAttrMap ? namedAttrMap->getAttributeItem(idAttr) : 0;
    Attribute* newId = list ? list->getAttributeItem(idAttr) : 0;

    if (oldId || newId)
        updateId(oldId ? oldId->value() : nullAtom, newId ? newId->value() : nullAtom);

    if (namedAttrMap)
        namedAttrMap->m_element = 0;

    namedAttrMap = list;

    if (namedAttrMap) {
        namedAttrMap->m_element = this;
        unsigned len = namedAttrMap->length();
        for (unsigned i = 0; i < len; i++)
            attributeChanged(namedAttrMap->m_attributes[i].get());
        // FIXME: What about attributes that were in the old map that are not in the new map?
    }
}
Beispiel #4
0
Port::Port(int iInNumber,  FSMElementIfc* poInElementParent )
: FSMElementBase( poInElementParent )
, QGraphicsPolygonItem(poInElementParent ? poInElementParent->getGraphicsItem() : 0 )
, moPolygon()
, miNumber( iInNumber )
{
    // create signal slot connections
    if ( poInElementParent )
    {
      // observer change of id of parent element (node)
      connect(
          poInElementParent->getSignalSlotBase(), SIGNAL( sigChangedId( const FSMElementIfc& ))
          , this, SLOT( slotUpdateId( const FSMElementIfc& ) ) );
    }

    setBrush( QBrush( QColor( Qt::black), Qt::NoBrush ) );
    setPen( QPen( QColor( Qt::black), 2 ) );

    moPolygon << QPointF(0, 0) << QPointF(5, 0)
              << QPointF(5, 5)   << QPointF(0, 5)
              << QPointF(0, 0);

    setPolygon( moPolygon);

    setFlag(QGraphicsItem::ItemIsMovable, true);
    setFlag(QGraphicsItem::ItemIsSelectable, true);
    setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);

    // recalculate id
    updateId();

    FSMElementManager::getInstance().addElement( this );
}
Beispiel #5
0
void RvctToolChain::setCompilerPath(const QString &path)
{
    if (m_compilerPath == path)
        return;

    m_compilerPath = path;
    m_version.reset();
    updateId();
}
Beispiel #6
0
inline void Element::updateId(const AtomicString& oldId, const AtomicString& newId)
{
    if (!isInTreeScope())
        return;

    if (oldId == newId)
        return;

    updateId(treeScope(), oldId, newId);
}
Beispiel #7
0
void Element::removedFrom(ContainerNode* insertionPoint)
{
    if (insertionPoint->isInTreeScope() && treeScope() == document()) {
        const AtomicString& idValue = getIdAttribute();
        if (!idValue.isNull())
            updateId(insertionPoint->treeScope(), idValue, nullAtom);
    }

    ContainerNode::removedFrom(insertionPoint);
}
Beispiel #8
0
void IdEditDialog::submit()
{
	if (mIsNew)
	{
		createId();
	}
	else
	{
		updateId();
	}
}
Beispiel #9
0
void Element::willModifyAttribute(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& newValue)
{
    if (name == HTMLNames::idAttr)
        updateId(oldValue, newValue);

    if (inActiveDocument() && styleChangeType() < SubtreeStyleChange && affectedByAttributeSelector(name.localName()))
        setNeedsStyleRecalc(LocalStyleChange);

    if (OwnPtr<MutationObserverInterestGroup> recipients = MutationObserverInterestGroup::createForAttributesMutation(*this, name))
        recipients->enqueueMutationRecord(MutationRecord::createAttributes(this, name, oldValue));
}
void Element::removedFromDocument()
{
    if (hasID()) {
        if (NamedAttrMap* attrs = namedAttrMap.get()) {
            Attribute* idItem = attrs->getAttributeItem(idAttr);
            if (idItem && !idItem->isNull())
                updateId(idItem->value(), nullAtom);
        }
    }

    ContainerNode::removedFromDocument();
}
Beispiel #11
0
void GccToolChain::forceTo32Bit(bool f)
{
    if (f == m_forcedTo32Bit)
        return;

    if (displayName() == defaultDisplayName())
        setDisplayName(typeName());

    m_forcedTo32Bit = f;
    m_targetAbi = Abi(); // Invalidate ABI.
    updateId();

    targetAbi();
}
Beispiel #12
0
void View::Management::ProductDialog::loadProduct()
{
    int precisionMoney = Persistence::Manager::readConfig("Money", "Application/Precision").toInt();

    updateId();
    _idLineEdit -> setEnabled(!IS_NEW(_product -> id()));
    _autoIdCheckBox -> setChecked(IS_NEW(_product -> id()));
    _nameLineEdit -> setText(_product -> name());
    _categoryComboBox -> setCurrentIndex(_categoryComboBox->findText(_product -> category() -> name()));
    _descriptionTextEdit -> setPlainText(_product -> description());
    _priceLineEdit -> setText(QString::number(_product -> price(),'f', precisionMoney));
    _priceTypeComboBox -> setCurrentIndex(static_cast<int>(_product -> priceType()));
    productModified(false);
}
void Element::insertedIntoDocument()
{
    // need to do superclass processing first so inDocument() is true
    // by the time we reach updateId
    ContainerNode::insertedIntoDocument();

    if (hasID()) {
        if (NamedAttrMap* attrs = namedAttrMap.get()) {
            Attribute* idItem = attrs->getAttributeItem(idAttr);
            if (idItem && !idItem->isNull())
                updateId(nullAtom, idItem->value());
        }
    }
}
Beispiel #14
0
void GccToolChain::setCompilerPath(const QString &path)
{
    if (path == m_compilerPath)
        return;

    if (displayName() == defaultDisplayName())
        setDisplayName(typeName());
    m_compilerPath = path;
    m_targetAbi = Abi();
    updateId();

    if (m_compilerPath.isEmpty())
        return;

    targetAbi(); // update ABI information (and default display name)
}
Beispiel #15
0
void Element::insertedInto(ContainerNode* insertionPoint)
{
    // need to do superclass processing first so inDocument() is true
    // by the time we reach updateId
    ContainerNode::insertedInto(insertionPoint);

    if (!insertionPoint->isInTreeScope())
        return;

    TreeScope& scope = insertionPoint->treeScope();
    if (scope != treeScope())
        return;

    const AtomicString& idValue = getIdAttribute();
    if (!idValue.isNull())
        updateId(scope, nullAtom, idValue);
}
Beispiel #16
0
bool WinCEToolChain::fromMap(const QVariantMap &data)
{
    if (!ToolChain::fromMap(data))
        return false;

    m_msvcVer = data.value(QLatin1String(msvcVerKeyC)).toString();
    m_ceVer = data.value(QLatin1String(ceVerKeyC)).toString();
    m_binPath = data.value(QLatin1String(binPathKeyC)).toString();
    m_includePath = data.value(QLatin1String(includePathKeyC)).toString();
    m_libPath = data.value(QLatin1String(libPathKeyC)).toString();
    m_vcvarsBat = data.value(QLatin1String(vcVarsKeyC)).toString();

    m_debuggerCommand = data.value(QLatin1String(debuggerCommandKeyC)).toString();
    const QString abiString = data.value(QLatin1String(supportedAbiKeyC)).toString();
    m_abi = Abi(abiString);
    updateId();

    return isValid();
}
void Element::setAttribute(const QualifiedName& name, const AtomicString& value, ExceptionCode&)
{
    document()->incDOMTreeVersion();

    // allocate attributemap if necessary
    Attribute* old = attributes(false)->getAttributeItem(name);

    if (name == idAttr)
        updateId(old ? old->value() : nullAtom, value);
    
    if (old && value.isNull())
        namedAttrMap->removeAttribute(name);
    else if (!old && !value.isNull())
        namedAttrMap->addAttribute(createAttribute(name, value));
    else if (old) {
        old->setValue(value);
        attributeChanged(old);
    }
}
Beispiel #18
0
WinCEToolChain::WinCEToolChain(const QString &name,
                               const Abi &abi,
                               const QString &vcvarsBat,
                               const QString &msvcVer,
                               const QString &ceVer,
                               const QString &binPath,
                               const QString &includePath,
                               const QString &libPath,
                               bool autodetect) :
    AbstractMsvcToolChain(QLatin1String(Constants::WINCE_TOOLCHAIN_ID), autodetect, abi, vcvarsBat),
    m_msvcVer(msvcVer),
    m_ceVer(ceVer),
    m_binPath(binPath),
    m_includePath(includePath),
    m_libPath(libPath)
{
    Q_ASSERT(!name.isEmpty());
    Q_ASSERT(!m_binPath.isEmpty());
    Q_ASSERT(!m_includePath.isEmpty());
    Q_ASSERT(!m_libPath.isEmpty());

    updateId();
    setDisplayName(name);
}
Beispiel #19
0
LaneSettings::LaneSettings(ProjectSettings *projectSettings, SettingsElement *parentSettingsElement, Lane *lane)
    : SettingsElement(projectSettings, parentSettingsElement, lane)
    , ui(new Ui::LaneSettings)
    , lane_(lane)
    , init_(false)
    , roadSystemItemPolyGraph_(NULL)
    , insertWidthSectionHandle_(NULL)
    , lswItem_(NULL)
{
    ui->setupUi(this);

	activateWidthGroupBox(false);
	activateInsertGroupBox(false);
	connect(ui->insertPushButton, SIGNAL(clicked(bool)), this, SLOT(activateInsertGroupBox(bool)));
	connect(ui->editPushButton, SIGNAL(clicked(bool)), this, SLOT(activateWidthGroupBox(bool)));

    // List //
    //
    QStringList typeNames;
    typeNames << Lane::parseLaneTypeBack(Lane::LT_NONE)
              << Lane::parseLaneTypeBack(Lane::LT_DRIVING)
              << Lane::parseLaneTypeBack(Lane::LT_STOP)
              << Lane::parseLaneTypeBack(Lane::LT_SHOULDER)
              << Lane::parseLaneTypeBack(Lane::LT_BIKING)
              << Lane::parseLaneTypeBack(Lane::LT_SIDEWALK)
              << Lane::parseLaneTypeBack(Lane::LT_BORDER)
              << Lane::parseLaneTypeBack(Lane::LT_RESTRICTED)
              << Lane::parseLaneTypeBack(Lane::LT_PARKING)
              << Lane::parseLaneTypeBack(Lane::LT_MWYENTRY)
              << Lane::parseLaneTypeBack(Lane::LT_MWYEXIT)
              << Lane::parseLaneTypeBack(Lane::LT_SPECIAL1)
              << Lane::parseLaneTypeBack(Lane::LT_SPECIAL2)
              << Lane::parseLaneTypeBack(Lane::LT_SPECIAL3);
    ui->typeBox->addItems(typeNames);

    /*heightGraph_ = new ProfileGraph(projectSettings->getProjectWidget(), projectSettings->getProjectData());
	heightGraph_->setParent(ui->widthGroup);
	ui->horizontalLayout_3->insertWidget(0,heightGraph_);
	//heightGraph_->getView()->setDragMode(QGraphicsView::ScrollHandDrag);
	//QGraphicsScene* pScene = new NoDeselectScene(this); 
    //heightGraph_->getView()->setScene(pScene);
	heightGraph_->getScene()->doDeselect(false);// we don't want to deselect ourselves if we click on the background, otherwise we delete ourselves--> chrash and it would not be practical anyway
	*/

    heightGraph_ = projectSettings->getProjectWidget()->getHeightGraph();

    laneEditor_ = dynamic_cast<LaneEditor *>(projectSettings->getProjectWidget()->getProjectEditor());
    if (!laneEditor_)
    {
        return; // another editor is active
    }

    roadSystemItemPolyGraph_ = new LaneWidthRoadSystemItem(heightGraph_, projectSettings->getProjectData()->getRoadSystem());
    heightGraph_->getScene()->addItem(roadSystemItemPolyGraph_);

    // Section Handle //
    //
    //insertWidthSectionHandle_ = new SectionHandle(roadSystemItemPolyGraph_);
    //insertWidthSectionHandle_->hide();
    roadSystemItemPolyGraph_->setSettings(this);
    roadSystemItemPolyGraph_->setAcceptHoverEvents(true);
    // Activate Road in ProfileGraph //
    //
    lswItem_ = new LaneSectionWidthItem(roadSystemItemPolyGraph_, lane_);
    //selectedElevationRoadItems_.insert(road, roadItem);

    // Fit View //
    //
    QRectF boundingBox = lswItem_->boundingRect();
    if (boundingBox.width() < 15.0)
    {
        boundingBox.setWidth(15.0);
    }
    if (boundingBox.height() < 10.0)
    {
        boundingBox.setHeight(10.0);
    }

    heightGraph_->getView()->fitInView(boundingBox);
    heightGraph_->getView()->zoomOut(Qt::Horizontal | Qt::Vertical);

    //ui->horizontalLayout_3->insertWidget(0,heightGraph_);
    //heightGraph_->show();
    // Initial Values //
    //
    updateId();
    updateType();
    updateLevel();
    updatePredecessor();
    updateSuccessor();
    updateWidth();

    // Done //
    //
    init_ = true;
}