こんにちは私は、条件に応じて画像を動的に水平線に配置する必要があるタイムラインのようなものを作成する必要があるプロジェクトを開発しています。イメージのインスタンスは、データベースからの条件に基づいて異なり、インスタンスの数も異なります。そのために絶対パネルを使用し、y 軸を一定に保ちながら、水平軸の差が 40 になるように画像を配置しました。画像は、次のように Client Bundle を拡張するクラスから取得されます。
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 サーバーで完璧に見えました。しかし、戦争を作成して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);
}
助けてください。