Image 当我在tomcat上部署gwt应用程序并在IE中运行它时,来自资源包的所有图像都会显示在屏幕上
嗨,我正在开发一个项目,我需要制作一个时间线,在这个项目中,我需要根据条件动态地将图像放置在水平线上。映像实例将根据数据库的条件而有所不同,并且实例的数量也将有所不同。我使用了一个绝对面板来实现这一点,并将图像放置在水平轴之间相差40的位置,保持y轴不变。这些图像来自一个类,该类扩展了客户机包,如下所示Image 当我在tomcat上部署gwt应用程序并在IE中运行它时,来自资源包的所有图像都会显示在屏幕上,image,internet-explorer,gwt,tomcat,Image,Internet Explorer,Gwt,Tomcat,嗨,我正在开发一个项目,我需要制作一个时间线,在这个项目中,我需要根据条件动态地将图像放置在水平线上。映像实例将根据数据库的条件而有所不同,并且实例的数量也将有所不同。我使用了一个绝对面板来实现这一点,并将图像放置在水平轴之间相差40的位置,保持y轴不变。这些图像来自一个类,该类扩展了客户机包,如下所示 public interface TimeLineWidgetResources extends ClientBundle { TimeLineWidgetResources INSTAN
public interface TimeLineWidgetResources extends ClientBundle {
TimeLineWidgetResources INSTANCE = GWT
.create(TimeLineWidgetResources.class);
@Source("application-connection-point_big.png")
ImageResource getApplicationConnectionPointImage();
@Source("business-connection-point_big.png")
ImageResource getBusinessConnectionPointImage();
@Source("monitor_small.png")
ImageResource getMonitorImage();
}
我在这里只放了3张,但在我的资源文件中,我几乎有15张图片。
在IE、Chrome和Safari的jetty服务器上,时间线看起来非常完美。但是当我创建一个war并在tomcat中部署它时,它在Chrome和safari中看起来非常完美,但是所有的图像都会显示在IE的屏幕上。如果我创建了5个实例,那么它就创建了5*15=75个这些图像的实例。有人能帮我吗。我做错了什么?让我在这里发布绝对面板代码
/** The method to build Time Line using an absolute Panel */
public void buildNewTimeLine(GWTTimeLine timeLine) {
absolutePanel.setPixelSize((Window.getClientWidth() * 3) / 4, 200);
absolutePanel.getElement().getStyle().setOverflow(Overflow.AUTO);
String startDate = timeLine.getStartDate();
String endDate = timeLine.getEndDate();
List<GWTTimeLineComponent> timeLineComponents = new ArrayList<GWTTimeLineComponent>();
timeLineComponents = timeLine.getComponents();
buildTimeLineEvents(timeLineComponents);
int i = 0;
for (i = 0; i < timeLineComponents.size(); i++) {
if (i == 0) {
Image startImage = new Image();
startImage
.setUrl(resources.getVerticalLineImage().getSafeUri());
absolutePanel.add(startImage, 48, 70);
}
if (i == (timeLineComponents.size() - 1)) {
Image continueImage = new Image();
continueImage
.setUrl(resources.getLineArrowImage().getSafeUri());
absolutePanel.add(continueImage, horizontalImageXAxis + 80, 70);
}
GWTTimeLineComponent timeLineComponent = new GWTTimeLineComponent();
timeLineComponent = timeLineComponents.get(i);
String icon = timeLineComponent.getIcon();
int id = timeLineComponent.getId();
String logicalId = timeLineComponent.getLogicalId();
List<GWTTimeLineEvent> timeLineEvents = new ArrayList<GWTTimeLineEvent>();
timeLineEvents = timeLineComponent.getEvents();
if (icon.startsWith("infor.engine.monitor")) {
if (isAbove == true) {
isAbove = false;
isBelow = true;
Image monitorImage = new Image();
monitorImage.setUrl(resources.getMonitorImage()
.getSafeUri());
monitorImage.setTitle(timeLineComponent.getLogicalId());
String downOrUpOrBiDirectionalArrow = "up";
buildTimeLineComponents(downOrUpOrBiDirectionalArrow,
monitorImage, id, logicalId);
}
else if (isBelow == true) {
isAbove = true;
isBelow = false;
Image monitorImage = new Image();
monitorImage.setUrl(resources.getMonitorImage()
.getSafeUri());
monitorImage.setTitle(timeLineComponent.getLogicalId());
String downOrUpOrBiDirectionalArrow = "down";
buildTimeLineComponents(downOrUpOrBiDirectionalArrow,
monitorImage, id, logicalId);
}
} else if (icon.startsWith("infor.database")) {
if (isAbove == true) {
isAbove = false;
isBelow = true;
Image databaseImage = new Image();
databaseImage.setUrl(resources
.getDatabaseConnectionPointImage().getSafeUri());
databaseImage.setTitle(timeLineComponent.getLogicalId());
String downOrUpOrBiDirectionalArrow = "up";
buildTimeLineComponents(downOrUpOrBiDirectionalArrow,
databaseImage, id, logicalId);
}
else if (isBelow == true) {
isAbove = true;
isBelow = false;
Image databaseImage = new Image();
databaseImage.setUrl(resources
.getDatabaseConnectionPointImage().getSafeUri());
databaseImage.setTitle(timeLineComponent.getLogicalId());
String downOrUpOrBiDirectionalArrow = "down";
buildTimeLineComponents(downOrUpOrBiDirectionalArrow,
databaseImage, id, logicalId);
}
} else if (icon.startsWith("infor.jms")) {
if (isAbove == true) {
isAbove = false;
isBelow = true;
Image jmsImage = new Image();
jmsImage.setUrl(resources.getJmsQueueConnectionPointImage()
.getSafeUri());
jmsImage.setTitle(timeLineComponent.getLogicalId());
String downOrUpOrBiDirectionalArrow = "up";
buildTimeLineComponents(downOrUpOrBiDirectionalArrow,
jmsImage, id, logicalId);
}
else if (isBelow == true) {
isAbove = true;
isBelow = false;
Image jmsImage = new Image();
jmsImage.setUrl(resources.getJmsQueueConnectionPointImage()
.getSafeUri());
jmsImage.setTitle(timeLineComponent.getLogicalId());
String downOrUpOrBiDirectionalArrow = "down";
buildTimeLineComponents(downOrUpOrBiDirectionalArrow,
jmsImage, id, logicalId);
}
} else if (icon.startsWith("infor.ws")) {
if (isAbove == true) {
isAbove = false;
isBelow = true;
Image webServiceImage = new Image();
webServiceImage.setUrl(resources
.getWebServiceConnectionPointImage().getSafeUri());
webServiceImage.setTitle(timeLineComponent.getLogicalId());
String downOrUpOrBiDirectionalArrow = "up";
buildTimeLineComponents(downOrUpOrBiDirectionalArrow,
webServiceImage, id, logicalId);
}
else if (isBelow == true) {
isAbove = true;
isBelow = false;
Image webServiceImage = new Image();
webServiceImage.setUrl(resources
.getWebServiceConnectionPointImage().getSafeUri());
webServiceImage.setTitle(timeLineComponent.getLogicalId());
String downOrUpOrBiDirectionalArrow = "down";
buildTimeLineComponents(downOrUpOrBiDirectionalArrow,
webServiceImage, id, logicalId);
}
} else if (icon.startsWith("infor.sap")) {
if (isAbove == true) {
isAbove = false;
isBelow = true;
Image sapImage = new Image();
sapImage.setUrl(resources.getBusinessConnectionPointImage()
.getSafeUri());
sapImage.setTitle(timeLineComponent.getLogicalId());
String downOrUpOrBiDirectionalArrow = "up";
buildTimeLineComponents(downOrUpOrBiDirectionalArrow,
sapImage, id, logicalId);
}
else if (isBelow == true) {
isAbove = true;
isBelow = false;
Image sapImage = new Image();
sapImage.setUrl(resources.getBusinessConnectionPointImage()
.getSafeUri());
sapImage.setTitle(timeLineComponent.getLogicalId());
String downOrUpOrBiDirectionalArrow = "down";
buildTimeLineComponents(downOrUpOrBiDirectionalArrow,
sapImage, id, logicalId);
}
}
else if (icon.startsWith("infor.bod")) {
Image horizontalLine = new Image();
horizontalLine.setUrl(resources.getHorizontalLineImage()
.getSafeUri());
Image bodImage = new Image();
bodImage.setUrl(resources.getBodImage().getSafeUri());
addBodImageClickHandlers(bodImage,
searchEvent.getSelectedMessageId());
bodImageXAxis = horizontalImageXAxis + 40;
horizontalImageXAxis = horizontalImageXAxis + 20;
bodImageYAxis = 65;
absolutePanel.add(bodImage, bodImageXAxis, bodImageYAxis);
}
}
}
/** The method to build Time Line components */
public void buildTimeLineComponents(String downOrUpOrBiDirectionalArrow,
Image connectionPointImage, int id, String logicalId) {
Image horizontalLine = new Image();
horizontalLine.setUrl(resources.getHorizontalLineImage().getSafeUri());
Image arrow = new Image();
if (downOrUpOrBiDirectionalArrow.equals("down")) {
arrow.setUrl(resources.getDownArrowImage().getSafeUri());
connectionPointImageYAxis = 95;
arrowImageYAxis = 72;
}
if (downOrUpOrBiDirectionalArrow.equals("up")) {
arrow.setUrl(resources.getUpArrowImage().getSafeUri());
connectionPointImageYAxis = 10;
arrowImageYAxis = 46;
}
addConnectionPointImageClickHandlers(connectionPointImage, id,
logicalId);
horizontalImageXAxis = horizontalImageXAxis + widthBetweenTImages;
absolutePanel.add(horizontalLine, horizontalImageXAxis,
horizontalImageYAxis);
connectionPointImageXAxis = horizontalImageXAxis + 7;
arrowImageXAxis = horizontalImageXAxis + 15;
absolutePanel.add(connectionPointImage, connectionPointImageXAxis,
connectionPointImageYAxis);
absolutePanel.add(arrow, arrowImageXAxis, arrowImageYAxis);
}
/**使用绝对面板构建时间线的方法*/
公共void buildNewTimeLine(gwtimeline时间线){
absolutePanel.setPixelSize((Window.getClientWidth()*3)/4200);
absolutePanel.getElement().getStyle().setOverflow(Overflow.AUTO);
字符串startDate=timeLine.getStartDate();
字符串endDate=timeLine.getEndDate();
列出timeLineComponents=new ArrayList();
timeLineComponents=timeLine.getComponents();
buildTimeLineEvents(timeLineComponents);
int i=0;
对于(i=0;i