Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
0d98f89c
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dbeaver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0d98f89c
编写于
8月 14, 2017
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#1577 RSV: column swap
上级
f8c8c8fe
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
75 addition
and
11 deletion
+75
-11
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/lightgrid/IGridController.java
.../jkiss/dbeaver/ui/controls/lightgrid/IGridController.java
+24
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/lightgrid/LightGrid.java
...rc/org/jkiss/dbeaver/ui/controls/lightgrid/LightGrid.java
+18
-3
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/IResultSetController.java
...s/dbeaver/ui/controls/resultset/IResultSetController.java
+2
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
.../jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/spreadsheet/Spreadsheet.java
...beaver/ui/controls/resultset/spreadsheet/Spreadsheet.java
+10
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/spreadsheet/SpreadsheetPresentation.java
...ntrols/resultset/spreadsheet/SpreadsheetPresentation.java
+20
-6
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/lightgrid/IGridController.java
0 → 100644
浏览文件 @
0d98f89c
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.ui.controls.lightgrid
;
public
interface
IGridController
{
void
moveColumn
(
Object
dragColumn
,
Object
dropColumn
);
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/lightgrid/LightGrid.java
浏览文件 @
0d98f89c
...
...
@@ -431,6 +431,9 @@ public abstract class LightGrid extends Canvas {
@NotNull
public
abstract
IGridLabelProvider
getLabelProvider
();
@Nullable
public
abstract
IGridController
getGridController
();
public
boolean
hasNodes
()
{
return
!
rowNodes
.
isEmpty
();
}
...
...
@@ -3762,6 +3765,10 @@ public abstract class LightGrid extends Canvas {
focusColumn
=
column
;
}
public
void
resetFocus
()
{
focusColumn
=
null
;
focusItem
=
-
1
;
}
/**
* Returns true if the table is set to horizontally scroll column-by-column
...
...
@@ -4263,7 +4270,7 @@ public abstract class LightGrid extends Canvas {
// DnD
/////////////////////////////////////////////////////////////////////////////////
p
ublic
void
addDragAndDropSupport
()
p
rivate
void
addDragAndDropSupport
()
{
int
operations
=
DND
.
DROP_MOVE
;
...
...
@@ -4272,10 +4279,13 @@ public abstract class LightGrid extends Canvas {
source
.
addDragListener
(
new
DragSourceListener
()
{
private
Image
dragImage
;
private
long
lastDragEndTime
;
@Override
public
void
dragStart
(
DragSourceEvent
event
)
{
if
(
hoveringColumn
==
null
||
!
headerColumnDragStarted
)
{
if
(
hoveringColumn
==
null
||
!
headerColumnDragStarted
||
(
lastDragEndTime
>
0
&&
System
.
currentTimeMillis
()
-
lastDragEndTime
<
100
))
{
event
.
doit
=
false
;
}
else
{
draggingColumn
=
hoveringColumn
;
...
...
@@ -4301,6 +4311,7 @@ public abstract class LightGrid extends Canvas {
UIUtils
.
dispose
(
dragImage
);
dragImage
=
null
;
}
lastDragEndTime
=
System
.
currentTimeMillis
();
}
});
...
...
@@ -4376,7 +4387,11 @@ public abstract class LightGrid extends Canvas {
if
(
draggingColumn
==
null
||
draggingColumn
==
overColumn
)
{
return
;
}
System
.
out
.
println
(
"DROP "
+
draggingColumn
.
getElement
()
+
" over "
+
overColumn
.
getElement
());
IGridController
gridController
=
getGridController
();
if
(
gridController
!=
null
)
{
gridController
.
moveColumn
(
draggingColumn
.
getElement
(),
overColumn
.
getElement
());
}
draggingColumn
=
null
;
}
});
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/IResultSetController.java
浏览文件 @
0d98f89c
...
...
@@ -27,6 +27,7 @@ import org.jkiss.dbeaver.DBException;
import
org.jkiss.dbeaver.model.DBPContextProvider
;
import
org.jkiss.dbeaver.model.DBPMessageType
;
import
org.jkiss.dbeaver.model.data.DBDAttributeBinding
;
import
org.jkiss.dbeaver.model.data.DBDDataFilter
;
import
org.jkiss.dbeaver.model.data.DBDDataReceiver
;
import
org.jkiss.dbeaver.model.edit.DBEPersistAction
;
import
org.jkiss.dbeaver.model.preferences.DBPPreferenceStore
;
...
...
@@ -160,6 +161,7 @@ public interface IResultSetController extends DBPContextProvider {
void
updatePanelsContent
(
boolean
forceRefresh
);
void
setDataFilter
(
final
DBDDataFilter
dataFilter
,
boolean
refreshData
);
/**
* Enable/disable viewer actions. May be used by editors to "lock" RSV actions like navigation, edit, etc.
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
浏览文件 @
0d98f89c
...
...
@@ -340,7 +340,7 @@ public class ResultSetViewer extends Viewer
}
}
void
setDataFilter
(
final
DBDDataFilter
dataFilter
,
boolean
refreshData
)
public
void
setDataFilter
(
final
DBDDataFilter
dataFilter
,
boolean
refreshData
)
{
if
(!
model
.
getDataFilter
().
equals
(
dataFilter
))
{
//model.setDataFilter(dataFilter);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/spreadsheet/Spreadsheet.java
浏览文件 @
0d98f89c
...
...
@@ -65,6 +65,8 @@ public class Spreadsheet extends LightGrid implements Listener {
private
final
IGridContentProvider
contentProvider
;
@NotNull
private
final
IGridLabelProvider
labelProvider
;
@Nullable
private
final
IGridController
gridController
;
private
Clipboard
clipboard
;
...
...
@@ -74,7 +76,8 @@ public class Spreadsheet extends LightGrid implements Listener {
@NotNull
final
IWorkbenchPartSite
site
,
@NotNull
final
SpreadsheetPresentation
presentation
,
@NotNull
final
IGridContentProvider
contentProvider
,
@NotNull
final
IGridLabelProvider
labelProvider
)
@NotNull
final
IGridLabelProvider
labelProvider
,
@Nullable
final
IGridController
gridController
)
{
super
(
parent
,
style
);
GridLayout
layout
=
new
GridLayout
(
1
,
true
);
...
...
@@ -88,6 +91,7 @@ public class Spreadsheet extends LightGrid implements Listener {
this
.
presentation
=
presentation
;
this
.
contentProvider
=
contentProvider
;
this
.
labelProvider
=
labelProvider
;
this
.
gridController
=
gridController
;
this
.
clipboard
=
new
Clipboard
(
getDisplay
());
...
...
@@ -371,6 +375,11 @@ public class Spreadsheet extends LightGrid implements Listener {
return
labelProvider
;
}
@Override
public
IGridController
getGridController
()
{
return
gridController
;
}
public
void
redrawGrid
()
{
Rectangle
bounds
=
super
.
getBounds
();
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/spreadsheet/SpreadsheetPresentation.java
浏览文件 @
0d98f89c
...
...
@@ -85,10 +85,7 @@ import org.jkiss.dbeaver.ui.ActionUtils;
import
org.jkiss.dbeaver.ui.DBeaverIcons
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.controls.PropertyPageStandard
;
import
org.jkiss.dbeaver.ui.controls.lightgrid.GridCell
;
import
org.jkiss.dbeaver.ui.controls.lightgrid.GridPos
;
import
org.jkiss.dbeaver.ui.controls.lightgrid.IGridContentProvider
;
import
org.jkiss.dbeaver.ui.controls.lightgrid.IGridLabelProvider
;
import
org.jkiss.dbeaver.ui.controls.lightgrid.*
;
import
org.jkiss.dbeaver.ui.controls.resultset.*
;
import
org.jkiss.dbeaver.ui.controls.resultset.panel.ViewValuePanel
;
import
org.jkiss.dbeaver.ui.data.IMultiController
;
...
...
@@ -111,7 +108,7 @@ import java.util.regex.*;
* Spreadsheet presentation.
* Visualizes results as grid.
*/
public
class
SpreadsheetPresentation
extends
AbstractPresentation
implements
IResultSetEditor
,
ISelectionProvider
,
IStatefulControl
,
IAdaptable
{
public
class
SpreadsheetPresentation
extends
AbstractPresentation
implements
IResultSetEditor
,
ISelectionProvider
,
IStatefulControl
,
IAdaptable
,
IGridController
{
private
static
final
Log
log
=
Log
.
getLog
(
SpreadsheetPresentation
.
class
);
...
...
@@ -174,7 +171,8 @@ public class SpreadsheetPresentation extends AbstractPresentation implements IRe
controller
.
getSite
(),
this
,
new
ContentProvider
(),
new
GridLabelProvider
());
new
GridLabelProvider
(),
this
);
this
.
spreadsheet
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
this
.
spreadsheet
.
addSelectionListener
(
new
SelectionAdapter
()
{
...
...
@@ -1169,6 +1167,22 @@ public class SpreadsheetPresentation extends AbstractPresentation implements IRe
fireSelectionChanged
(
selection
);
}
@Override
public
void
moveColumn
(
Object
dragColumn
,
Object
dropColumn
)
{
if
(
dragColumn
instanceof
DBDAttributeBinding
&&
dropColumn
instanceof
DBDAttributeBinding
)
{
//System.out.println("SWAP " + dragColumn + " -> " + dropColumn);
DBDDataFilter
dataFilter
=
new
DBDDataFilter
(
controller
.
getModel
().
getDataFilter
());
final
DBDAttributeConstraint
c1
=
dataFilter
.
getConstraint
((
DBDAttributeBinding
)
dragColumn
);
final
DBDAttributeConstraint
c2
=
dataFilter
.
getConstraint
((
DBDAttributeBinding
)
dropColumn
);
final
int
vp2
=
c2
.
getVisualPosition
();
c2
.
setVisualPosition
(
c1
.
getVisualPosition
());
c1
.
setVisualPosition
(
vp2
);
spreadsheet
.
resetFocus
();
controller
.
setDataFilter
(
dataFilter
,
false
);
}
}
private
class
SpreadsheetSelectionImpl
implements
IResultSetSelection
{
@Nullable
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录