Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Uploader
Commits
f0f18312
Commit
f0f18312
authored
Sep 10, 2014
by
igoshin
Browse files
#14051 fixed opening tab,added jdbc rows limit
parent
044814c7
Changes
3
Hide whitespace changes
Inline
Side-by-side
anno-gui/src/main/java/org/genesys2/anno/gui/AppWindow.java
View file @
f0f18312
...
...
@@ -501,8 +501,8 @@ public class AppWindow {
IStructuredSelection
thisSelection
=
(
IStructuredSelection
)
e
.
getSelection
();
Object
selectedNode
=
thisSelection
.
getFirstElement
();
if
(
selectedNode
instanceof
DataSourceSheet
)
{
final
DataSourceSheet
currentSheet
=
(
DataSourceSheet
)
selectedNode
;
if
(
selectedNode
instanceof
I
DataSourceSheet
)
{
final
I
DataSourceSheet
currentSheet
=
(
I
DataSourceSheet
)
selectedNode
;
_log
.
debug
(
"Doubleclick "
+
currentSheet
);
int
i
=
0
;
for
(
Control
c
:
tabFolder
.
getTabList
())
{
...
...
@@ -518,34 +518,31 @@ public class AppWindow {
CTabItem
newSheetTab
=
createTab
(
tabFolder
,
currentSheet
);
// Load stuff
threadPool
.
execute
(
new
Runnable
()
{
@Override
public
void
run
()
{
try
{
final
List
<
Object
[]>
rows
=
dataSourceLoader
.
loadRows
(
currentSheet
,
200
);
currentSheet
.
updateData
(
rows
);
}
catch
(
UnsupportedDataFormatException
e
)
{
e
.
printStackTrace
();
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
});
tabFolder
.
setSelection
(
newSheetTab
);
}
else
if
(
selectedNode
instanceof
JdbcDataSourceSheet
)
{
final
JdbcDataSourceSheet
currentSheet
=
(
JdbcDataSourceSheet
)
selectedNode
;
CTabItem
newSheetTab
=
createTab
(
tabFolder
,
currentSheet
);
if
(
selectedNode
instanceof
DataSourceSheet
)
{
threadPool
.
execute
(
new
Runnable
()
{
@Override
public
void
run
()
{
try
{
final
List
<
Object
[]>
rows
=
dataSourceLoader
.
loadRows
(
currentSheet
,
200
);
currentSheet
.
updateData
(
rows
);
}
catch
(
UnsupportedDataFormatException
e
)
{
e
.
printStackTrace
();
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
});
}
tabFolder
.
setSelection
(
newSheetTab
);
}
}
});
sashForm_1
.
setWeights
(
new
int
[]
{
4
});
}
});
sashForm_1
.
setWeights
(
new
int
[]
{
4
});
ToolBar
toolBar
=
new
ToolBar
(
shlGenesysMagic
,
SWT
.
FLAT
);
toolBar
.
setBackground
(
SWTResourceManager
.
getColor
(
SWT
.
COLOR_WIDGET_BACKGROUND
));
...
...
anno-gui/src/main/java/org/genesys2/anno/gui/SheetDisplay.java
View file @
f0f18312
...
...
@@ -501,7 +501,7 @@ public class SheetDisplay extends Composite {
final
List
<
Object
[]>
rows
;
try
{
rows
=
jdbcRowReader
.
getRows
(
query
,
url
,
user
,
password
);
rows
=
jdbcRowReader
.
getRows
(
query
,
url
,
user
,
password
,
100
);
if
(
rows
!=
null
)
{
currentSheet
.
updateData
(
rows
);
}
...
...
anno-gui/src/main/java/org/genesys2/anno/reader/JDBCRowReader.java
View file @
f0f18312
...
...
@@ -13,13 +13,15 @@ import java.util.List;
public
class
JDBCRowReader
{
private
static
final
Logger
_log
=
Logger
.
getLogger
(
JDBCRowReader
.
class
);
public
List
<
Object
[]>
getRows
(
String
query
,
String
url
,
String
user
,
String
password
)
throws
SQLException
{
public
List
<
Object
[]>
getRows
(
String
query
,
String
url
,
String
user
,
String
password
,
int
limit
)
throws
SQLException
{
List
<
Object
[]>
rows
=
new
ArrayList
<
Object
[]>();
Connection
conn
=
ConnectionUtils
.
getConnection
(
url
,
user
,
password
);
PreparedStatement
ps
=
conn
.
prepareStatement
(
query
);
ps
.
setMaxRows
(
limit
);
ResultSet
res
=
ps
.
executeQuery
();
ResultSetMetaData
metaData
=
res
.
getMetaData
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment