java - wicket 如何更改导航器 css?

标签 java wicket

我的应用程序中有一个导航器,我想更改他的 css :

<div wicket:id="navigator">

我该如何引用他?... 并改变他的 View (css)? 谁能给我举个例子吗?

编辑

我的目标是将我的按钮添加到导航器中......

<table cellspacing="0" class="dataview" >
    <tbody>
    <thead>
    <tr>
        <th>Name</th>
        <th>password</th>
        <th>Delete</th>
    </tr>
    </thead>
    <tr wicket:id="simple" >

        <td><span wicket:id="name">Test ID</span></td>
        <td><span wicket:id="password">Test ID</span></td>
        <td><a href="#" wicket:id="deleteLink" class="button"></a></td>
    </tr>
    </tbody>
</table>

 <div wicket:id="navigator">

最佳答案

如果您想更改 PagingNavigator 的 html 代码,您可以创建一个扩展 PagingNavigatorMyPagingNavigator:

import org.apache.wicket.markup.html.navigation.paging.IPageable;
import org.apache.wicket.markup.html.navigation.paging.IPagingLabelProvider;
import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;

class MyPagingNavigator extends PagingNavigator {

    public MyPagingNavigator(String id, IPageable pageable) {
        super(id, pageable);
    }

    public MyPagingNavigator(String id, IPageable pageable, IPagingLabelProvider labelProvider) {
        super(id, pageable, labelProvider);
    }



}

然后您必须创建一个 MyPagingNavigator.html 您可以在其中进行更改。但请确保不要从 MyPagingNavigator.html 中删除任何组件(通过 wicket:id= 引用)

您可以使用 wicket 源 (src/wicket/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigator.html) 中的原始内容:

<?xml version="1.0" encoding="UTF-8" ?>
<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<html xmlns:wicket>
<body>
  <wicket:panel>
    <a wicket:id="first">&lt;&lt;</a>&nbsp;<a wicket:id="prev">&lt;</a>
    <span wicket:id="navigation">
          <a wicket:id="pageLink" href="#"><span wicket:id="pageNumber">5</span></a>
    </span>
    <a wicket:id="next">&gt;</a>&nbsp;<a wicket:id="last">&gt;&gt;</a>
  </wicket:panel>
</body>
</html>

关于java - wicket 如何更改导航器 css?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7215039/

相关文章:

java - 使用 Wicket 以 AJAX 方式上传文件

Java EE 7 动态用户角色

c# - 开发游戏服务器的好语言?

java - Lambdaj FinalClassArgumentCreators 的应用程序范围的配置。在哪里以及如何做?

java - 在 JBOSS 5.0.1 中访问 ServicePOJO 时出错

java - Wicket:如何向表行添加单击事件处理程序?

java - python解释器导入错误

java - 如何获取 Wicket DropDownChoice 中选定的值?

java - 如何使用参数 Wicket 引用页面

javascript - 如何在Wicket中提交ModalWindow而不显示警告提示?