[jboss-svn-commits] JBL Code SVN: r5795 - in labs/jbosslabs/trunk/portal-extensions/ajax-portal/src/java/org/jboss/labs/ajaxportal/gwt: client public
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Aug 11 15:29:18 EDT 2006
Author: szimano
Date: 2006-08-11 15:29:15 -0400 (Fri, 11 Aug 2006)
New Revision: 5795
Modified:
labs/jbosslabs/trunk/portal-extensions/ajax-portal/src/java/org/jboss/labs/ajaxportal/gwt/client/DnDContainer.java
labs/jbosslabs/trunk/portal-extensions/ajax-portal/src/java/org/jboss/labs/ajaxportal/gwt/client/DnDPanel.java
labs/jbosslabs/trunk/portal-extensions/ajax-portal/src/java/org/jboss/labs/ajaxportal/gwt/client/PortalAjax.java
labs/jbosslabs/trunk/portal-extensions/ajax-portal/src/java/org/jboss/labs/ajaxportal/gwt/public/AjaxPortal.html
Log:
some changes to ajax portal
Modified: labs/jbosslabs/trunk/portal-extensions/ajax-portal/src/java/org/jboss/labs/ajaxportal/gwt/client/DnDContainer.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/ajax-portal/src/java/org/jboss/labs/ajaxportal/gwt/client/DnDContainer.java 2006-08-11 19:25:01 UTC (rev 5794)
+++ labs/jbosslabs/trunk/portal-extensions/ajax-portal/src/java/org/jboss/labs/ajaxportal/gwt/client/DnDContainer.java 2006-08-11 19:29:15 UTC (rev 5795)
@@ -16,6 +16,8 @@
private int draggedWidgetRow, draggedWidgetCol;
+ private FlexTable debugTable;
+
public DnDContainer(Label label) {
this.label = label;
}
@@ -34,6 +36,11 @@
.getWidget(i, j)) {
CellCoords cellCoords = getCellSize(i, j);
+ debugTable.setWidget(i, j, new Label(cellCoords.getX()
+ + " " + cellCoords.getY() + " "
+ + cellCoords.getWidth() + " "
+ + cellCoords.getHeight()));
+
if (((DnDPanel) sender).intersects(cellCoords.getX(),
cellCoords.getY(), cellCoords.getWidth(),
cellCoords.getHeight())) {
@@ -41,20 +48,23 @@
label.setText("x: " + cellCoords.getX() + " y: "
+ cellCoords.getY() + " w: "
+ cellCoords.getWidth() + " h: "
- + cellCoords.getHeight() + " ["+i+","+j+"]");
+ + cellCoords.getHeight() + " [r:" + i + ",c:"
+ + j + "]");
// label.setText("Cell: "+i+" "+j);
- /*
- * dragStartX = this.getWidget(i, j).getAbsoluteLeft();
- * dragStartY = this.getWidget(i, j).getAbsoluteTop();
- *
- * for (int k = this.getRowCount() - 1; k >= i; k--) {
- * Widget w = this.getWidget(k, j); this.remove(w);
- * this.setWidget(k + 1, j, w); }
- *
- * this.remove(sender); this.setWidget(i, j, sender);
- */
+ dragStartX = this.getWidget(i, j).getAbsoluteLeft();
+ dragStartY = this.getWidget(i, j).getAbsoluteTop();
+
+ for (int k = this.getRowCount() - 1; k >= i; k--) {
+ Widget w = this.getWidget(k, j);
+ this.remove(w);
+ this.setWidget(k + 1, j, w);
+ }
+
+ this.remove(sender);
+ this.setWidget(i, j, sender);
+
}
}
}
@@ -86,7 +96,7 @@
}
public CellCoords getCellSize(int row, int cell) {
- //TODO COORDINATES
+ // TODO COORDINATES
if (row < 0 || row >= this.getRowCount()
|| cell >= this.getCellCount(row))
return null;
@@ -99,31 +109,54 @@
int width = 0;
int height = 0;
- for (int i = 0; !xFound && i < this.getCellCount(row); i++) {
+ for (int i = 0; !yFound && i < this.getCellCount(row); i++) {
if (this.getWidget(row, i) != null
- && (draggedWidgetRow != row && draggedWidgetCol != i)) {
- xFound = true;
- x = this.getWidget(row, i).getAbsoluteLeft();
+ && (draggedWidgetRow != row || draggedWidgetCol != i)) {
+ yFound = true;
+ y = this.getWidget(row, i).getAbsoluteTop();
height = this.getWidget(row, i).getOffsetHeight();
}
}
- for (int i = 0; !yFound && i < this.getRowCount(); i++) {
+ for (int i = 0; !xFound && i < this.getRowCount(); i++) {
if (this.getWidget(i, cell) != null
- && (draggedWidgetRow != i && draggedWidgetCol != cell)) {
- yFound = true;
- y = this.getWidget(i, cell).getAbsoluteTop();
+ && (draggedWidgetRow != i || draggedWidgetCol != cell)) {
+ xFound = true;
+ x = this.getWidget(i, cell).getAbsoluteLeft();
width = this.getWidget(i, cell).getOffsetWidth();
}
}
// couldn't determine coordinates of cell
- if (!xFound || !yFound)
- return null;
+ // if (!xFound || !yFound)
+ // return null;
+ ((DnDPanel) this.getWidget(row, cell)).setDebugMsg("x: " + x + " y: "
+ + y);
+
return new CellCoords(x, y, width, height);
}
+ public void setDebugTable(FlexTable debugTable) {
+ this.debugTable = debugTable;
+ }
+
+ public String getHTML(int row, int column) {
+ return null;
+ }
+
+ public String getText(int row, int column) {
+ return null;
+ }
+
+ public void setHTML(int row, int column, String html) {
+ // do nothing
+ }
+
+ public void setText(int row, int column, String text) {
+ // do nothing
+ }
+
}
class CellCoords {
Modified: labs/jbosslabs/trunk/portal-extensions/ajax-portal/src/java/org/jboss/labs/ajaxportal/gwt/client/DnDPanel.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/ajax-portal/src/java/org/jboss/labs/ajaxportal/gwt/client/DnDPanel.java 2006-08-11 19:25:01 UTC (rev 5794)
+++ labs/jbosslabs/trunk/portal-extensions/ajax-portal/src/java/org/jboss/labs/ajaxportal/gwt/client/DnDPanel.java 2006-08-11 19:29:15 UTC (rev 5795)
@@ -3,6 +3,7 @@
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.MouseListener;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
@@ -22,12 +23,16 @@
private int dragStartY;
private int dragStartX;
+
+ private Label debug;
public DnDPanel(String captionText) {
caption = new HTML(captionText);
caption.addMouseListener(this);
panel.add(caption, DockPanel.NORTH);
+ debug = new Label();
+ panel.add(debug);
listenerBox = new DnDListeners();
@@ -44,6 +49,10 @@
}
}
+ public void setDebugMsg(String msg) {
+ //debug.setText(msg);
+ }
+
public void onMouseEnter(Widget sender) {
// TODO Auto-generated method stub
Modified: labs/jbosslabs/trunk/portal-extensions/ajax-portal/src/java/org/jboss/labs/ajaxportal/gwt/client/PortalAjax.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/ajax-portal/src/java/org/jboss/labs/ajaxportal/gwt/client/PortalAjax.java 2006-08-11 19:25:01 UTC (rev 5794)
+++ labs/jbosslabs/trunk/portal-extensions/ajax-portal/src/java/org/jboss/labs/ajaxportal/gwt/client/PortalAjax.java 2006-08-11 19:29:15 UTC (rev 5795)
@@ -26,6 +26,7 @@
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.DockPanel;
+import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.RootPanel;
@@ -58,6 +59,8 @@
return __gwt_all;
}-*/;
+ private FlexTable debugTable;
+
public String[] getPropertyNames() {
return getPropertiesUnsplited().split(";");
}
@@ -74,10 +77,10 @@
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
- DnDPanel panel = new DnDPanel("panelek nr "+(i*4 + j));
+ DnDPanel panel = new DnDPanel("panelek nr " + (i * 4 + j));
panel.addDnDListener(container);
panel.add(new Button("kolejniasty panel baton"));
-
+
container.setWidget(i, j, panel);
}
}
@@ -87,6 +90,13 @@
vPanel.add(label);
vPanel.add(container);
+ debugTable = new FlexTable();
+ debugTable.setBorderWidth(1);
+
+ vPanel.add(debugTable);
+
+ container.setDebugTable(debugTable);
+
RootPanel.get("ajaxPortal").add(vPanel);
}
Modified: labs/jbosslabs/trunk/portal-extensions/ajax-portal/src/java/org/jboss/labs/ajaxportal/gwt/public/AjaxPortal.html
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/ajax-portal/src/java/org/jboss/labs/ajaxportal/gwt/public/AjaxPortal.html 2006-08-11 19:25:01 UTC (rev 5794)
+++ labs/jbosslabs/trunk/portal-extensions/ajax-portal/src/java/org/jboss/labs/ajaxportal/gwt/public/AjaxPortal.html 2006-08-11 19:29:15 UTC (rev 5795)
@@ -1,7 +1,7 @@
<html>
<head>
<meta name='gwt:module' content='org.jboss.labs.ajaxportal.gwt.PortalAjax' />
- <title>Hello</title>
+ <title>Ajax Portal Demo</title>
</head>
<body bgcolor="white">
<script language="javascript" src="/ajax-portal/www/org.jboss.labs.ajaxportal.gwt.PortalAjax/gwt.js"></script>
More information about the jboss-svn-commits
mailing list