How to add WebPage in a panel - wicket-1.6

I need to add a Webpage on a panel, but as i am new to Wicket framewrok.I have no idea.
Can anybody please give me an example?
public Component renderBody(String componentId) {
//return new Label(componentId, getMessage()).add(new AttributeAppender("class", "p8p"));
return new TablePanel(componentId);
//return new MainSearchTab();
}
I have a panel named TablePanel instead of that i want to use a WebPage, here MainSearchTab.
Any suggestion?

Use an InlineFrame:
Java:
InlineFrame frame = new InlineFrame("webpage", OtherPage.class);
frame.setMarkupId("webpage");
add(frame.setOutputMarkupId(true));
HTML:
<iframe wicket:id="webpage" name="webpage"></iframe>

Related

How to refresh listview after save date in my list<Product>

I am using popup for to save dates in list and last I wanna show the dates in listview
You Can Make Use Of Two Way Binding By Implementing INotifypropertychanged.
If you Want to implement in code behind you can do it in this way
OnButtonDateAdd()
{
listview.BeginRefresh();
var filter = get the new data
listview.ItemsSource = filter;
listview.EndRefresh();
}
}
Hope this solves your issue

Xamarin Forms add new controls dinamically in the content via code

I have a form in my Xamarin project that its result is something like that:
Basically there is a header (1) and a body of this form (2). The header is quite simple build with AbsoluteLayout.
For creating the body (2) I've created my component to show a tab control and then for each tab a specific grid with images and text. For each section, I'm checking in the database how many records there are for it and change the text. This activity is very long and I'm trying to understand why and how I can improve speed.
Then I should cut the corner to add later in my page the tab control so the user can see immediately the header and after few second all page. The code is like the following:
public class MyPage : WaitingPage
{
public MyPage(Card card)
{
LoadingMessage = "Loading...";
ShowLoadingFrame = true;
ShowLoadingMessage = true;
ShadeBackground = true;
WaitingOrientation = StackOrientation.Vertical;
IsWaiting = true;
StackLayout stackPage = new StackLayout() {
BackgroundColor = Color.FromHex("#fff"),
Children = {
ShowHeader(card),
}
};
Content = stackPage;
Task.Yield();
Task.Run(async () => {
Content = await ShowDetails(card);
});
IsWaiting = false;
}
}
I tried different ways to add the content from await ShowDetails(card); but nothing happens. Basically the content doesn't change unless await ShowDetails(card); is executed. I discovered Task.Yield(); (you can wait the page is rendered and showed and then continue) but in this case doesn't work. And also WaitingPage doesn't show the message.
Any suggestions or help? Thank you in advance

DevExpress TabbedView : Create Child Form from a Child Form

I'm using DX 15.1, and I'm trying to create a new tab from a child form.
So, basically, I have a parent form called "pForm", and a child form called "cForm".
I'm using DocumentManager module and switched it to TabbedView mode.
When I'm trying to create a new tab from pForm, it's totally fine.
the problem is, when I'm can't create a new tab from cForm into pForm's TabbedView.
How do I achieve this?
Thanks, mate :)
UPDATE :
#DmitryG, thanks for your response.
I've attached a screenshot below.
The MDI-Parent is the RGP page with a settings header. and the MDI-Child is the Class Attendance form (popped-up window, triggered by a button inside the RGP form).
Can you give a solution, how to make the Class Attendance Form (mdi-child) became a new Tab beside RGP tab when it's triggered by a button within mdi-parent? Not as a popped-up window.
thanks!
When the DocumentManager works in MDI Mode you can just work with mdi parent and child forms. So, I believe, you code for adding a new mdi-child into mdi-parent form can looks like this:
static void AddMdiChildFromMdiParent(Form mdiParent) {
Form child = new Form();
child.MdiParent = mdiParent;
child.Show();
}
Within the mdi-parent form you can call this code like this:
AddMdiChildFromMdiParent(this);
To add a new mdi-child from an existing mdi-child you can reuse the code above as follows:
static void AddMdiChildFromMdiChild(Form child) {
AddMdiChildFromMdiParent(child.MdiParent);
}

Display jquery dialog on postback in ASP.NET after saving a new record

What I would like to do is have the user add a new record to the database and popup a JQuery dialog confirming that the new record was saved. I thought this would be a simple exercise. I have a gridview bound to a LINQDataSource to allow the user to view and edit existing records and a textbox and a button to add new codes.
In the head of the document, I have the following:
$('#dialog').dialog({
autoOpen: false,
width: 400,
buttons: {
"Ok": function () {
$(this).dialog("close");
}
}
});
and futher down in the markup I have:
<div id="dialog" title="New Code Added">
<p>"<asp:Literal runat="server" ID="LiteralNewCode"></asp:Literal>" was successfully added.</p>
</div>
So when the user enters a new description and it passes all the validation, it's added to the database and the gridview is rebound to display the new record.
protected void ButtonSave_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
CCRCode.Add( <long list of paramters> );
GridCode.DataBind();
IsNewCode = true;
NewDescription = <new description saved to database>;
}
}
Now, here's where (I thought) I'd set a boolean property to indicate that a new description had been added as well as the text of the new description. See below:
protected bool IsNewCode
{
get { return ViewState["IsNewCode"] != null ? (bool)ViewState["IsNewCode"] : false; }
set { ViewState["IsNewCode"] = value; }
}
private string NewDescription
{
get { return ViewState["NewDescription"] != null ? ViewState["NewDescription"].ToString() : string.Empty; }
set { ViewState["NewDescription"] = value; }
}
Here's where I loose my way. My guess is I want to add functionality to include code similar to:
$('#dialog').dialog('open');
I've added a registerscriptblock method in the page_load event but that didn't work. Any ideas? Or am I just going about this entirely wrong?
Thanks.
Not really get what you want to do. But, i use jquery alot with .NET in my projects. here is how i do, probably could give you a hint.
foo.aspx.cs
public String ScriptToRun = "$('#dialog').dialog('open');";
change the value of ScriptToRun in your C# code
foo.aspx
$(document).ready(function() {<%=ScriptToRun %>});
Remember that whatever you done in backend is going to generate HTML, Css& javascript to browser.
Two ways: one, write the javascript in your server-side code. Or, define a JS method to show the dialog (say named showDialog), and call it via:
Page.ClientScript.RegisterStartupScript(... "showDialog();" ..);
RegisterStartupScript puts the method call at the end, ensure your script is above it to work. You can also wrap it with document.ready call too, to ensure JQuery is properly loaded.
I think that the only think that you have miss is the creation of the dialog when the Dom is ready.
$(document).ready(function() {$('#dialog').dialog('open');});
I posted code in a different question for a custom "MessageBox" class I wrote:
ASP.NET Jquery C# MessageBox.Show dialog uh...issue
the code by default uses the javascript alert() function, but you can define your callback so that it calls your custom javascript method to display the messages.

Flex 3 - Image cache

I'm doing an Image Cache following this method: http://www.brandondement.com/blog/2009/08/18/creating-an-image-cache-with-actionscript-3/
I copied the two as classes, renaming them CachedImage and CachedImageMap.
The thing is that I don't want to store the image after being loaded a first time, but while the application is being loaded.
For that, I've created a function that is called by the application pre-initialize event. This is how it looks:
private function loadImages():void
{
var im:CachedImage = new CachedImage;
var sources:ArrayCollection = new ArrayCollection;
for each(var cs in divisionData.division.collections.collection.collectionSelection)
{
sources.addItem(cs.toString());
}
for each(var se in divisionData.division.collections.collection.searchEngine)
{
sources.addItem(se.toString());
}
for each( var source:String in sources)
{
im.source = source;
im.load(source);
}
}
The sources are properly retrieved.
However, even if I use the load method, I do not get the "complete" event... As if the image is not being loaded... How is that?
Any help would be appreciated.
Thanks in advance.
Regards,
BS_C3
I found the problem with my code =)
It was a declaration problem.
I moved the declaration of the cachedImage inside the for each loop where the images are loaded. So that I get something like this:
for each( var source:String in sources)
{
var im:CachedImage = new CachedImage;
im.source = source;
im.load(source);
}
And this does the trick.

Resources