@Override @OverridingMethodsMustInvokeSuper protected void onFinalizeNodeState (@Nonnull final IHCConversionSettingsToNode aConversionSettings, @Nonnull final IHCHasChildrenMutable <?, ? super IHCNode> aTargetNode) { super.onFinalizeNodeState (aConversionSettings, aTargetNode); // Unfocusable? if (m_bUnfocusable) addEventHandler (EJSEvent.FOCUS, FakeJS.JS_BLUR); }
public boolean containsDataAttr (@Nullable final String sName) { return containsCustomAttr (makeDataAttrName (sName)); }
@Override @Nonnull @OverridingMethodsMustInvokeSuper protected IMicroNode internalConvertToMicroNode (@Nonnull final IHCConversionSettingsToNode aConversionSettings) { // Create the element final IMicroElement ret = createMicroElement (aConversionSettings); if (ret == null) throw new IllegalStateException ("Created a null element!"); // Set all HTML attributes etc. fillMicroElement (ret, aConversionSettings); // Optional callback after everything was done (implementation dependent) finishMicroElement (ret, aConversionSettings); return ret; }
@Nullable public String getDataAttrValue (@Nullable final String sName) { return getCustomAttrValue (makeDataAttrName (sName)); }
@Override protected void fillMicroElement (final IMicroElement aElement, final IHCConversionSettingsToNode aConversionSettings) { super.fillMicroElement (aElement, aConversionSettings); if (m_bNoShade) aElement.setAttribute (CHTMLAttributes.NOSHADE, CHTMLAttributes.NOSHADE); }
@Override protected void onConsistencyCheck (@Nonnull final IHCConversionSettingsToNode aConversionSettings) { final EHTMLVersion eHTMLVersion = aConversionSettings.getHTMLVersion (); // Deprecation is checked for all elements _checkDeprecation (getClass (), getTagName (), eHTMLVersion); if (eHTMLVersion.isAtLeastHTML5 ()) { if (m_aCustomAttrs != null) for (final Map.Entry <String, String> aEntry : m_aCustomAttrs.entrySet ()) { final String sAttrName = aEntry.getKey (); // Link element often contains arbitrary attributes if (!StringHelper.startsWith (sAttrName, CHTMLAttributes.HTML5_PREFIX_DATA) && !StringHelper.startsWith (sAttrName, CHTMLAttributes.PREFIX_ARIA) && m_eElement != EHTMLElement.LINK) { HCConsistencyChecker.consistencyError ("Custom HTML5 attribute '" + sAttrName + "' does not start with one of the proposed prefixes '" + CHTMLAttributes.HTML5_PREFIX_DATA + "' or '" + CHTMLAttributes.PREFIX_ARIA + "'"); } } } }
aElement.setAttribute (CHTMLAttributes.DIR, m_eDirection); aElement.setAttribute (CHTMLAttributes.CLASS, getAllClassesAsString ()); aElement.setAttribute (CHTMLAttributes.STYLE, getAllStylesAsString (aConversionSettings.getCSSWriterSettings ()));
@Override protected void fillMicroElement (@Nonnull final IMicroElement aElement, @Nonnull final IHCConversionSettingsToNode aConversionSettings) { super.fillMicroElement (aElement, aConversionSettings); aElement.appendText (m_sContent); } }
@Override @OverridingMethodsMustInvokeSuper protected void fillMicroElement (final IMicroElement aElement, final IHCConversionSettingsToNode aConversionSettings) { super.fillMicroElement (aElement, aConversionSettings); if (StringHelper.hasText (m_sWidth)) aElement.setAttribute (CHTMLAttributes.WIDTH, m_sWidth); if (m_nSpan > 0) aElement.setAttribute (CHTMLAttributes.SPAN, m_nSpan); }
@Override protected void fillMicroElement (final IMicroElement aElement, final IHCConversionSettingsToNode aConversionSettings) { super.fillMicroElement (aElement, aConversionSettings); if (m_aHref != null) aElement.setAttribute (CHTMLAttributes.HREF, m_aHref.getAsStringWithEncodedParameters (aConversionSettings.getCharset ())); if (m_aTarget != null) aElement.setAttribute (CHTMLAttributes.TARGET, m_aTarget.getAttrValue ()); }
@Override protected void fillMicroElement (final IMicroElement aElement, final IHCConversionSettingsToNode aConversionSettings) { super.fillMicroElement (aElement, aConversionSettings); aElement.setAttribute (CHTMLAttributes.TYPE, m_aType.getAsString ()); if (hasAnyMedia ()) aElement.setAttribute (CHTMLAttributes.MEDIA, m_aMediaList.getMediaString ()); setInlineStyle (aElement, m_sContent, m_eMode); }
@Override protected void fillMicroElement (final IMicroElement aElement, final IHCConversionSettingsToNode aConversionSettings) { super.fillMicroElement (aElement, aConversionSettings); aElement.setAttribute (CHTMLAttributes.TYPE, m_aType.getAsString ()); if (StringHelper.hasText (m_sCharset)) aElement.setAttribute (CHTMLAttributes.CHARSET, m_sCharset); if (m_eCrossOrigin != null) aElement.setAttribute (CHTMLAttributes.CROSSORIGIN, m_eCrossOrigin); if (StringHelper.hasText (m_sIntegrity)) aElement.setAttribute (CHTMLAttributes.INTEGRITY, m_sIntegrity); }
@Override @OverridingMethodsMustInvokeSuper protected void fillMicroElement (final IMicroElement aElement, final IHCConversionSettingsToNode aConversionSettings) { super.fillMicroElement (aElement, aConversionSettings); if (m_bDisabled) aElement.setAttribute (CHTMLAttributes.DISABLED, CHTMLAttributeValues.DISABLED); // focus handling is performed in HCDefaultCustomizer! if (StringHelper.hasText (m_sName)) aElement.setAttribute (CHTMLAttributes.NAME, m_sName); if (m_bReadOnly) aElement.setAttribute (CHTMLAttributes.READONLY, CHTMLAttributeValues.READONLY); if (m_bRequired) aElement.setAttribute (CHTMLAttributes.REQUIRED, CHTMLAttributeValues.REQUIRED); if (m_bAutoFocus) aElement.setAttribute (CHTMLAttributes.AUTOFOCUS, CHTMLAttributeValues.AUTOFOCUS); }
@Override protected void fillMicroElement (final IMicroElement aElement, final IHCConversionSettingsToNode aConversionSettings) { super.fillMicroElement (aElement, aConversionSettings); if (StringHelper.hasText (m_sName)) aElement.setAttribute (CHTMLAttributes.NAME, m_sName); if (StringHelper.hasText (m_sHttpEquiv)) aElement.setAttribute (CHTMLAttributes.HTTP_EQUIV, m_sHttpEquiv); if (StringHelper.hasText (m_sContent)) aElement.setAttribute (CHTMLAttributes.CONTENT, m_sContent); if (StringHelper.hasText (m_sCharset)) aElement.setAttribute (CHTMLAttributes.CHARSET, m_sCharset); }
@Override protected void fillMicroElement (final IMicroElement aElement, final IHCConversionSettingsToNode aConversionSettings) { super.fillMicroElement (aElement, aConversionSettings); if (StringHelper.hasText (m_sName)) aElement.setAttribute (CHTMLAttributes.NAME, m_sName); if (StringHelper.hasText (m_sValue)) aElement.setAttribute (CHTMLAttributes.VALUE, m_sValue); if (m_eValueType != null) aElement.setAttribute (CHTMLAttributes.VALUETYPE, m_eValueType); if (m_aType != null) aElement.setAttribute (CHTMLAttributes.TYPE, m_aType.getAsString ()); // Should not be self closed! aElement.appendText (""); }
@Override protected void fillMicroElement (@Nonnull final IMicroElement eHead, @Nonnull final IHCConversionSettingsToNode aConversionSettings) { super.fillMicroElement (eHead, aConversionSettings); if (StringHelper.hasText (m_sProfile)) eHead.setAttribute (CHTMLAttributes.PROFILE, m_sProfile); // Append meta element first for charset encoding! for (final HCMeta aMetaElement : m_aMetaElements) eHead.appendChild (aMetaElement.convertToMicroNode (aConversionSettings)); // page title eHead.appendChild (m_aPageTitle.convertToMicroNode (aConversionSettings)); // base eHead.appendChild (m_aBase.convertToMicroNode (aConversionSettings)); // links emitLinks (eHead, aConversionSettings); // CSS stuff emitCSS (eHead, aConversionSettings); // JS files emitJS (eHead, aConversionSettings); // Ensure tag is not self-closed if (!eHead.hasChildren () && EHTMLElement.HEAD.mayNotBeSelfClosed ()) eHead.appendText (""); }
@Override protected void fillMicroElement (final IMicroElement aElement, final IHCConversionSettingsToNode aConversionSettings) { super.fillMicroElement (aElement, aConversionSettings); if (m_bAutoFocus) aElement.setAttribute (CHTMLAttributes.AUTOFOCUS, CHTMLAttributeValues.AUTOFOCUS); if (StringHelper.hasText (m_sChallenge)) aElement.setAttribute (CHTMLAttributes.CHALLENGE, m_sChallenge); if (m_bDisabled) aElement.setAttribute (CHTMLAttributes.DISABLED, CHTMLAttributeValues.DISABLED); if (StringHelper.hasText (m_sForm)) aElement.setAttribute (CHTMLAttributes.FORM, m_sForm); aElement.setAttribute (CHTMLAttributes.KEYTYPE, m_eKeyType); if (StringHelper.hasText (m_sName)) aElement.setAttribute (CHTMLAttributes.NAME, m_sName); } }
@Override protected void fillMicroElement (final IMicroElement aElement, final IHCConversionSettingsToNode aConversionSettings) { super.fillMicroElement (aElement, aConversionSettings); if (m_aSrc != null) aElement.setAttribute (CHTMLAttributes.SRC, m_aSrc.getAsStringWithEncodedParameters (aConversionSettings.getCharset ())); if (m_nWidth > 0) aElement.setAttribute (CHTMLAttributes.WIDTH, m_nWidth); if (m_nHeight > 0) aElement.setAttribute (CHTMLAttributes.HEIGHT, m_nHeight); if (StringHelper.hasText (m_sPluginURL)) aElement.setAttribute (CHTMLAttributes.PLUGINURL, m_sPluginURL); if (StringHelper.hasText (m_sPluginsPage)) aElement.setAttribute (CHTMLAttributes.PLUGINSPAGE, m_sPluginsPage); if (m_bAutoStart) aElement.setAttribute (CHTMLAttributes.AUTOSTART, Boolean.toString (m_bAutoStart)); if (m_bLoop) aElement.setAttribute (CHTMLAttributes.LOOP, Boolean.toString (m_bLoop)); if (StringHelper.hasText (m_sPalette)) aElement.setAttribute (CHTMLAttributes.PALETTE, m_sPalette); if (m_aType != null) aElement.setAttribute (CHTMLAttributes.TYPE, m_aType.getAsString ()); }
@Override @OverrideOnDemand @OverridingMethodsMustInvokeSuper protected void fillMicroElement (final IMicroElement aElement, final IHCConversionSettingsToNode aConversionSettings) { super.fillMicroElement (aElement, aConversionSettings); if (hasChildren ()) for (final CHILDTYPE aChild : getChildrenFormEmitting (m_aChildren)) aElement.appendChild (aChild.convertToMicroNode (aConversionSettings)); if (!aElement.hasChildren ()) { // If no children are present, add an empty text node so that an opening // and a closing tag are written separately // Note: just using "hasChildren" is not enough, in case a child is // present, that is not rendered! if (!getElement ().mayBeSelfClosed ()) aElement.appendText (""); } }
@Override protected void fillMicroElement (final IMicroElement aElement, final IHCConversionSettingsToNode aConversionSettings) { super.fillMicroElement (aElement, aConversionSettings); aElement.setAttribute (CHTMLAttributes.FRAMEBORDER, m_bFrameBorder ? "1" : "0"); if (StringHelper.hasText (m_sLongDesc)) aElement.setAttribute (CHTMLAttributes.LONGDESC, m_sLongDesc); if (m_nMarginWidth >= 0) aElement.setAttribute (CHTMLAttributes.MARGINWIDTH, m_nMarginWidth); if (m_nMarginHeight >= 0) aElement.setAttribute (CHTMLAttributes.MARGINHEIGHT, m_nMarginHeight); if (StringHelper.hasText (m_sName)) aElement.setAttribute (CHTMLAttributes.NAME, m_sName); if (m_bNoResize) aElement.setAttribute (CHTMLAttributes.NORESIZE, CHTMLAttributes.NORESIZE); if (m_eScrolling != null) aElement.setAttribute (CHTMLAttributes.SCROLLING, m_eScrolling); if (StringHelper.hasText (m_sSrc)) aElement.setAttribute (CHTMLAttributes.SRC, m_sSrc); }