How to get the table/tree/list cell underneath the mouse
I feel like I must be missing something. How can I find out the tree cell underneath the mouse cursor?
I am implementing drag and drop from a table to a tree. I need to know which tree cell the user dropped the item on. I can get the drop coordinates (in pixels, I assume) from the drag event, but there doesn't seem to be a way to convert that into the particular cell index. This same question applies to getting the list and table cell under at particular coordinates.
If there isn't an API for this, has anyone found a reliable workaround (dividing Y by cell height, etc.)
Thanks,
Josh
You need to put event handlers for the D&D events on the Cells that are being created (so you will need to set a custom cell factory). For example, every cell is a Node, and these support properties like 'onDragDroppedProperty', and 'onDragExitedProperty'.
When you add event handlers to these, you should be notified of items being dragged onto specific Cells of the Tree. A Cell then can be matched with a particular item in the Tree by reading its TreeItem property.
Also read the documentation for TreeItem. There is a bit there that says:
"It is important to note however that a TreeItem is not a Node, which means that only the event types defined in TreeItem will be delivered. To listen to general events (for example mouse interactions), it is necessary to add the necessary listeners to the cells contained within the TreeView (by providing a cell factory)."
Which gives a clear hint at the end that for other interactions, you should add listeners to the Cells.
Good luck!
Similar Messages
-
How to get the coordinate of a cell in the jtable?
How to get the coordinate of a cell in the jtable?
How to get the point of a cell in the jtable?
Thanks for help!getCellRect(...);
-
How do i set the background of the table( not of cell / row / column).
How do i set the background of the table( not of cell / row / column).
What happens when i load the applet the table is blank and displays the background color is gray which we want to be white.
We tried using the setBackGround but it is not working maybe we are not using it properly. Any help would be gr8.
Thanks in advance.I don't understand very well, but i guess that the background is gray when the table content's empty, isn't it?
When the table model is empty, the JTable doesn't paint, so its container displays its background (often gray).
In this case, what you must do is force the table to paint, even if the model is empty. So, you have to create your own table and override three methods :
public class MyTable extends JTable
//specify the preferred and minum size when empty
myPreferredWidth = 200;
myPreferredHeigth =200;
myMinimunWidth = ...;
myMinimunHeigth = ...;
public Dimension getPreferredSize()
if(getModel().getRowCount() < 1)
return new Dimension(myPreferredWidth, myPreferredHeigth);
else
return super.getPreferredSize();
public Dimension getMinimumSize()
if( getModel().getRowCount() > 0)
return new Dimension(myMinimunWidth, myMinimunHeigth);
else
return super.getMinimumSize();
protected void paintComponent(Graphics g)
if (getModel().getRowCount<1 && isOpaque()) { //paint background
g.setColor(Color.white);
g.fillRect(0, 0, getWidth(), getHeight());
else super.paintComponent(g);
} -
I just downloaded 3 podcast items into my iPod shuffle but don't know how to listen to it. It plays the music list but don't know how to get to my podcast list to play it..
jfromnj wrote:
I purchased and downloaded the Family Pack of IWork. I recently purchased another computer (MacBook Pro) and I want to be able to use IWork on the new
computer but don't know how to go about it. The only thing on the Apple home page is to purchase either the item or trial pack. I don't think I should have to purchase anything since a family pack covers 5 computers in the same household. Please, if someone knows how to go about this and what I need to do so please let me know. Thank you.
You didn't keep the download for future use? -
How to get data from subsites list of SharePoint 2010 in ssrs
Hi,
Can someone help me on this issue.
I want to create a report using ssrs, I have some of the data in SQL and some of the data in sharepoint list.
First I need to go to SQL and get the data from the table which contains URL for the subsite in sharepoint.
after that I need to go to all the subsites and go to perticulat list in the subsites and get data from that list.
for example, their is a top level site "abc"
it contains sub site "123", "456","567", etc.. All this sub sites contain a list by name "Sample List", Now I need to go to that sub site list(Sample List) and get list-item column say "created By" which
is created on particular date.
in my report, I need to print the sub site "url/Title" which comes from SQL database and list-item column "Created By" of that sub site list "Sample List".
I tried using subreport inside a report by using "Microsoft SharePoint List" as a datasource, but when it comes to real time we don't know how many subsites will be created, so we can't create a datasource for each subsite site.
I guess we need to be using XML as a datasource, but how can we go to particular subsite in query while using XML, since all subsites have list with the same name ?
I appreciate your help.
Thank you,
KishoreHi Kishore,
SQL Server Reporting Services(SSRS) supports expression-based connection strings. This will help us to achieve the goal you mentioned in this case:
Create a new report
Create a Data Source in the report with the connection string like this:
http://server/_vti_bin/lists.asmx (We use static connection string instead of expression-based connection string now, as it is not supported to get fields based on expression-based connection string in design time. We will change it to be expression-based
connection string later)
Create the data set(as you have done using XML query language). Please use list name instead of GUID in the listName parameter.
Design the report(e.g. Add controls to the report)
Now, let's change the connection string to be expression-based. First, please add a parameter to the report, move this parameter to top. This parameter is used to store the sub site name.
Open the Data Source editor, set the connection string to be: ="http://server/" & Parameters!parameterCreatedInStep5.value & "_vti_bin/lists.asmx"
In the main report, pass the sub site name to the report we created above via the parameter created in step5
That is all.
Anyway, this is actually a SQL Server Reporting Service(SSRS) question. You can get better support on this question from:
http://social.technet.microsoft.com/Forums/en/sqlreportingservices/threads
For more information about Expression-Based connection string, please see:
http://msdn.microsoft.com/en-us/library/ms156450.aspx#Expressions
If there is anything unclear, please feel free to ask.
Thanks,
Jinchun Chen
Jin Chen - MSFT -
How to get updated table values from objectlistdataproviders
how to get updated table values from objectlistdataproviders
Hi,
Here is a sample code
start-of-selection.
*Select the data you need into an internal table
loop at it_mara into wa_mara.
data that needs to be displayed in the output list
write:/ box as checkbox,
wa_mara-matnr under text-001,
wa_mara-maktx under text-002,
wa_mara-lgort under text-003.
Hide the data that needs to moved to internal table
hide:wa_mara-matnr, wa_mara-maktx, wa_mara-lgort.
endloop.
clear wa_mara.
end-of-selection.
lines = sy-linno.
at line-selection.
clear:it_matnr.
do lines times.
check sy-index > 1.
box = space.
read line sy-index field value box.
if box = 'X'.
*data selected using check box is moved to internal table
append wa_mara to it_matnr.
endif.
enddo.
Regards,
Jisha. -
How to get internal table from SAP Data Provider C#
Hello.
ABAP:
DATA: lt_t001 TYPE TABLE OF t001.
DATA: url(1000) TYPE c.
SELECT * INTO TABLE lt_t001 FROM t001.
CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'APPLICATION'
subtype = 'X-R3TABLE'
TABLES
data = lt_t001
CHANGING
url = url
EXCEPTIONS
OTHERS = 4.
C#:
using SAPDataProvider;
using SAPTableFactoryCtrl;
public void SetDataFromUrl(string url)
SAPDataProviderClass p = new SAPDataProviderClass();
p.SetDataFromURL("APPLICATION", "X-R3TABLE", url);
ISapDPR3Table tbl = p.GetDataAsR3Table("APPLICATION", "X-R3TABLE");
SAPTableFactoryClass tf = new SAPTableFactoryClass();
Table tb = (Table)tf.NewTable();
tb.ISAPrfcITab = tbl.DataTable; // Exception !!!!!!
How to get internal table from SAP Data Provider ?Hi Sergey,
I'm trying to do the same, have you found a solution to solved it?
thanks for your help.
Regards.
Jonathan -
I've lost a load of notes, but dont know why or how to get them back. I cant find the folder that is in my Yahoo account that people have suggested might be the location for the messages. I recently signed into iCloud for the first time. Any idea how to get the notes back? I really dont want to lose them.
It should keep asking for the password, because it's trying to check for purchases... As soon as you login, it will see you have pending downloads and create the downloads section on the left below Purchases under the Store section. Then it will start the music downloads there, as they will be listed one below the other.
You could just try to check your account balance or view your account and that will trigger a password request too. You can just click on that and say that now iTunes keeps asking for the password and ask him to help you with that. Trick would be to interrupt him so that he carries on with another task after, so he doesn't notice the download. Or you carry on with email or browsing which you were "busy" with when iTunes interrupted you for the password (stupid iTunes) -
How to get pivot table by using dates
Hi,
How to get pivot table by using dates in column.
Below is the sample table and its value is given.
create table sample1
Order_DATE DATE,
order_CODE NUMBER,
Order_COUNT NUMBER
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('30-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),1,232);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('30-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),2,935);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('30-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),3,43);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('30-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),4,5713);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('30-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),5,11346);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('29-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),1,368);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('29-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),2,1380);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('29-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),3,133);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('29-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),4,7109);
Insert into sample1 (Order_DATE,order_CODE,Order_COUNT) values (to_timestamp('29-SEP-12','DD-MON-RR HH.MI.SSXFF AM'),5,14336);
select * from sample1;So how to get the data like below.
order_date
order_code 30-sep-12 29-sep-12
1 232 368
2 935 1380
3 43 133
4 5713 7109
5 11345 14336Using the extra data I inserted in my previous reply:select ORDER_CODE,
SUM(DECODE(extract (month from ORDER_DATE),1,ORDER_COUNT,0)) JAN,
SUM(DECODE(extract (month from ORDER_DATE),2,ORDER_COUNT,0)) FEB,
SUM(DECODE(extract (month from ORDER_DATE),3,ORDER_COUNT,0)) MAR,
SUM(DECODE(extract (month from ORDER_DATE),4,ORDER_COUNT,0)) APR,
SUM(DECODE(extract (month from ORDER_DATE),5,ORDER_COUNT,0)) MAY,
SUM(DECODE(extract (month from ORDER_DATE),6,ORDER_COUNT,0)) JUN,
SUM(DECODE(extract (month from ORDER_DATE),7,ORDER_COUNT,0)) JUL,
SUM(DECODE(extract (month from ORDER_DATE),8,ORDER_COUNT,0)) AUG,
SUM(DECODE(extract (month from ORDER_DATE),9,ORDER_COUNT,0)) SEP,
SUM(DECODE(extract (month from ORDER_DATE),10,ORDER_COUNT,0)) OCT,
SUM(DECODE(extract (month from ORDER_DATE),11,ORDER_COUNT,0)) NOV,
SUM(DECODE(extract (month from ORDER_DATE),12,ORDER_COUNT,0)) DEC
from SAMPLE1
where trunc(order_date, 'YY') = trunc(sysdate, 'YY')
group by order_code
order by order_code;
ORDER_CODE JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
1 0 0 0 0 0 0 0 0 600 600 0 0
2 0 0 0 0 0 0 0 0 2315 2315 0 0
3 0 0 0 0 0 0 0 0 176 176 0 0
4 0 0 0 0 0 0 0 0 12822 12822 0 0
5 0 0 0 0 0 0 0 0 25682 25682 0 0Now a bit of explanation.
1) Whenever you pivot rows to columns, no matter what version of Oracle and no matter what method you use, you have to decide in advance how many columns you are going to have and what the names of the columns are. This is a requirement of the SQL standard.
2) I use the WHERE clause to get just the data for this year
3) With EXTRACT, I get just the month without the year.
4) Using DECODE, I put every month's data into the correct column
5) Once I do all that, I can just GROUP BY order_code while SUMming all the data for each month. -
How to get Value of tree node without Reload Page
hi,
i worked with apex 4.2 and i created Tree and tabular form to retrieve the date according the value of tree select node the code of tree something like this
select case when connect_by_isleaf = 1 then 0
when level = 1 then 1
else -1
end as status,
level,
"ENAME" as title,
null as icon,
"EMPNO" as value,
null as tooltip,
'f?p=36648:34:5234984107903::::P40_SELECTED_NODE:'||empno as link
from "DEPT"."EMP"
start with "MGR" is null
connect by prior "EMPNO" = "MGR"
order siblings by "ENAME
and i put Selected Node Page Item: P40_SELECTED_NODE . the tree worked good and retrieve the data into tabular form according to tree node value
my Question :
1- i want to retrieve the data without submit the page where each time i select value from tree make page reload to update the tabular form with new value ,there is any way to pass the value of tree node to P40_SELECTED_NODE item and refresh tabular form without page reload .
2- i want when selected from tree run page process according to value of tree node i tray to create Dynamic action with *(jquery selector : div.tree li>a)* but the Value of node incorrect.
Regards
Ahmed;look at this link
Re: How to get Value of tree node without Reload Page ..! -
How to get nested table meta data
how to get nested table column name, column type and column size
by using java. i need code for this.
please help me.The Follopwing program does display the the details of table. Hope you get the solution
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
public class Main {
public static void main(String[] args) throws Exception {
Connection conn = getOracleConnection();
System.out.println("Got Connection.");
Statement st = conn.createStatement();
st = conn.createStatement();
ResultSet rs = st.executeQuery("SELECT * FROM SCHEDULE_SET");
ResultSetMetaData rsMetaData = rs.getMetaData();
int numberOfColumns = rsMetaData.getColumnCount();
System.out.println("resultSet MetaData column Count=" + numberOfColumns);
for (int i = 1; i <= numberOfColumns; i++) {
System.out.println("column MetaData ");
System.out.println("column number " + i);
// indicates the designated column's normal maximum width in
// characters
System.out.println(rsMetaData.getColumnDisplaySize(i));
// gets the designated column's suggested title
// for use in printouts and displays.
System.out.println(rsMetaData.getColumnLabel(i));
// get the designated column's name.
System.out.println(rsMetaData.getColumnName(i));
// get the designated column's SQL type.
System.out.println(rsMetaData.getColumnType(i));
// get the designated column's SQL type name.
System.out.println(rsMetaData.getColumnTypeName(i));
// get the designated column's class name.
System.out.println(rsMetaData.getColumnClassName(i));
// get the designated column's table name.
System.out.println(rsMetaData.getTableName(i));
// get the designated column's number of decimal digits.
System.out.println(rsMetaData.getPrecision(i));
// gets the designated column's number of
// digits to right of the decimal point.
System.out.println(rsMetaData.getScale(i));
// indicates whether the designated column is
// automatically numbered, thus read-only.
System.out.println(rsMetaData.isAutoIncrement(i));
// indicates whether the designated column is a cash value.
System.out.println(rsMetaData.isCurrency(i));
// indicates whether a write on the designated
// column will succeed.
System.out.println(rsMetaData.isWritable(i));
// indicates whether a write on the designated
// column will definitely succeed.
System.out.println(rsMetaData.isDefinitelyWritable(i));
// indicates the nullability of values
// in the designated column.
System.out.println(rsMetaData.isNullable(i));
// Indicates whether the designated column
// is definitely not writable.
System.out.println(rsMetaData.isReadOnly(i));
// Indicates whether a column's case matters
// in the designated column.
System.out.println(rsMetaData.isCaseSensitive(i));
// Indicates whether a column's case matters
// in the designated column.
System.out.println(rsMetaData.isSearchable(i));
// indicates whether values in the designated
// column are signed numbers.
System.out.println(rsMetaData.isSigned(i));
// Gets the designated column's table's catalog name.
System.out.println(rsMetaData.getCatalogName(i));
// Gets the designated column's table's schema name.
System.out.println(rsMetaData.getSchemaName(i));
st.close();
conn.close();
public static Connection getOracleConnection() throws Exception {
String driver = "oracle.jdbc.driver.OracleDriver";
String url = "jdbc:oracle:thin:@son15644:1521:CXPqa1";
String username = "ess4qa2";
String password = "ess4qa2pw";
Class.forName(driver); // load Oracle driver
Connection conn = DriverManager.getConnection(url, username, password);
return conn;
} -
How to get alternative strings in list of strings.
Hi experts,
how to get alternative strings in list of strings.
eg
'country1, italy, country2, india, country3, paris, country4, scottland, country5, rome'
from the above list i need to fetch all the countries and their names separately.
like country1, country2, country3, country4, country5
italy, india, paris, scottland, rome
i am trying the above one in the below fashion
SELECT SUBSTR
('country1, italy, country2, india, country3, paris, country4, scottland, country5, rome',
1,
INSTR
('country1, italy, country2, india, country3, paris, country4, scottland, country5, rome',
1,
1
- 1
FROM DUAL
can you please any one help meIf you want the data to be more stuctured, and useful:
col col_name for a20
col col_value for a20
var inlist VARCHAR2(2000)
exec :inlist := 'country1, italy, country2, india, country3, paris, country4, scottland, country5, rome';
exec :inlist := replace(:inlist,' ')
select max(decode(mod(lvl,2),1,value)) col_name
,max(decode(mod(lvl,2),0,value)) col_value
from (select substr(:InList,start_pos+1, end_pos-start_pos-1) value
,lvl
from (select :InList
,case when level = 1 then
0
else
instr(:InList,',',1,level-1)
end start_pos
,case when instr(:InList,',',1,level) = 0
then length(:InList)+1
else
instr(:InList,',',1,level)
end end_pos
,level lvl
from dual
connect by level <=length(:InList)-length(replace(:InList,','))+1
group by ceil(lvl/2)
order by 1;
COL_NAME COL_VALUE
country1 italy
country2 india
country3 paris
country4 scottland
country5 rome
Untested on 10g
Then you could stragg the rows together ... -
How to get 11.02 (26) to look like the old itunes
I can't figure out how to get 11.02 (26) to look like the old itunes, the new itunes is so cluttered. I hate it.
I think your JTable is editable and thats why it fails to work.
The above code will work onlyfor non editable table.
I think the default setting for editable table is like that.
Let some one else gives you the answer for editable one.
Cheers ! -
My iMac holds my main iTunes account and it shows 4 devices are authorized to play iTunes. I can only name 3. How do I find out a list of all the devices that are authorized from this computer?
I don't believe this is possible, but you can deauthorize all your computers and start over if you are concerned.
See here
Best of luck -
How can I control the size of a cell in the GridBagLayout?
Hi,Swing Gurus
I am developing a swing-based program using JBulider5 enterprise.
It seems to me that the GridBagLayout is really a hard nut!
How can I control the size of a cell in the GridBagLayout?
It seems that I cann't control the size of a cell directly.
But how the size of a particular cell is determined when I switch the layout manager from XYLayout to GridBagLayout?
Thx in advance!
Regards,
Justinehi,i have not done what you are asking but there are fields like
COLUMNWIDTH, MINSIZE, MAXGRIDSIZE, PREFEREDSIZE to which you can set the appropriate values and test for your need.hope this helped.bye martian.
Maybe you are looking for
-
Hello, A family member gave me a keyboard for my birthday. They did not get the keyboard that I wanted. The keyboard was purchased about 3 months ago from Best Buy, but has just been opened last week. Is this product available for return or exchange?
-
Ship to Warehouse in Third Party Orders
Hi Everyone, In Case of Third Party Orders, Let me know the configuratins that needs to be done if we want the warehouse Nos. has to be selected as Ship to Party Information in SO/PR/PO. This is required in case we need a third party Item to be dive
-
Hi friends please tell me the procedure of Bank Reconciliation statment through sap what is the standard t code and how to use it thnks sst Edited by: shakti julu on Feb 18, 2009 7:30 AM
-
Just a statement to let others know.
-
Hi, can anyone tell be what format a date should be in when querying a database. I have some old code that was transfered to a new app server which follows Java standards very strictly. Now it gives me problems when comparing dates, for example a que