ItEr27S09CUCreacionProxectoPlanificacionItEr26S10: Disabled menuitems styling

This commit is contained in:
Lorenzo Tilve 2009-09-25 17:34:05 +02:00 committed by Javier Moran Rua
parent ba345b4c7a
commit 30d89e9529
5 changed files with 88 additions and 30 deletions

View file

@ -32,6 +32,7 @@ public class CustomMenuController extends Div implements IMenuItemsRegister {
private final String unencodedURL;
private final List<CustomMenuItem> children;
private boolean activeParent;
private boolean disabled;
public String getName() {
return name;
@ -49,12 +50,18 @@ public class CustomMenuController extends Div implements IMenuItemsRegister {
this(name, url, new ArrayList<CustomMenuItem>());
}
public CustomMenuItem(String name, String url, boolean disabled) {
this(name, url, new ArrayList<CustomMenuItem>());
this.disabled = disabled;
}
public CustomMenuItem(String name, String url,
List<CustomMenuItem> children) {
this.name = name;
this.encodedURL = Executions.getCurrent().encodeURL(url);
this.unencodedURL = url;
this.children = children;
this.disabled = false;
}
public void appendChildren(CustomMenuItem newChildren) {
@ -65,6 +72,10 @@ public class CustomMenuController extends Div implements IMenuItemsRegister {
return activeParent;
}
public boolean isDisabled() {
return disabled;
}
public boolean contains(String requestPath) {
for (CustomMenuItem item : thisAndChildren()) {
if (requestContains(requestPath, item.unencodedURL))
@ -114,7 +125,12 @@ public class CustomMenuController extends Div implements IMenuItemsRegister {
private CustomMenuController topItem(String name, String url,
CustomMenuItem... items) {
CustomMenuItem parent = new CustomMenuItem(name, url);
return topItem(name, url, false, items);
}
private CustomMenuController topItem(String name, String url,
boolean disabled, CustomMenuItem... items) {
CustomMenuItem parent = new CustomMenuItem(name, url, disabled);
this.firstLevel.add(parent);
for (CustomMenuItem child : items) {
parent.appendChildren(child);
@ -122,31 +138,25 @@ public class CustomMenuController extends Div implements IMenuItemsRegister {
return this;
}
private CustomMenuItem subItem(String name, String url, boolean disabled) {
return new CustomMenuItem(name, url, disabled);
}
private CustomMenuItem subItem(String name, String url) {
return new CustomMenuItem(name, url);
}
public void initializeMenu() {
topItem(
_("Planification"),
"/planner/main.zul");
topItem(_("Planification"),"/planner/main.zul");
topItem(_("Resources"), "/resources/worker/worker.zul",
subItem(
_("Workers List"),
"/resources/worker/worker.zul#list"),
subItem(
_("Manage criterions"),
"/resources/criterions/criterions.zul"));
subItem(_("Workers List"),"/resources/worker/worker.zul#list"),
subItem(_("Manage criterions"),"/resources/criterions/criterions.zul"));
topItem(_("Orders"),
"/orders/orders.zul",
subItem(_("Orders list"),
"/orders/orders.zul"),
subItem(_("Work activities types"),
"/orders/orders.zul"),
subItem(_("Models"),
"/orders/orders.zul"));
topItem(_("Orders"), "/orders/orders.zul",
subItem(_("Orders list"),"/orders/orders.zul"),
subItem(_("Work activities types"),"/orders/orders.zul", true),
subItem(_("Models"),"/orders/orders.zul", true));
topItem(_("Work reports"), "/workreports/workReportTypes.zul", subItem(
_("Work report types"), "/workreports/workReportTypes.zul"),
@ -157,13 +167,10 @@ public class CustomMenuController extends Div implements IMenuItemsRegister {
"/advance/advanceTypes.zul",
subItem(_("Manage advances types"),
"/advance/advanceTypes.zul"),
subItem(_("Calendars"),
"/calendars/calendars.zul"),
subItem(_("Label types"),
"/labels/labelTypes.zul"));
subItem(_("Calendars"), "/calendars/calendars.zul"),
subItem(_("Label types"), "/labels/labelTypes.zul"));
topItem(_("Quality management"),
"/");
topItem(_("Quality management"), "/", true);
}
private Hbox getRegisteredItemsInsertionPoint() {
@ -236,4 +243,4 @@ public class CustomMenuController extends Div implements IMenuItemsRegister {
return Executions.getCurrent().getContextPath();
}
}
}

View file

@ -23,6 +23,21 @@ a.menuup:hover {
background-image: url(../img/pestana_sobre.gif);
}
.menuup_desactivado {
font-family: Tahoma, Arial, Helvetica, sans-serif;
text-decoration: none;
font-size: 11px;
color: #77B6D0;
display: block;
padding-top: 10px;
padding-left: 6px;
width: 125px;
background-repeat: no-repeat;
background-position: -4px 4px;
padding-bottom: 5px;
background-image: url(../img/pestana_desactivada.gif);
}
.sub_menu {
font-family: Tahoma, Arial, Helvetica, sans-serif, Tahoma;
font-size: 11px;
@ -37,6 +52,35 @@ a.sub_menu:hover {
color: #FFFFFF;
text-decoration: underline;
}
.sub_menu_activo {
font-family: Tahoma, Arial, Helvetica, sans-serif, Tahoma;
font-size: 11px;
color: #2A83B4;
background-color: #CBDBEB;
text-decoration: none;
display: block;
line-height: 16px;
padding-right: 3px;
padding-left: 3px;
text-decoration: none;
background-image: url(../img/pest_sub1.gif);
background-repeat: no-repeat;
background-position: right top;
}
.sub_menu_desactivado {
font-family: Tahoma, Arial, Helvetica, sans-serif, Tahoma;
font-size: 11px;
color: #ABB8CD;
text-decoration: none;
display: block;
line-height: 22px;
padding-right: 3px;
padding-left: 3px;
font-style: italic;
}
.menuup_activa {
font-family: Tahoma, Arial, Helvetica, sans-serif;
text-decoration: none;

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -3,8 +3,11 @@
<n:table border="0" cellspacing="0" cellpadding="0">
<n:tr>
<n:td forEach="${menuContainer.customMenuItems}">
<n:a href="${each.url}" class=
"menuup${(each.activeParent?'_activa':'')}">${i18n:_(each.name)}</n:a>
<n:a if="${!(each.disabled)}" href="${each.url}"
class="menuup${(each.activeParent?'_activa':'')}">${i18n:_(each.name)}</n:a>
<n:span if="${(each.disabled)}" class="menuup_desactivado">${i18n:_(each.name)}
</n:span>
</n:td>
</n:tr>
</n:table>
@ -15,8 +18,12 @@
<n:table border="0" cellspacing="0" cellpadding="0">
<n:tr>
<n:td width="10" />
<n:td forEach="${menuContainer.customMenuSecondaryItems}">
<n:a href="${each.url}" class="sub_menu">${i18n:_(each.name)}</n:a>
<n:td
forEach="${menuContainer.customMenuSecondaryItems}">
<n:a if="${!(each.disabled)}" href="${each.url}"
class="sub_menu">${i18n:_(each.name)}</n:a>
<n:span if="${(each.disabled)}"
class="sub_menu_desactivado">${i18n:_(each.name)}</n:span>
<n:td width="14"
background="${menuContainer.contextPath}/common/img/sub_separacion.gif" />
</n:td>
@ -26,4 +33,4 @@
</n:td>
</n:tr>
</n:table>
</div>
</div>