Skip to content

Commit

Permalink
Removing deprecated code
Browse files Browse the repository at this point in the history
  • Loading branch information
cuioss committed Jul 28, 2023
1 parent 4cc7eec commit 18c73d9
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public interface HistoryManager extends Serializable, Iterable<ViewIdentifier> {

/**
* Adds the current view to the {@link HistoryManager}. This method is usually called
* programmatically, not by an {@link ComponentSystemEvent}. Within the cdi-portal this is done
* programmatically, not by an {@link ComponentSystemEvent}. Within the CUI-portal this is done
* with a {@link PhaseListener}. <em>Caution</em>: The caller must ensure that this method is
* not called with {@link FacesContext#isPostback()}
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,51 @@
public interface NavigationMenuItem extends Serializable, Comparable<NavigationMenuItem> {

/**
* @return the (technical) ID of the menu item. This may be utilized for technical aspects like
* access rights or dynamically hiding the corresponding menu. Mandatory.
* @return the (technical) ID of the menu item. This may be utilized for
* technical aspects like access rights or dynamically hiding the
* corresponding menu. Mandatory.
*/
String getId();

/**
* <p>
* Ordering of {@link NavigationMenuItem}s: The usual range is 1 &lt; {@link #getOrder()} &lt;
* 50. For
* the top-level elements this will result in items with a lower order to be ordered to the left
* side, while a higher order will result in being put to the right side. For container elements
* (Dropdowns) a lower ordered item will be put to the top of the list, while a higher ordered
* item will be be put to the bottom.
* Ordering of {@link NavigationMenuItem}s: The usual range is 1 &lt;
* {@link #getOrder()} &lt; 50. For the top-level elements this will result in
* items with a lower order to be ordered to the left side, while a higher order
* will result in being put to the right side. For container elements
* (Dropdowns) a lower ordered item will be put to the top of the list, while a
* higher ordered item will be be put to the bottom.
* </p>
* Sample from the portal:
* <ul>
* <li>The logout menu item has the order '48', will therefore be rendered to the very
* right</li>
* <li>The user menu item has the order '40', will therefore be rendered left compared to the
* logout-item, but right to all other items assuming they have a order &lt; 40</li>
* <li>The logout menu item has the order '48', will therefore be rendered to
* the very right</li>
* <li>The user menu item has the order '40', will therefore be rendered left
* compared to the logout-item, but right to all other items assuming they have
* a order &lt; 40</li>
* <li>The user Menu provides two items as default.</li>
* </ul>
*
* @return the number for the ordering for the concrete {@link NavigationMenuItem}. The lower
* the number the higher the element is displayed. The default implementations like
* {@link NavigationMenuItemImpl} default to 25. The number is used implicitly by
* {@link Comparable#compareTo(Object)}.
* @return the number for the ordering for the concrete
* {@link NavigationMenuItem}. The lower the number the higher the
* element is displayed. The default implementations like
* {@link NavigationMenuItemImpl} default to 25. The number is used
* implicitly by {@link Comparable#compareTo(Object)}.
*/
Integer getOrder();

/**
* @return the ID of the parent {@link NavigationMenuItem}. This is needed for nesting the
* Menus dynamically. If it returns 'top' it is assumed to be a top-level
* element.
* @return the ID of the parent {@link NavigationMenuItem}. This is needed for
* nesting the Menus dynamically. If it returns 'top' it is assumed to
* be a top-level element.
*/
String getParentId();

/**
* @return the resolved title to display for this menu-item: Optional for non separator items
* but recommended to be used (accessibility). <em>Caution:</em> check with
* {@link #isTitleAvailable()} before accessing
* @return the resolved title to display for this menu-item: Optional for non
* separator items but recommended to be used (accessibility).
* <em>Caution:</em> check with {@link #isTitleAvailable()} before
* accessing
*/
String getResolvedTitle();

Expand All @@ -70,23 +74,19 @@ public interface NavigationMenuItem extends Serializable, Comparable<NavigationM
boolean isTitleAvailable();

/**
* @return The css class to be utilized for displaying a corresponding icon. Optional
* @return The css class to be utilized for displaying a corresponding icon.
* Optional
*/
String getIconStyleClass();

/**
* @return flag indicating whether the navigation element is disabled
*/
boolean isDisabled();

/**
* @return flag indicating whether the navigation element should be rendered
*/
boolean isRendered();

/**
* @return boolean indicating whether the current {@link NavigationMenuItem} is active, aka
* selected.
* @return boolean indicating whether the current {@link NavigationMenuItem} is
* active, aka selected.
*/
default boolean isActive() {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,9 @@ public class NavigationMenuContainerRenderer {
* @param idExtension
* @throws IOException
*/
static void renderBegin(final FacesContext context,
final DecoratingResponseWriter<NavigationMenuComponent> writer,
final NavigationMenuItemContainer model,
final NavigationMenuComponent component,
final boolean parentIsContainer,
final String idExtension)
throws IOException {
static void renderBegin(final FacesContext context, final DecoratingResponseWriter<NavigationMenuComponent> writer,
final NavigationMenuItemContainer model, final NavigationMenuComponent component,
final boolean parentIsContainer, final String idExtension) throws IOException {
if (!model.isRendered()) {
return;
}
Expand All @@ -74,8 +70,7 @@ static void renderBegin(final FacesContext context,
writer.withClientId(idExtension);
writer.withPassThroughAttributes();
writer.withAttributeStyle(component.getStyle());
writer.withStyleClass(component.getStyleClassBuilder()
.append(CssBootstrap.LIST_DROPDOWN)
writer.withStyleClass(component.getStyleClassBuilder().append(CssBootstrap.LIST_DROPDOWN)
.appendIfTrue(CssBootstrap.LIST_DROP_DOWN_SUBMENU, parentIsContainer));

if (model.isActive()) {
Expand All @@ -96,25 +91,21 @@ static void renderBegin(final FacesContext context,
* @throws IOException
*/
static void renderEnd(final DecoratingResponseWriter<NavigationMenuComponent> writer,
final NavigationMenuItemContainer model)
throws IOException {
final NavigationMenuItemContainer model) throws IOException {
if (!model.isRendered()) {
return;
}
writer.withEndElement(Node.UL);
writer.withEndElement(Node.LI);
}

private static void renderCmdLink(final FacesContext context,
final NavigationMenuItemContainer model,
final boolean parentIsContainer)
throws IOException {
private static void renderCmdLink(final FacesContext context, final NavigationMenuItemContainer model,
final boolean parentIsContainer) throws IOException {

final var application = context.getApplication();

final var commandLink =
(HtmlOutcomeTargetLink) application.createComponent(HtmlOutcomeTargetLink.COMPONENT_TYPE);
commandLink.setDisabled(model.isDisabled());
final var commandLink = (HtmlOutcomeTargetLink) application
.createComponent(HtmlOutcomeTargetLink.COMPONENT_TYPE);
commandLink.setStyleClass(CssBootstrap.LIST_DROP_DOWN_TOGGLE.getStyleClass());
commandLink.getPassThroughAttributes().put("data-toggle", "dropdown");

Expand All @@ -137,8 +128,7 @@ private static void renderCmdLink(final FacesContext context,
commandLink.getChildren().add(outputText);

// Collapse Icon
final var caret =
(IconComponent) context.getApplication().createComponent(BootstrapFamily.ICON_COMPONENT);
final var caret = (IconComponent) context.getApplication().createComponent(BootstrapFamily.ICON_COMPONENT);
if (parentIsContainer) {
caret.setIcon(ICON_SUB_MENU);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,9 @@ public class NavigationMenuExternalSingleRenderer {
* @param idExtension
* @throws IOException
*/
static void render(final FacesContext context,
final DecoratingResponseWriter<NavigationMenuComponent> writer,
final NavigationMenuItemExternalSingle model,
final NavigationMenuComponent component,
final String idExtension)
throws IOException {
static void render(final FacesContext context, final DecoratingResponseWriter<NavigationMenuComponent> writer,
final NavigationMenuItemExternalSingle model, final NavigationMenuComponent component,
final String idExtension) throws IOException {
if (!model.isRendered()) {
return;
}
Expand All @@ -70,16 +67,12 @@ static void render(final FacesContext context,
writer.withEndElement(Node.LI);
}

private static void renderCmdLink(final FacesContext context,
final NavigationMenuItemExternalSingle model)
throws IOException {
private static void renderCmdLink(final FacesContext context, final NavigationMenuItemExternalSingle model)
throws IOException {
final var application = context.getApplication();

final var commandLink =
(HtmlOutputLink) application.createComponent(HtmlOutputLink.COMPONENT_TYPE);
final var commandLink = (HtmlOutputLink) application.createComponent(HtmlOutputLink.COMPONENT_TYPE);
commandLink.setValue(model.getHRef());
commandLink.setOnclick(model.getOnClickAction());// TODO raus
commandLink.setDisabled(model.isDisabled());
commandLink.setTarget(model.getTarget());

// Title
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,9 @@ public class NavigationMenuSingleRenderer {
* @param idExtension
* @throws IOException
*/
static void render(final FacesContext context,
final DecoratingResponseWriter<NavigationMenuComponent> writer,
final NavigationMenuItemSingle model,
final NavigationMenuComponent component,
final String idExtension)
throws IOException {
static void render(final FacesContext context, final DecoratingResponseWriter<NavigationMenuComponent> writer,
final NavigationMenuItemSingle model, final NavigationMenuComponent component, final String idExtension)
throws IOException {
if (!model.isRendered()) {
return;
}
Expand All @@ -72,16 +69,13 @@ static void render(final FacesContext context,
writer.withEndElement(Node.LI);
}

private static void renderCmdLink(final FacesContext context,
final NavigationMenuItemSingle model)
throws IOException {
private static void renderCmdLink(final FacesContext context, final NavigationMenuItemSingle model)
throws IOException {
final var application = context.getApplication();

final var commandLink =
(HtmlOutcomeTargetLink) application.createComponent(HtmlOutcomeTargetLink.COMPONENT_TYPE);
final var commandLink = (HtmlOutcomeTargetLink) application
.createComponent(HtmlOutcomeTargetLink.COMPONENT_TYPE);
commandLink.setOutcome(model.getOutcome());
commandLink.setOnclick(model.getOnClickAction());// TODO raus
commandLink.setDisabled(model.isDisabled());
commandLink.setTarget(model.getTarget());

// Output params
Expand Down

0 comments on commit 18c73d9

Please sign in to comment.