My galleria won't work like it does in the showcase. It displays the images all at once with the style of a bulleted list
picture 1
picture 2
I pretty much copied the code from the showcase website (link). But it doesn't work at all like it should. I used Mozilla Firefox and Internet Explorer for testing. Both same result.
I'm running on a glassfish 5.0. Using Java 8, PrimeFaces 6.0 and JSF 2.1.
Both images have a resolution of 711 x 400.
Here is my code.
xhtml
<p:galleria var="currentImage" value="#{homeBean.images}" panelWidth="500" panelHeight="313"
showCaption="true">
<p:graphicImage value="/image/#{currentImage}"></p:graphicImage>
</p:galleria>
Java-Bean
#ManagedBean
#ApplicationScoped
public class HomeBean {
private final List<String> images;
{
images = new ArrayList<>();
images.add("image1.png");
images.add("image2.png");
}
public List<String> getImages() {
return images;
}
}
But this is how its displayed
Related
I am using Xam.Plugin.HtmlLabel for showing data on my project. It is working fine on android and windows. But nothing is showing in ios devices.
My code:
<htmllabel:HtmlLabel
x:Name="message_label"
VerticalOptions="Start"
VerticalTextAlignment="Center"
TextColor="Black">
<htmllabel:HtmlLabel.FontSize>
<OnIdiom x:TypeArguments="x:Double">
<OnIdiom.Phone>20</OnIdiom.Phone>
<OnIdiom.Tablet>30</OnIdiom.Tablet>
<OnIdiom.Desktop>20</OnIdiom.Desktop>
</OnIdiom>
</htmllabel:HtmlLabel.FontSize>
</htmllabel:HtmlLabel>
message_label.Text = "htmldata";
I have uploaded a sample here for the reference.
In your case , you seems forget to init the renderer in specific platforms .
in iOS
using LabelHtml.Forms.Plugin.iOS;
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
HtmlLabelRenderer.Initialize();
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
return base.FinishedLaunching(app, options);
}
I used the tag <u> to add under line of the label .
You could check the demo from https://github.com/luczha/HtmlLabel_demo .
I'm facing some problems at the time of painting a circle with the SkiaSharp API in one of the children pages of a Tabbed Page in Xamarin Forms.
Although I get no errors during the building of the project, whenever I enter the page in which the circle is supposed to be drawn during the on device debugging, the application throws a "System.InvalidCastException: Specified cast is not valid" message and it crashes.
This is the XAML code of the Tabbed Page:
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:me="clr-namespace:TestBth;assembly=TestBth"
x:Class="TestBth.MyTabbedPage">
<TabbedPage.Children>
<me:ConnectPage />
<me:LissajousPage />
<me:ParametersPage />
</TabbedPage.Children>
<!--Pages can be added as references or inline-->
</TabbedPage>
This is the XAML code of the page that's causing the trouble:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:skia="clr-namespace:SkiaSharp.Views.Forms;assembly=SkiaSharp.Views.Forms"
xmlns:local="clr-namespace:TestBth"
x:Class="TestBth.LissajousPage"
Title="Lissajous">
<skia:SKCanvasView x:Name="canvasView"
PaintSurface="canvasView_PaintSurface" />
</ContentPage>
And this is the internal code of the same page:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using SkiaSharp;
using SkiaSharp.Views.Forms;
namespace TestBth
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class LissajousPage : ContentPage
{
SKPaint blackFillPaint = new SKPaint
{
Style = SKPaintStyle.Fill,
Color = SKColors.Black
};
public LissajousPage()
{
InitializeComponent();
}
private void canvasView_PaintSurface(object sender, SKPaintSurfaceEventArgs e)
{
SKSurface surface = e.Surface;
SKCanvas canvas = surface.Canvas;
canvas.Clear(SKColors.CornflowerBlue);
int width = e.Info.Width;
int height = e.Info.Height;
//Set transforms
canvas.Translate(width / 2, height / 2);
canvas.Scale(width / 200f);
//Clock Background
canvas.DrawCircle(0, 0, 100, blackFillPaint);
}
}
}
Any idea about why could this be happening?
Thanks in advance.
For my surprise, it turns out the SkiaSharp.Views.Forms Nuget package was not installed for Android.
I specified that I wanted to install it in all my projects but there must have been a problem during the installation.
I installed the package individually for Android and it works fine now.
Sorry for the inconvenience.
I’m using PrimeFaces 6.0 and I’ve found a problem using nested dialogs. RequestContext.openDialog is not working properly. It doesn’t throw any exception, but it doesn’t open the dialog.
I built 5 pages (P1 to P5) based on the same Full Page Layout. Each page contains a p:dataTable. The p:dataTable has a p:column with a p:commandButton to open the next page in a new dialog. This is what I’ve found: on some of those pages the button of the first row doesn’t work; the buttons of the rest of the rows work properly.
The problem doesn’t seem to be inherent to the row data. When the button of the first row fails, it fails regardless the row that is being showed there. Rows can be sorted in different ways (so the first one would vary) and the button of the first row will continue failing and the rest of the buttons will continue working. The problem doesn’t seem to be inherent to the page either. All buttons work properly when the page is root (the one that opens the first dialog). The problem only happens within a dialog.
This is the button:
<p:commandButton
icon="fa fa-folder-open"
action="#{ambientePrueba11.openDialog(currentRow)}"
partialSubmit="true"
process="#this"
update="#none">
<p:ajax
event="dialogReturn"
listener="#{ambientePrueba11.onDialogReturn}"
update="dataTable"/>
</p:commandButton>
This is the code in the backing bean (each of the 5 beans have a different outcome, but the rest of the code is the same):
public String openDialog(AmbientePrueba row) {
EventLogger.log(this, "openDialog", getDenominacion(row));
Object identificacion = getIdentificacion(row);
String key = "PaquetePrueba11";
String outcome = FacesUtils.getPageKeyFacesOutcome(key);
Map<String, Object> options = new HashMap<>();
options.put("modal", true);
options.put("resizable", true);
options.put("draggable", true);
options.put("width", 1260);
options.put("height", 860);
options.put("contentWidth", "100%");
options.put("contentHeight", "100%");
options.put("closable", true);
options.put("includeViewParams", true);
options.put("minimizable", true);
options.put("maximizable", true);
Map<String, List<String>> params = new HashMap<>();
params.put(CPP.ID_RECURSO, toList(identificacion));
params.put(CPP.ID_RECURSO_MAESTRO, toList(identificacion));
params.put(Global.PARAMETRO_FRAMEWORK_SESION, toList(getSessionFrame()));
params.put(Global.PARAMETRO_CONDICION_SESION, toList(MODAL));
RequestContext.getCurrentInstance().openDialog(outcome, options, params);
return null;
}
private List<String> toList(Object value) {
List<String> paramValue = new ArrayList<>();
paramValue.add(value + "");
return paramValue;
}
public void onDialogReturn(SelectEvent event) {
Object response = event.getObject();
facesLogger.info(response + "");
}
Has anybody else found a similar problem? Any help to solve or workaround this problem will be very much appreciated.
After some more tests I found a work around. I just gave the button a different id in each page and now all the buttons of all the pages work just fine.
Now the button of page P1 (as its id suggests) looks like this:
<p:commandButton
id=buttonOfPage1
icon="fa fa-folder-open"
action="#{ambientePrueba11.openDialog(currentRow)}"
partialSubmit="true"
process="#this"
update="#none">
<p:ajax
event="dialogReturn"
listener="#{ambientePrueba11.onDialogReturn}"
update="dataTable"/>
</p:commandButton>
I am new in html and i'm making a html page in which i want to display some code, but it not showing proper way like what we are writing in notepad. So, i have to write each and every line or any other solution is there. Suppose this is the code
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.liste);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
// Setup the list view
final ListView prestListView = (ListView) findViewById(R.id.list);
final prestationAdapterEco prestationAdapterEco = new prestationAdapterEco(this, R.layout.prestation);
prestListView.setAdapter(prestationAdapterEco);
// Populate the list, through the adapter
for(final prestationEco entry : getPrestations()) {
prestationAdapterEco.add(entry);
}
prestListView.setClickable(true);
prestListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
Object o = prestListView.getItemAtPosition(position);
String str=(String)o;//As you are using Default String Adapter
Toast.makeText(getApplicationContext(),str,Toast.LENGTH_SHORT).show();
}
});
}
and i want to show it on html page like this only. Please help.. Thanks
<pre><code> code... </code></pre>
This seems to be the best method they've found here: <code> vs <pre> vs <samp> for inline and block code snippets
It also happens to be the recommended way to show a sample of computer code on W3.org.
I think you're looking for code/syntax highlighting in HTML pages. Unfortunately there is no highlighting feature using tags in HTML.
In HTML You can use:
<code>You code goes here..</code>
For more reference: http://www.w3schools.com/tags/tag_code.asp and the list of global attributes code tag supports: http://www.w3schools.com/tags/ref_standardattributes.asp
However, you can make use of some javascripts which enables syntaxt highlighting in HTML.
You can check this thread: "Syntax highlighting code with Javascript" for more info.
I'm showing images from database which are stored as Varbinary(Max)
In Razor I am converting it to a string and sowing as a <img>. It is working in IE but not in FF and Chrome. I have tried my best but couldn't figure it out why it is. Please help.
Please see this generated html in IE (working) and (FF & Chrome both not working):
http://jsfiddle.net/MGY9Y/
Note:
I'm generating this html from Asp.Net MVC Razor using below code:
<img src=#(!Model.Photos.Any() ? "/Content/Images/Cars/CarPlaceHolder.jpg"
:Encoding.ASCII.GetString(Model.Photos.FirstOrDefault().Document))></img>
I am also doing the same thing but with different approach..
Controller
using (var binaryReader = new BinaryReader(Request.Files["files"].InputStream))
{
Image = binaryReader.ReadBytes(Request.Files["files"].ContentLength);
}
View
if (Model.Logo != null)
{
string imageBase64 = Convert.ToBase64String(Model.Logo);
string imageSrc = string.Format("data:image/gif;base64,{0}", imageBase64);
<img src="#imageSrc" class="self-image" />
}
else
{
<img src=YOUR IMAGE class="self-image" />
}
It is working in both IE and chrome