IDEMPIERE-4561 Font Icons not used in several points #3 (#1176)

* IDEMPIERE-4561 Font Icons not used in several points #3

(cherry picked from commit ba469f1bf60a9e838fbcce7b061bf9b0a9f9fbd3)

* IDEMPIERE-4561 Font Icons not used in several points #3

(cherry picked from commit 0db485636889725293f7b8b340518a7c8a9f4519)
This commit is contained in:
Anozi Mada 2022-02-12 12:57:19 +07:00 committed by GitHub
parent 0ee5faec8e
commit 5598f47b49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 97 additions and 21 deletions

View File

@ -290,9 +290,13 @@ public class BreadCrumb extends Div implements EventListener<Event> {
pathLabel.addEventListener(Events.ON_MOUSE_OVER, listener);
pathLabel.addEventListener(Events.ON_MOUSE_OUT, listener);
pathLabel.addEventListener(ON_MOUSE_OVER_ECHO_EVENT, listener);
if (ThemeManager.isUseFontIconForImage()) {
pathLabel.setSclass("adwindow-breadcrumb-menu");
} else {
String imageUrl = Executions.getCurrent().encodeURL(ThemeManager.getThemeResource("images/downarrow.png"));
ZkCssHelper.appendStyle(pathLabel, "background: transparent url('" + imageUrl + "') no-repeat right center");
}
}
@Override
public void onEvent(Event event) throws Exception {

View File

@ -16,6 +16,7 @@ package org.adempiere.webui.apps;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.theme.ThemeManager;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.zkoss.zul.Div;
@ -40,6 +41,9 @@ public class BusyDialog extends Window {
appendChild(box);
Span image = new Span();
if (ThemeManager.isUseFontIconForImage())
LayoutUtils.addSclass("z-icon-spinner z-icon-spin", image);
else
LayoutUtils.addSclass("busy-dialog-img", image);
box.appendChild(image);

View File

@ -21,6 +21,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import org.adempiere.webui.theme.ThemeManager;
import org.zkoss.zk.ui.event.InputEvent;
import org.zkoss.zul.Comboitem;
@ -185,6 +186,9 @@ public class AutoComplete extends Combobox
if (images != null && i < images.length && images[i] != null && images[i].trim().length() > 0)
{
if (ThemeManager.isUseFontIconForImage())
comboitem.setIconSclass(ThemeManager.getIconSclass(images[i]));
else
comboitem.setImage(images[i]);
}
if (contents != null && i < contents.length && contents[i] != null && contents[i].trim().length() > 0)

View File

@ -282,7 +282,12 @@ public final class ConfirmPanel extends Div
Button btProcess = createButton(btName);
// replace default image with image set at info process
if (m_withImage && imgName != null && imgName.trim().length() > 0)
{
if (ThemeManager.isUseFontIconForImage())
btProcess.setIconSclass(ThemeManager.getIconSclass(imgName));
else
btProcess.setImage(ThemeManager.getThemeResource("images/" + imgName));
}
addComponentsCenter(btProcess);
return btProcess;
}
@ -291,7 +296,12 @@ public final class ConfirmPanel extends Div
Button btProcess = createButton(btName, imgName, null);
// replace default image with image set at info process
if (m_withImage && imgName != null && imgName.trim().length() > 0)
{
if (ThemeManager.isUseFontIconForImage())
btProcess.setIconSclass(ThemeManager.getIconSclass(imgName));
else
btProcess.setImage(ThemeManager.getThemeResource("images/" + imgName));
}
addComponentsCenter(btProcess);
return btProcess;
}

View File

@ -29,6 +29,7 @@ import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.North;
import org.zkoss.zul.South;
@ -129,6 +130,9 @@ public class FolderBrowser extends Window implements EventListener<Event>
if(!dir.getParent().equals(root.getParent()))
{
ListItem li = new ListItem(dir.getName(), dir.getParent());
if (ThemeManager.isUseFontIconForImage())
((Listcell)li.getFirstChild()).setIconSclass("z-icon-Undo");
else
li.setImage(ThemeManager.getThemeResource("images/Undo16.png"));
listDir.appendChild(li);
}
@ -141,6 +145,9 @@ public class FolderBrowser extends Window implements EventListener<Event>
if(file.isDirectory())
{
ListItem li = new ListItem(file.getName(), file.getAbsolutePath());
if (ThemeManager.isUseFontIconForImage())
((Listcell)li.getFirstChild()).setIconSclass("z-icon-Folder");
else
li.setImage(ThemeManager.getThemeResource("images/Folder16.png"));
listDir.appendChild(li);
}

View File

@ -22,6 +22,7 @@ import java.net.URI;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.theme.ThemeManager;
import org.compiere.util.Env;
import org.compiere.util.Msg;
@ -95,6 +96,9 @@ public class WAppsAction
m_button.setName("btn" + action);
m_button.setId(action);
if (ThemeManager.isUseFontIconForImage()) {
m_button.setIconSclass(ThemeManager.getIconSclass(large.getPath()));
} else {
//Image only if image is available
if (large != null)
{
@ -105,6 +109,7 @@ public class WAppsAction
{
m_button.setLabel(newToolTipText);
}
}
LayoutUtils.addSclass("img-btn", m_button);
} // Action

View File

@ -117,6 +117,9 @@ public class ButtonFactory {
button.setLabel(label);
if (!Util.isEmpty(image))
{
if (ThemeManager.isUseFontIconForImage())
button.setIconSclass(ThemeManager.getIconSclass(image));
else
button.setImage(image);
LayoutUtils.addSclass("img-txt-btn", button);
}
@ -127,6 +130,9 @@ public class ButtonFactory {
}
else if (!Util.isEmpty(image))
{
if (ThemeManager.isUseFontIconForImage())
button.setIconSclass(ThemeManager.getIconSclass(image));
else
button.setImage(image);
LayoutUtils.addSclass("img-btn", button);
}

View File

@ -399,6 +399,9 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
item.setValue(process);
item.setLabel(process.get_Translation(MProcess.COLUMNNAME_Name));
if (!Util.isEmpty(data.getImageURL(), true)) {
if (ThemeManager.isUseFontIconForImage())
item.setIconSclass(ThemeManager.getIconSclass(data.getImageURL()));
else
item.setImage(ThemeManager.getThemeResource("images/" + data.getImageURL()));
}
}
@ -522,6 +525,9 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
Menuitem ipMenuItem = new Menuitem();
ipMenuItem.setLabel(process.get_Translation(MProcess.COLUMNNAME_Name));
if (!Util.isEmpty(infoProcess.getImageURL(), true)) {
if (ThemeManager.isUseFontIconForImage())
ipMenuItem.setIconSclass(ThemeManager.getIconSclass(infoProcess.getImageURL()));
else
ipMenuItem.setImage(ThemeManager.getThemeResource("images/" + infoProcess.getImageURL()));
}
ipMenuItem.setAttribute(PROCESS_ID_KEY, infoProcess.getAD_Process_ID());

View File

@ -231,4 +231,23 @@ public final class ThemeManager {
return ZK_PREFIX_FOR_CLASSPATH_RESOURCE+zkResourceURL.substring(2);
}
public static String getIconSclass(String imagePath) {
String iconSclass = null;
if (!Util.isEmpty(imagePath, true)) {
// remove path and extension
iconSclass = imagePath.substring(imagePath.lastIndexOf("/") + 1, imagePath.lastIndexOf("."));
// remove prefix m
if (iconSclass.length() > 2)
iconSclass = iconSclass.startsWith("m") && Character.isUpperCase(iconSclass.charAt(1)) ? iconSclass.substring(1) : iconSclass;
// remove image size
iconSclass = iconSclass.replaceAll("(\\d\\d)$", "");
iconSclass = "z-icon-" + iconSclass;
}
return iconSclass;
}
}

View File

@ -119,6 +119,14 @@
.adwindow-breadcrumb .z-toolbarbutton-content {
line-height: inherit;
}
.adwindow-breadcrumb-menu::after {
font-family: FontAwesome;
font-weight: normal;
font-style: normal;
font-size: 12px;
content: "\f0d7";
margin-left: 3px;
}
.adwindow-detailpane {
width: 100%;

View File

@ -319,6 +319,9 @@
.z-icon-UnprocessedDoc:before {
content: "\f044";
}
.z-icon-Undo:before {
content: "\f0e2";
}
.z-icon-UnSort:before {
content: "\f074";
}