@Override public boolean equals(Object obj) { return super.equals(obj); }
@Override public int hashCode() { return super.hashCode(); }
private void addEventQuery(Event next1, Set<String> output) { next1.preConfigure(); for (Object o : next1.getQueriesAll()) { StringBuilder query = (StringBuilder) o; output.add(query.toString()); } }
/** * Constructs an event with the given name * * @param name * The name of this event * @param eventType * The event type of this event * @param component * The component type of this event */ @SuppressWarnings("unchecked") public Event(String name, EventTypes eventType, ComponentHierarchyBase component) { super(ComponentTypes.Event); setID(getClassCanonicalName()); setName(name); setComponent(component); setEventType(eventType); returnVariable(StaticStrings.LOCAL_STORAGE_VARIABLE_KEY); }
/** * Sets JQuery and Angular enabled, adds the directive to angular, and the attribute to the component */ @Override public void preConfigure() { if (getComponent() != null) { getComponent().addAttribute(AngularAttributes.ngSlide, StaticStrings.STRING_ANGULAR_EVENT_START + renderVariables() + StaticStrings.STRING_CLOSING_BRACKET_SEMICOLON); } super.preConfigure(); }
private Set<String> buildEventQueries(ComponentHierarchyBase next, Set<String> output) { if (Event.class.isAssignableFrom(next.getClass())) { for (Object o : Event.class.cast(next) .getRunEvents()) { Event next1 = (Event) o; next1.preConfigure(); addEventQuery(next1, output); } } return output; }
/** * Render the variable return array * * @return */ public StringBuilder renderVariables() { StringBuilder s = new StringBuilder(StaticStrings.STRING_SQUARE_BRACE_OPEN); getVariables().forEach(event -> s.append(StaticStrings.STRING_SINGLE_QUOTES) .append(event) .append(StaticStrings.STRING_SINGLE_QUOTES) .append(StaticStrings.STRING_COMMNA)); StringBuilder s2; if (s.indexOf(StaticStrings.STRING_COMMNA) > 0) { s2 = s.deleteCharAt(s.lastIndexOf(StaticStrings.STRING_COMMNA)); } else { s2 = s; } s2.append(StaticStrings.STRING_SQUARE_BRACE_CLOSED); s2.append(",'") .append(getID()) .append(StaticStrings.STRING_SINGLE_QUOTES); s2.append(",'") .append(getClassCanonicalName()) .append(StaticStrings.STRING_SINGLE_QUOTES); return s2; }
@Override public void fireEvent(AjaxCall call, AjaxResponse response) { onChange(call, response); super.fireEvent(call, response); }
/** * Adds an on demand event to be performed after ajax response * * @param event * * @return */ @SuppressWarnings("unchecked") public J addOnDemandEvent(Event event) { getRunEvents().add(event); return (J) this; }
/** * Adds a variable to return on the call * * @param returnVariable * The name of the variable to return * * @return */ @SuppressWarnings("unchecked") public J returnVariable(String returnVariable) { getVariables().add(returnVariable); return (J) this; }
/** * Returns all the event queries from the components * * @return */ @JsonProperty("events") @JsonInclude(JsonInclude.Include.NON_EMPTY) protected Set<String> getEventQueries() { Set<String> list = new LinkedHashSet<>(); getEvents().forEach(event -> list.add(event.renderJavascript() .toString())); return list; }
/** * Finds the event in all this components and child components * * @param eventId * * @return * * @see ComponentEventBase#findEvent(String) */ @Override public ComponentEventBase findEvent(@NotNull String eventId) { for (C child : getChildren()) { for (Object jScript : child.getEventsAll()) { if (((Event) jScript) .getID() .equals(eventId)) { return (ComponentEventBase) jScript; } } } return null; }
/** * Sets JQuery and Angular enabled, adds the directive to angular, and the attribute to the component */ @Override public void preConfigure() { if (getComponent() != null) { getComponent().addAttribute(AngularAttributes.ngBlur, StaticStrings.STRING_ANGULAR_EVENT_START + renderVariables() + StaticStrings.STRING_CLOSING_BRACKET_SEMICOLON); } super.preConfigure(); }
/** * Constructs an event with the given name * * @param name * The name of this event * @param eventType * The event type of this event * @param component * The component type of this event */ @SuppressWarnings("unchecked") public Event(String name, EventTypes eventType, ComponentHierarchyBase component) { super(ComponentTypes.Event); setID(getClassCanonicalName()); setName(name); setComponent(component); setEventType(eventType); returnVariable(StaticStrings.LOCAL_STORAGE_VARIABLE_KEY); }
private Set<String> buildEventQueries(ComponentHierarchyBase next, Set<String> output) { if (Event.class.isAssignableFrom(next.getClass())) { for (Object o : Event.class.cast(next) .getRunEvents()) { Event next1 = (Event) o; next1.preConfigure(); addEventQuery(next1, output); } } return output; }
/** * Render the variable return array * * @return */ public StringBuilder renderVariables() { StringBuilder s = new StringBuilder(StaticStrings.STRING_SQUARE_BRACE_OPEN); getVariables().forEach(event -> s.append(StaticStrings.STRING_SINGLE_QUOTES) .append(event) .append(StaticStrings.STRING_SINGLE_QUOTES) .append(StaticStrings.STRING_COMMNA)); StringBuilder s2; if (s.indexOf(StaticStrings.STRING_COMMNA) > 0) { s2 = s.deleteCharAt(s.lastIndexOf(StaticStrings.STRING_COMMNA)); } else { s2 = s; } s2.append(StaticStrings.STRING_SQUARE_BRACE_CLOSED); s2.append(",'") .append(getID()) .append(StaticStrings.STRING_SINGLE_QUOTES); s2.append(",'") .append(getClassCanonicalName()) .append(StaticStrings.STRING_SINGLE_QUOTES); return s2; }
@Override public void fireEvent(AjaxCall call, AjaxResponse response) { onChange(call, response); super.fireEvent(call, response); }
/** * Adds an on demand event to be performed after ajax response * * @param event * * @return */ @SuppressWarnings("unchecked") public J addOnDemandEvent(Event event) { getRunEvents().add(event); return (J) this; }