private MacroDescriptor generateDisableMacroDescriptor() { final MacroKey macroKey = MacroKey.from(ApplicationKey.SYSTEM, "disable"); final Form form = Form.create() .addFormItem(createTextAreaInput("body", "Contents").occurrences(1, 1).build()) .build(); return create(macroKey, "Disable macros", "Contents of this macro will not be formatted", form); }
private MacroDescriptor generateEmbedIFrameMacroDescriptor() { final MacroKey macroKey = MacroKey.from(ApplicationKey.SYSTEM, "embed"); final Form form = Form.create() .addFormItem(createTextAreaInput("body", "IFrame HTML").occurrences(1, 1).build()) .build(); return create(macroKey, "Embed IFrame", "Generic iframe embedder", form); }
private MacroDescriptor create( final MacroKey macroKey, final String displayName, final String description, final Form form) { return MacroDescriptor.create() .key(macroKey) .displayName(displayName) .description(description) .form(form) .icon(IconLoader.loadIcon(this.getClass(), MACRO_DESCRIPTORS_FOLDER, macroKey.getName())) .build(); }
public MacroDescriptor getByKey(final MacroKey key) { if (!ApplicationKey.SYSTEM.equals(key.getApplicationKey())) { return null; } return macrosByName.get(key.getName().toLowerCase()); }