How do you include your own icons in Vaadin Flow? Do you make an HTML file like this one from Vaadin Icons and include it via
#HtmlImport("frontend://path/to/your/icons.html")
I did not find any documentation so far. So I guess this is one possibility?
Here is an example of adding some IcoMoon icons to a Vaadin Flow App;
Using the notes in https://icomoon.io/docs.html under the section 'Generating Icons in SVG & More', I generated the Polymer compatible icon set in iron-iconset-svg format.
Visit https://icomoon.io/app/ and select the icons (you can add icons from different libraries),
click on 'Generate SVG & More',
click on 'Preferences' and select Polymer as the target format and download,
Extract the zip file, and open the polymer folder. It contains the *-svg.html file which is the 'iron-iconset-svg' format file that #Jouni is talking about in the above note. This html file is actually a collection of inline SVGs.
Copy the html file to your resources folder;
e.g. resources/META-INF/resources/frontend/styles/
And import that using #HtmlImport;
e.g. #HtmlImport("frontend://styles/icomoon-iconset-svg.html")
Then you can create icons using the collection name and the icon name;
Icon icon = new Icon("icomoon", "mobile");
The collection name is the name value in <iron-iconset-svg name=... in the html file.
update: starting from Vaadin 14 (except in Compatibility mode) you should instead use #JsModule. i.e. #JsModule("#polymer/iron-icon/iron-icon.js")
You can also create the icon collection manually.
I used https://github.com/vaadin/vaadin-icons/blob/master/iconset.html as a template (more or less):
Draw or download some SVG files.
Create a new SVG file myicons.svg that starts with
<iron-iconset-svg name="myiconset"><svg><defs>
... and ends with
</defs></svg></iron-iconset-svg>
Within the defs-tag you insert a "g" element for every graphic, e.g.:
<g id="myicon" viewBox="0 0 52 56"></g>
Set the id unique within this file.
Set viewBox attribute (visible dimensions) with the values from the original SVG file.
Copy the path element(s) from the original SVG file (and remove any "g" or "symbol" or "title" or whatever else elements that are no path/line/shape) and paste it/them into your newly created "g" elements.
<path d="m14 15h-13c-.55228475 [...]" />
Place this created myicons.svg file wherever you want it to be.
Within your Java code read that myicons.svg file and paste it in your site, e.g. in this direct way (and replace the path if you chose another one):
add(new Html(Files.readString(new File("src/main/webapp/img/myicons.svg").toPath())));
Create an icon:
com.vaadin.flow.component.icon.Icon myIcon = new Icon("myiconset", "myicon");
myIcon.getStyle().set("color", "var(--lumo-primary-text-color)");
add(myIcon);
Related
Adding custom icons in Sitecore requires the following step:
Zip it is all. The name of archive should be the same as the containing folder (MyIcons.zip);
Upload the zip file by the path which was mentioned above: \sitecore\shell\Themes\Standard.
The problem is when I need more icons I need to add the icon and zip the file again. Is there a way to avoid this or make this maintainable without using zip file?
You can directly specify the URL of the icon you wish to use in the Icon field of the item. This can be an image on disk:
Or it can be an image from the Media Library:
I would recommend using the format such as: /-/media/F8C69CCD422C40AC843D2E4144F16964.ashx?thn=1
This ensures that the icon used is of thumbnail size (the thn=1 parameter) and by using the guid of the media item it means that the icons can be moved/restructured without having to update the Icon fields.
In both these cases, you need to manually enter the path of the icon file, you cannot specify it using the icon selector dialog.
I am currently trying to use CSS to stylize my application in Apex 5. The problem I am having is that when I write my CSS code in the "inline" section of any page in the application, then the CSS code works, but if I write the CSS code on Notepad and then upload the file and reference the file within my application, then the CSS code does not work. I have written several lines of CSS code, so I'll just post one small section of it as a sample so that you all can see my format:
body{
font: bold 12px/16px "Times New Roman";
}
I have uploaded the file in the Static Application Files section of the Shared Components page of the application. I have then tried referencing the file in different places, such as at the page level and user interface level, but nothing has worked so far. I'm very new to CSS, so any insight would be greatly appreciated. Thank you in advance!
After uploading the file have to be displayed in the list of static files. The list of files have a column Reference, which contain a string like this: #APP_IMAGES#test.css. Copy this string and put it, for example, on the page in the section CSS - File URLs. This should work.
Then make sure that file reference works. Open your page and take a look on a list of CSS files. The same functionality is present in all browsers, but it is accessible by different ways. In IE:
Press F12.
Open Network tab.
Press "Enable network traffic capturing" (a green triangle in the left top corner).
Reload the page. A list of files appears.
Find your file in a list:
If the file is not present, then you copied an incorrect link, or you copied it into an incorrect place, etc.
If the file is present, normally it should have status 200 (the Result column). If a status is not 200, there could be a lot of reasons (depending on the status).
If the file is present with the status 200, your CSS property doesn't work, because it is overridden with another CSS. To define with which one, go to the Dom Explorer tab.
You can try this approach:
On server, go to ORACHE_HOME/apex/images/css (path can be different, but you can find it by .css extension)
Put you file here
Id editor, in page properties, go to the CSS -> File URLs section
Write path like this: /i/css/new.css (i - in general, alias for your images directory)
Can anyone please help me. Am using adobe captivate 9. I have a content with image that exceeds the slide spacing, i want to set this content within the page using scroll. I have tried using text-scroll widget but i cant add images to it.
Put the image into an MS Word document and save it as an HTML web page. The result will be an HTML file and folder named "[file name]_files" in whichever folder you saved it to.
Select both the HTML file and the folder, right click, and choose Send to -> Compressed (zipped) folder in the context menu.
Dragging that ZIP folder directly onto your Captivate slide will create scrolling HTML Web Object based on the formatting of the MS Word file. It will show up in your Library in the "Web" folder.
Unfortunately, this is a feature that is missing from Captivate. The best solution I've found is to make an html file that includes the text and points to the image, then zip and import as an HTML5 Animation.
How can I change the heading sort icon in a APEX 5 classic report?
The customer just wants to have his own sort icons for desc and for asc. He does not like the new APEX sort icons.
ORACLE says:
Desupported Report Heading Sort Icons The following attributes used to
define the report heading sort icons have been de-supported for
interactive reports and classic reports: Ascending Image, Descending
Image, Asc Image Attributes, and Desc Image Attributes. Instead of
referencing images directly, Oracle Application Express now uses CSS
to render sort icons. For interactive reports uses the following
classes: .a-Icon.icon-irr-sort-asc and .a-Icon.icon-irr-sort-desc For
classic reports use the following classes: .a-Icon.icon-rpt-sort-asc
and .a-Icon.icon-rpt-sort-desc
I have no clear idea how that task can be made. I just know that APEX now uses CSS to render sort icons (a-Icon.icon-rpt-sort-asc and .a-Icon.icon-rpt-sort-desc).
It could be "Static Application Files" > #APP_IMAGES#sort_asc.png / #APP_IMAGES#sort_desc.png.
I am new with APEX, my colleagues say changing a sort icon in classic report was an easy task in APEX 4.2 but this easy way is no longer available in APEX 5.
Does someone has a piece of code and some hints?
You need to define your own CSS classes .icon-rpt-sort-asc and .icon-rpt-sort-desc. They have to look like this:
span.icon-rpt-sort-asc {
background-image: url("/i/custom_asc_sort_image.png");
}
span.icon-rpt-sort-desc {
background-image: url("/i/custom_desc_sort_image.png");
}
Here you set names of images, which will be shown in a report column header. After that you need to use this CSS. Here you have two ways to do this:
Open page properties, go to CSS tab, place CSS code there. This isn't a good way, because you have to add this code to every page, where you need custom images.
Recommended way - create a css file with code above, put it in /i/ folder, and change page template (Shared Components->User Interface->Templates-> desired page template -> Definition tab). In Header section add a <link> tag:
<head>
...
#PAGE_CSS#
#FAVICONS#
#HEAD#
<link rel="stylesheet" href="#APP_IMAGES#mycss.css" type="text/css"></link>
...
</head>
where mycss.css - name of your CSS file. And, of course, you have to put your custom sorting icons to apex images folder.
I would like to use SVGs in menus and buttons around a Qt-4.7 application. The images are rendered correctly across linux and windows platforms, however an obnoxious message reading...
couldn't create image from ""
...is printed to the console seemingly as soon as one of these images is loaded or changes state (like highlighting or disabling its container widget). Over the course of the run of the application, many of these lines are printed, leaving a lot of senseless output crufted around reasonable application output.
Poking around the Qt code a bit, this appears to be coming from svg/qsvghandler.cpp:2680 where the line contains the following.
qDebug()<<"couldn't create image from "<<filename;
From the documentation for qDebug, you would think that I could block this by defining QT_NO_DEBUG_OUTPUT at compiletime, but this will only block the application's compiled debug calls, not the one in Qt's SVG library.
So I guess my question is actually two-fold:
As in the title, why is Qt printing this even when rendering SVGs correctly?
Without recompiling Qt or its SVG library, how do I prevent Qt from printing this and crufting the application's output?
I've also posted this question on the QtCentre forums.
To #2: You can prevent qDebug output by using qIntallMsgHandler and writing a handler that just discard the message. Also see this question: How to redirect qDebug, qWarning, qCritical etc output?
Re #1: I'm no expert on SVG but from the Qt source code where that line appears, it looks like Qt is trying to load an image file referenced in an xlink:href attribute. The output you see would seem to indicate that either the value for that attribute is "" or the value is a bunch of white space characters enclosed in "" which is removed by a call to QString.trimmed() which is then used as the name of an image file to be loaded into a QImage. I can't quite discern if the filename is ending up as an empty string or two quotes :)
I would have to guess that either the SVG files you have are filled with empty string xlink:href attributes (probably links or filenames for texture images) or there is something about the SVG file causing Qt to incorrectly parse it. I would lean towards the former.
What is your criteria for concluding that they are being rendered correctly? Perhaps you could open the SVG files in a text editor and look at the xlink:href occurances in it?
I've had a similar issue, I used Adobe Illustrator to create images and then save as SVG. The problem is that hidden layers in Illustrator still gets written to the SVG file, but its display property is set to "none". In my case a hidden layer of a file I "placed" - to get an idea if the background I'm creating would look OK.
This causes your image to render correctly as you say, but Qt complains about the missing invisible layer in the SVG file. If you open the SVG file in a text viewer you might find the hidden layer looks something like this:
<g id="bglogo_x5F_splash" style="display:none;">
<image style="display:inline;overflow:visible;" width="1740" height="438" xlink:href="../logo_preview.png" transform="matrix(1 0 0 1 154 409)">
</image>
</g>
Qt will complain about the missing "../logo_preview.png" file.
Hope this helps