Apache Tomcat and CSS

2009-11-04 Thread Oliver-Sven Fritsch

Hi everybody!

This might not have to do with Wicket directly but I experience some 
very strange behavior with wicket pages on tomcat.
I do have a login page with a centered div container and two input 
fields for username and password. If I deploy my application on my local 
machine (win xp) into my tomcat everything look really nice on both 
firefox and ie8. BUT if I deploy the same .war archive into a linux 
server's tomcat my centered div is moved to the left of my browser 
window and my style definitions are somewhat messed up. This only 
aspects IE8, firefox displays everything very well. My third test 
machine (win server 2008) does everything well too (ff  ie8) so I guess 
it has something to do with tomcat running under linux. If I look at the 
page's sourcecode its exactly the same on all three environments.
What makes me think that wicket has something to do with that is the 
fact that a plain html file does render correctly on all systems and all 
browsers.


I validated my code using w3c's validator and it's says everything is 
fine except for the wicket:id tags which seems to be normal. Encoding is 
set to utf-8 so this shouldn't be a problem and doctype definitions are 
well too. This is a really strange problem which I can't seem to solve. 
Does anybody ever experienced somthing similar? Maybe any of you 
Wicket-Guru's ? :-)


Any help is really apreciated!

Thanks in advance
Oliver


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



inMethod DataGrid row values

2009-09-11 Thread Oliver-Sven Fritsch

Hi group!

I want to open a ModalPanel with detailed information when the user 
clicks on a row in my DataGrid. To do so I override the onCellClicked 
method. My problem is that I don't know how to get the rowdata. No 
matter which approach I try all I see is that I can get the information 
for the column which wont help in my use case. I think this is a very 
common task (getting rowdata i.e. primary key or so).


Any ideas would be really appreciated!

Oliver

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



CSS and Javascript in Modal Panel

2009-09-10 Thread Oliver-Sven Fritsch

Hi everybody!

I want to use modal panels for forms which seems to be a good choice. 
Some of my forms need to have multiple pages which I would like to 
display on tabs. Tabbing work fine in normal wicket panels and pages 
when I provide the necessary CSS and Javascript. But somehow the modal 
panel is completly imune to it. First I tried to include the formatting 
and script directly in the markup for my modal panel which doesn't work. 
Then I tried to do this using the JavascriptPackageResource (nad css) in 
the class which wont work too.


Is there a way to add css formating and javascript functionallity to 
modal panels beyond the default one?

Using my scripts and css on ordinary pages works perfectly well.

Regards Oliver

--
Oliver-Sven Fritsch

3B LOGOS Logik+Logistik GmbH
Kaiserdamm 32, D-14057 Berlin, Tel.: 30 61 47 42
Geschäftsführer: Dr. Friedrich Barounig
Sitz: Berlin, Amtsgericht Charlottenburg, HRB 69523
UID: DE 198252668, SteuerNummer: 27/004/04695 



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: LinkTree and Tabbed Panel + inMethod DataGrid

2009-09-02 Thread Oliver-Sven Fritsch

Thanks Igor,

I found out that some chaching I did was responsible for that behavior. 
The cell data of the datagrid now gets loaded each time I click on my 
LinkTree. What's still not working is the refreshment of the datagrid 
itself although it's put into a WMC.


What I do is override the onNodeLinkClicked method with 
target.addComponent(mygrid);
Is there anything else i have to add to the click behavior? It still 
updates only if I click the tab or refresh the entire page (f5).


My page layout has two div-containers, one for the tree and one for the 
tab panel. Maybe putting a WMC around the entire 'content'-DIV is the 
solution? Can't believe that.


Really apreciate any further hints!

Oliver

Igor Vaynberg wrote:

sounds like you are ginving your datagrid a static model, instead try
to give it a model that always checks the current treenode and pulls
the associated data.

-igor

On Tue, Sep 1, 2009 at 2:35 AM, Oliver-Sven Fritscho...@3blogos.com wrote:
  

Hi everybody,

I have a LinkTree which will work as my navigation and a panel with tabs for
the content.
Right now the tree loads all the neccesary data and displays correctly. On
one of my tabs I have the inMethod datagrid which displays the values for
the selected treenode well.
My problem is that if I choose another node the datagrid does not refresh
except if I use the browsers refresh (f5). I tried to override the
onNodeLinkClicked method but don't seem to get it working. Could someone
please point me to the right direction? Can't get it working with refresh,
replaceWith etc...

here's my code for the LinkTree

tree = new LinkTree(myLinkTree, t) {
  @Override
  protected void onNodeLinkClicked(java.lang.Object node, BaseTree
tree, AjaxRequestTarget target) {
// this is for updating some global variables
  ((WicketApplication)
getApplication()).setViewId(Integer.valueOf(((MyTreeNode)
node).getPraram1()));
// this is my inMethod datagrid
  target.addComponent( ((ExplorerApplication)
getApplication()).getGrid());

//- what comes here?
  }
  };

Thanks in advance!
Oliver



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org





-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

  


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Tree based on database

2009-08-17 Thread Oliver-Sven Fritsch

Hi everybody!

Still new to Wicket I'm trying to get a wicket tree with nodes from a 
database. What I got so far is a simple JTree put onto a JFrame. What I 
don't understand is how to geht my tree onto a wicket web page. I'm 
kinda confused on how to get things working. As far as I now wicket tree 
uses jtree aswell, but I'm really stuck at this point. I'd really 
appreaciate any help from anyone pointing me into the right direction.


public class MyJTree extends JFrame {

   Connection con = null;
   Statement st = null;
   ResultSet rs = null;

   public static void main(String args[]) throws Exception {
   new MyJTree();
   }

   public MyJTree() throws Exception {

   super(Retrieving data from database );

   MyConnection mycon = MyConnectionFactory.getNewConnection();
   mycon.connect();

   ArrayList list = new ArrayList();
   list.add(The Root);

   try {
   String sql = select key, node_id, parent_id, caption from 
mytable;


   st = mycon.createPreparedStatement(sql);
   rs = st.executeQuery(sql);


   while (rs.next()) {
   Object value[] = {rs.getString(1), rs.getString(2),
   rs.getString(3), rs.getString(4)};
   list.add(value);
   }
   } catch (Exception e) {
   System.out.println(e);
   }
   rs.close();
   st.close();

   Object hierarchy[] = list.toArray();

   JFrame frame = new JFrame();
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   Container content = getContentPane();

   DefaultMutableTreeNode root = processHierarchy(hierarchy);
   JTree tree = new JTree(root);
   content.add(new JScrollPane(tree), BorderLayout.CENTER);
   setSize(275, 300);
   setLocation(300, 100);
   setVisible(true);
   }

   private DefaultMutableTreeNode processHierarchy(Object[] hierarchy) {
   DefaultMutableTreeNode node = new 
DefaultMutableTreeNode(hierarchy[0]);

   DefaultMutableTreeNode child;
   for (int i = 1; i  hierarchy.length; i++) {
   Object nodeSpecifier = hierarchy[i];
   if (nodeSpecifier instanceof Object[]) // Ie node with children
   {
   child = processHierarchy((Object[]) nodeSpecifier);
   } else {
   child = new DefaultMutableTreeNode(nodeSpecifier); // Ie 
Leaf

   }
   node.add(child);
   }
   return (node);
   }
}


Thanks!
Oliver

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Tree based on database

2009-08-17 Thread Oliver-Sven Fritsch
Thanks for your reply. I guess defining the TreeModel is exactly my 
problem. I tried to find a tutorial on how to do so based on my database 
entries but I don't seem to find any. Maybe this is basic java knowledge 
and I'm searching at the wrong spots. But a little how to would be great 
because right now I have no idea how to solve my problem. I guess this 
is a common use case while handling Trees on web apps, yet wondering why 
there isn't a fool-proof guide. Any hints would be greatly appreaciated.


Oliver


Cemal wrote:


Oliver,

Wicket (core and extensions) has several tree components and they all
currently use Swing's TreeModel (javax.swing.tree.TreeModel). I say
currently as this is the case upto and including Wicket 1.4 but there is
some discussion about using a new type of model, more suited to webapps, in
Wicket 1.5. Swing's TreeModel is not coupled to JTree at all even though it
happens to be the model JTree uses. Wicket does _not_ use JTree, but its
trees use TreeModel.

In the context of a Swing UI your code below would be much more flexible,
powerful and in the spirit of Swing if you were to explicitly use a
TreeModel to manage interaction with the underlying data; I expect even
Swing's out-of-the-box AbstractTreeModel (or the provided concrete subclass,
DefaultTreeModel which uses DefaultMutableTreeNode) would suffice for your
use-case based on what the code you've posted is doing.

Once you have created your TreeModel, you can use it with Wicket's trees too
as simply as:
 add(new LinkTree(tree, myTreeModel));
for example

See [1] for a simple example of how to use JTree (with a TreeModel), [2] for
a simple Wicket tree example and if you want to learn a bit more about how
some of Wicket's trees work check out this class diagram [3] from a couple
of years ago. 


Does that make sense?

Regards - Cemal 
jWeekend 
OO  Java Technologies, Wicket Training and Development 
http://jWeekend.com


[1]
http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html#dynamic
[2] http://www.wicket-library.com/wicket-examples/ajax/tree/simple.1
[3] http://jweekend.com/dev/ArticlesPage/



Oliver-Sven Fritsch wrote:
  

Hi everybody!

Still new to Wicket I'm trying to get a wicket tree with nodes from a 
database. What I got so far is a simple JTree put onto a JFrame. What I 
don't understand is how to geht my tree onto a wicket web page. I'm 
kinda confused on how to get things working. As far as I now wicket tree 
uses jtree aswell, but I'm really stuck at this point. I'd really 
appreaciate any help from anyone pointing me into the right direction.


public class MyJTree extends JFrame {

Connection con = null;
Statement st = null;
ResultSet rs = null;

public static void main(String args[]) throws Exception {
new MyJTree();
}

public MyJTree() throws Exception {

super(Retrieving data from database );

MyConnection mycon = MyConnectionFactory.getNewConnection();
mycon.connect();

ArrayList list = new ArrayList();
list.add(The Root);

try {
String sql = select key, node_id, parent_id, caption from 
mytable;


st = mycon.createPreparedStatement(sql);
rs = st.executeQuery(sql);


while (rs.next()) {
Object value[] = {rs.getString(1), rs.getString(2),
rs.getString(3), rs.getString(4)};
list.add(value);
}
} catch (Exception e) {
System.out.println(e);
}
rs.close();
st.close();

Object hierarchy[] = list.toArray();

JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container content = getContentPane();

DefaultMutableTreeNode root = processHierarchy(hierarchy);
JTree tree = new JTree(root);
content.add(new JScrollPane(tree), BorderLayout.CENTER);
setSize(275, 300);
setLocation(300, 100);
setVisible(true);
}

private DefaultMutableTreeNode processHierarchy(Object[] hierarchy) {
DefaultMutableTreeNode node = new 
DefaultMutableTreeNode(hierarchy[0]);

DefaultMutableTreeNode child;
for (int i = 1; i  hierarchy.length; i++) {
Object nodeSpecifier = hierarchy[i];
if (nodeSpecifier instanceof Object[]) // Ie node with
children
{
child = processHierarchy((Object[]) nodeSpecifier);
} else {
child = new DefaultMutableTreeNode(nodeSpecifier); // Ie 
Leaf

}
node.add(child);
}
return (node);
}
}


Thanks!
Oliver

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org






  



-
To unsubscribe, e-mail

Re: Tree based on database

2009-08-17 Thread Oliver-Sven Fritsch

Cemal,

thanks for your reply! right now I'am at step 3 of your guide. I got the 
database schema with entries in it, my connection works well and queries 
the database and delivers a ResultSet. :-)


The code I posted in my first email does work perfectly well, it even 
sorts the child nodes in the right order. There's just one big 
disadvantage: it displays my tree on a JFrame. I thought I could easily 
use my current code by just adding a few lines of code. But if i get you 
right I have to implement it in a complete different way. And this is 
where I'm running into troubles. I just have no clue how to implement 
the TreeModel. Is this task to trival to be explained somewhere? Can't 
believe I'm such a rookie. :-(


I'll try to get things done. Nevertheless be thankful for any further 
advices from you and the rest of this group.


Cheers Oliver.

Cemal wrote:

Oliver,

It's not difficult but you may need to break the problem down a bit if you
are new to some of this stuff. Then we can address any bits you really need
help with.

Broadly speaking, you could:
1 - create a simple database schema to experiment with and populate the
relevant table(s) with just enough data. Bear in mind that there are whole
books/doctoral-theses on hierarchical data structures in RDBMS and related
SQL techniques so keep your first example as simple as possible (eg a single
table with two text columns representing the relationship between your
nodes, say parent and child, and keep nodes unique eg Bob should
appear no more than once in once under child for its single, corresponding
parent, and Bob will appear as many times under parent as it has
children. Your root node should not appear under child! You can get much
more sophisticated/powerful/scalabe etc later. 


2 - prepare your JDBC/iBatis/JPA/Hibernate/SpringJDBC/Guice/Warp/Spring...
to access your database and extract the data as required and test that this
works. In essence, all you'll be doing is executing queries along the lines
of 
SELECT child FROM mytable WHERE parent = ?


3 implement a TreeModel (or extend/use AbstractTreeModel or
DefaultTreeModel) that uses whatever DAO (or direct data access) you set up
in step 2. In the most naive/simple implementation using JDBC, your getChild
implementation could 

make a connection, 
run the query above (the parent will be passed in), 
create a list from the result set,

return the child corresponding to the index passed in

Of course this would be a crazy solution but once you've got everything
working (you can test that same model in Swing and/or Wicket), you can start
worrying about lazy vs eager loading of nodes, caching,
adding/moving/editing nodes, n-tier architecture and plenty of other stuff a
real-world implementation needs to take account of.

Let us know how you get on once you given that (along with the stuff in my
previous post) a go.

Regards - Cemal 
jWeekend 
OO  Java Technologies, Wicket Training and Development 
http://jWeekend.com



Oliver-Sven Fritsch wrote:
  
Thanks for your reply. I guess defining the TreeModel is exactly my 
problem. I tried to find a tutorial on how to do so based on my database 
entries but I don't seem to find any. Maybe this is basic java knowledge 
and I'm searching at the wrong spots. But a little how to would be great 
because right now I have no idea how to solve my problem. I guess this 
is a common use case while handling Trees on web apps, yet wondering why 
there isn't a fool-proof guide. Any hints would be greatly appreaciated.


Oliver


Cemal wrote:



Oliver,

Wicket (core and extensions) has several tree components and they all
currently use Swing's TreeModel (javax.swing.tree.TreeModel). I say
currently as this is the case upto and including Wicket 1.4 but there is
some discussion about using a new type of model, more suited to webapps,
in
Wicket 1.5. Swing's TreeModel is not coupled to JTree at all even though
it
happens to be the model JTree uses. Wicket does _not_ use JTree, but its
trees use TreeModel.

In the context of a Swing UI your code below would be much more flexible,
powerful and in the spirit of Swing if you were to explicitly use a
TreeModel to manage interaction with the underlying data; I expect even
Swing's out-of-the-box AbstractTreeModel (or the provided concrete
subclass,
DefaultTreeModel which uses DefaultMutableTreeNode) would suffice for
your
use-case based on what the code you've posted is doing.

Once you have created your TreeModel, you can use it with Wicket's trees
too
as simply as:
 add(new LinkTree(tree, myTreeModel));
for example

See [1] for a simple example of how to use JTree (with a TreeModel), [2]
for
a simple Wicket tree example and if you want to learn a bit more about
how
some of Wicket's trees work check out this class diagram [3] from a
couple
of years ago. 


Does that make sense?

Regards - Cemal 
jWeekend 
OO  Java Technologies, Wicket Training and Development 
http://jWeekend.com


[1]
http://java.sun.com

Re: Beginner question about wicket:extend

2009-08-14 Thread Oliver-Sven Fritsch

Thanks for your quick reply!

I now got it! I thought it was the other way round! foolish me! :-)

Really appreciate!

Oliver


Eyal Golan wrote:

well,
markup inheritance lets you create pages (or panels for that mater) with the
same layout.
Suppose you want to have two pages that both have (the same) header and a
footer.
Markup inheritance is a way of doing that (there are other options as well).

So what you do is, create a Base page.
In that page you will add the header and footer normally as in any Wicket
page.
the html will look something like:
html
body
div wicket:id=header/div
wicket:child/
div wicket:id=footer/div
/body
/html

* I eliminate the java code as it is supposed to be simple.
But remember, you add the header and footer wicket components in THIS page

Now, in pages SubA and SubB you can add whatever you want. It will be put
where the wicket:child is located.
So,
1. in the html
html
body
wicket:extend
... Here all the sub stuff will be put
/wicket:extend
/body
/html

* actually the html and even the body tags are not really necessary, but
I am used to put them so my IDE won't get crazy :)

In the java you need to extend the base and add the components according to
the ones you added in the html.
you DON'T need to add the header and footer in the subclasses.

Eyal Golan
egola...@gmail.com

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary


On Fri, Aug 14, 2009 at 10:53 AM, Oliver-Sven Fritsch o...@3blogos.comwrote:

  

Hi everybody!

I'm really new to wicket and it's concepts. I so far created a very simple
page having some div containers and some static text. What I want to do now
is to include a page header. What I tried is to use the wicket:extend and
wicket:child tags to get thing working but with no success. I have my two
pages Index and Header. Having some basic jsp experience I thought extending
should work like jsp:include. When I try to get my header into the index
page nothing is showing up.

Code of Index.html
html   headtitlesome titlet/title
  link rel=stylesheet type=text/css href=styles.css/
/head
  body
  div id=page
  div id=header
  wicket:child/
  /div
[]

Code of Header.html
html
  head/head
  body
  wicket:extend
  div id=header
  h1Header.html/h1
  /div
  /wicket:extend
  /body
/html

Maybe I'm getting things totally wrong?

Another thing I wonder about is how does wicket know which page to include?

Thanks in advance!

Oliver


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org





  



--
Oliver-Sven Fritsch

3B LOGOS Logik+Logistik GmbH
Kaiserdamm 32, D-14057 Berlin, Tel.: 30 61 47 42
Geschäftsführer: Dr. Friedrich Barounig
Sitz: Berlin, Amtsgericht Charlottenburg, HRB 69523
UID: DE 198252668, SteuerNummer: 27/004/04695 



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org