001 package com.oxygenxml.validate.nvdl; 002 003 import org.xml.sax.ContentHandler; 004 005 /** 006 * Attach place holder result action. 007 * This action replaces a section with a placeholder element. 008 */ 009 class AttachPlaceholderAction extends ResultAction { 010 /** 011 * Creates an attachPlaceHolder action with a given mode usage. 012 * 013 * @param modeUsage 014 * The action mode usage. 015 */ 016 AttachPlaceholderAction(ModeUsage modeUsage) { 017 super(modeUsage); 018 } 019 020 /** 021 * Perform this action. 022 * 023 * @param handler 024 * the handler this action is performed on 025 * @param state 026 * the section state. 027 */ 028 void perform(ContentHandler handler, SectionState state) { 029 state.attachPlaceholder(getModeUsage(), handler); 030 } 031 032 /** 033 * Get a new attach place holder action with a mode usage with the current mode changed. 034 * This is useful when we have modes extending other modes as we need to get 035 * the actions from the base mode as actions on the new mode. 036 */ 037 ResultAction changeCurrentMode(Mode mode) { 038 return new AttachPlaceholderAction(getModeUsage().changeCurrentMode(mode)); 039 } 040 }