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,8 +290,12 @@ 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);
String imageUrl = Executions.getCurrent().encodeURL(ThemeManager.getThemeResource("images/downarrow.png"));
ZkCssHelper.appendStyle(pathLabel, "background: transparent url('" + imageUrl + "') no-repeat right center");
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

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,7 +41,10 @@ public class BusyDialog extends Window {
appendChild(box);
Span image = new Span();
LayoutUtils.addSclass("busy-dialog-img", image);
if (ThemeManager.isUseFontIconForImage())
LayoutUtils.addSclass("z-icon-spinner z-icon-spin", image);
else
LayoutUtils.addSclass("busy-dialog-img", image);
box.appendChild(image);
label = new Label(Msg.getMsg(Env.getCtx(), "Processing"));

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,7 +186,10 @@ public class AutoComplete extends Combobox
if (images != null && i < images.length && images[i] != null && images[i].trim().length() > 0)
{
comboitem.setImage(images[i]);
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)
btProcess.setImage(ThemeManager.getThemeResource("images/" + imgName));
{
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)
btProcess.setImage(ThemeManager.getThemeResource("images/" + imgName));
{
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,7 +130,10 @@ public class FolderBrowser extends Window implements EventListener<Event>
if(!dir.getParent().equals(root.getParent()))
{
ListItem li = new ListItem(dir.getName(), dir.getParent());
li.setImage(ThemeManager.getThemeResource("images/Undo16.png"));
if (ThemeManager.isUseFontIconForImage())
((Listcell)li.getFirstChild()).setIconSclass("z-icon-Undo");
else
li.setImage(ThemeManager.getThemeResource("images/Undo16.png"));
listDir.appendChild(li);
}
@ -141,7 +145,10 @@ public class FolderBrowser extends Window implements EventListener<Event>
if(file.isDirectory())
{
ListItem li = new ListItem(file.getName(), file.getAbsolutePath());
li.setImage(ThemeManager.getThemeResource("images/Folder16.png"));
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,15 +96,19 @@ public class WAppsAction
m_button.setName("btn" + action);
m_button.setId(action);
//Image only if image is available
if (large != null)
{
m_button.setImage(large.getPath());
m_button.setLabel(null);
}
else
{
m_button.setLabel(newToolTipText);
if (ThemeManager.isUseFontIconForImage()) {
m_button.setIconSclass(ThemeManager.getIconSclass(large.getPath()));
} else {
//Image only if image is available
if (large != null)
{
m_button.setImage(large.getPath());
m_button.setLabel(null);
}
else
{
m_button.setLabel(newToolTipText);
}
}
LayoutUtils.addSclass("img-btn", m_button);
} // Action

View File

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

View File

@ -399,7 +399,10 @@ 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)) {
item.setImage(ThemeManager.getThemeResource("images/" + data.getImageURL()));
if (ThemeManager.isUseFontIconForImage())
item.setIconSclass(ThemeManager.getIconSclass(data.getImageURL()));
else
item.setImage(ThemeManager.getThemeResource("images/" + data.getImageURL()));
}
}
});
@ -522,7 +525,10 @@ 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)) {
ipMenuItem.setImage(ThemeManager.getThemeResource("images/" + infoProcess.getImageURL()));
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());
ipMenuItem.addEventListener(Events.ON_CLICK, this);

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";
}