我有这样的布局结构:1)首先放置SimpleLayoutPanel 主(绿色边框)2)我想将DockLayoutPanel 子项添加到main(红色边框; 25px边距)
我实现了这个,但是附件(.jpg)中显示的结果对我来说很奇怪.
因此,儿童的所有红色(顶部,左侧,右侧,底部)边界 应位于主要内部,但子面板会发生变化.如何以正确的方式实现此逻辑?我有更复杂的ui结构3-4级.而且我也没有利润.
这里是代码和CSS:
SimpleLayoutPanel panel = new SimpleLayoutPanel();
panel.setStyleName("mainModulePanel");
SimpleLayoutPanel p = new SimpleLayoutPanel();
p.setStyleName("moduleBody");
panel.setWidget(p);
initWidget(panel);
//CSS
.moduleBody {
/*width: 100%;
height: 100%;*/
margin: 0px;
width: 100%;
height: 100%;
border: 3px solid red;
}
.mainModulePanel {
/*margin-top: 5px;
margin-bottom: 5px;
margin-right: 5px;*/
border: 3px solid green;
}
Run Code Online (Sandbox Code Playgroud) 如何在 Java 中组织 2 级缓存?
我在哪里可以找到有关 2 级缓存实现和缓存策略配置的信息,或者您能否向我展示可以解决此问题的任何方法。
我怎么可以重写removeEldestEntry
方法节约与帮助到文件最旧的条目FileOutputStream
,DataOutputStream
和writeObject()
.码.
这是一个例子:
import java.util.*;
public class level1 {
private static final int max_cache = 50;
private Map cache = new LinkedHashMap(max_cache, .75F, true) {
protected boolean removeEldestEntry(Map.Entry eldest) {
return size() > max_cache;
}
};
public level1() {
for (int i = 1; i < 52; i++) {
String string = String.valueOf(i);
cache.put(string, string);
System.out.println("\rCache size = " + cache.size() +
"\tRecent value = " + i + " \tLast value = …
Run Code Online (Sandbox Code Playgroud) 我有3个bean:组织,角色,用户
角色 - 组织关系 - @ManyToOne
角色 - 用户关系 - @ManyToMany
组织:
@Entity
@Table(name = "entity_organization")
public class Organization implements Serializable {
private static final long serialVersionUID = -646783073824774092L;
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
Long id;
String name;
@OneToMany(targetEntity = Role.class, mappedBy = "organization")
List<Role> roleList;
...
Run Code Online (Sandbox Code Playgroud)
作用:
@Entity
@Table(name = "entity_role")
public class Role implements Serializable {
private static final long serialVersionUID = -8468851370626652688L;
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
Long id;
String name;
String description;
@ManyToOne
Organization organization;
...
Run Code Online (Sandbox Code Playgroud)
用户:
@Entity …
Run Code Online (Sandbox Code Playgroud) 如何在java中将ip地址的十进制表示转换为32位整数值?我使用InetAddress类和getLocalHost方法来获取IP地址:
public class getIp {
public static void main(String[] args) {
InetAddress ipaddress;
try {
ipaddress=InetAddress.getLocalHost();
System.out.println(ipaddress);
}
catch(UnknownHostException ex)
{
System.out.println(ex.toString());
}
}
}
Run Code Online (Sandbox Code Playgroud)
我应该将结果转换为32位整数值而不是字符串,我该怎么做?谢谢!