Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
61a75824
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
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,发现更多精彩内容 >>
提交
61a75824
编写于
6月 02, 2019
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#6030 GIS viewer: save/load srid and clip settings (per-attribute)
上级
e1bc341c
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
87 addition
and
7 deletion
+87
-7
plugins/org.jkiss.dbeaver.data.gis.view/src/org/jkiss/dbeaver/ui/gis/panel/GISLeafletViewer.java
.../src/org/jkiss/dbeaver/ui/gis/panel/GISLeafletViewer.java
+43
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/virtual/DBVEntityAttribute.java
...c/org/jkiss/dbeaver/model/virtual/DBVEntityAttribute.java
+27
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/virtual/DBVModel.java
...r.model/src/org/jkiss/dbeaver/model/virtual/DBVModel.java
+17
-5
未找到文件。
plugins/org.jkiss.dbeaver.data.gis.view/src/org/jkiss/dbeaver/ui/gis/panel/GISLeafletViewer.java
浏览文件 @
61a75824
...
...
@@ -33,10 +33,15 @@ import org.jkiss.dbeaver.DBException;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.model.DBValueFormatting
;
import
org.jkiss.dbeaver.model.data.DBDAttributeBinding
;
import
org.jkiss.dbeaver.model.data.DBDDisplayFormat
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.gis.*
;
import
org.jkiss.dbeaver.model.runtime.VoidProgressMonitor
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
org.jkiss.dbeaver.model.virtual.DBVEntity
;
import
org.jkiss.dbeaver.model.virtual.DBVEntityAttribute
;
import
org.jkiss.dbeaver.model.virtual.DBVUtils
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.ui.ActionUtils
;
import
org.jkiss.dbeaver.ui.DBeaverIcons
;
...
...
@@ -44,6 +49,7 @@ import org.jkiss.dbeaver.ui.UIIcon;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.css.CSSUtils
;
import
org.jkiss.dbeaver.ui.css.DBStyles
;
import
org.jkiss.dbeaver.ui.data.IAttributeController
;
import
org.jkiss.dbeaver.ui.data.IValueController
;
import
org.jkiss.dbeaver.ui.dialogs.DialogUtils
;
import
org.jkiss.dbeaver.ui.gis.GeometryDataUtils
;
...
...
@@ -70,6 +76,9 @@ public class GISLeafletViewer implements IGeometryValueEditor {
private
static
final
String
[]
SUPPORTED_FORMATS
=
new
String
[]
{
"png"
,
"gif"
,
"bmp"
};
private
static
final
String
PROP_FLIP_COORDINATES
=
"gis.flipCoords"
;
private
static
final
String
PROP_SRID
=
"gis.srid"
;
private
final
IValueController
valueController
;
private
final
Browser
browser
;
private
DBGeometry
[]
lastValue
;
...
...
@@ -118,7 +127,23 @@ public class GISLeafletViewer implements IGeometryValueEditor {
GISEditorUtils
.
addRecentSRID
(
recentSRID
);
}
}
//recentSRIDs.sort(Integer::compareTo);
}
{
// Check for save settings
if
(
valueController
instanceof
IAttributeController
)
{
DBDAttributeBinding
binding
=
((
IAttributeController
)
valueController
).
getBinding
();
if
(
binding
.
getEntityAttribute
()
!=
null
)
{
DBVEntity
vEntity
=
DBVUtils
.
getVirtualEntity
(
binding
,
false
);
if
(
vEntity
!=
null
)
{
DBVEntityAttribute
vAttr
=
vEntity
.
getVirtualAttribute
(
binding
,
false
);
if
(
vAttr
!=
null
)
{
this
.
flipCoordinates
=
CommonUtils
.
getBoolean
(
vAttr
.
getProperty
(
PROP_FLIP_COORDINATES
),
this
.
flipCoordinates
);
this
.
sourceSRID
=
CommonUtils
.
toInt
(
vAttr
.
getProperty
(
PROP_SRID
),
this
.
sourceSRID
);
}
}
}
}
}
}
...
...
@@ -159,6 +184,7 @@ public class GISLeafletViewer implements IGeometryValueEditor {
}
GISViewerActivator
.
getDefault
().
getPreferences
().
setValue
(
PREF_RECENT_SRID_LIST
,
sridListStr
.
toString
());
}
saveAttributeSettings
();
}
public
void
setGeometryData
(
@Nullable
DBGeometry
[]
values
)
throws
DBException
{
...
...
@@ -467,6 +493,7 @@ public class GISLeafletViewer implements IGeometryValueEditor {
}
catch
(
DBException
e
)
{
DBWorkbench
.
getPlatformUI
().
showError
(
"Render error"
,
"Error rendering geometry"
,
e
);
}
saveAttributeSettings
();
updateToolbar
();
}
});
...
...
@@ -494,6 +521,21 @@ public class GISLeafletViewer implements IGeometryValueEditor {
toolBarManager
.
update
(
true
);
}
private
void
saveAttributeSettings
()
{
if
(
valueController
instanceof
IAttributeController
)
{
DBDAttributeBinding
binding
=
((
IAttributeController
)
valueController
).
getBinding
();
if
(
binding
.
getEntityAttribute
()
!=
null
)
{
DBVEntity
vEntity
=
DBVUtils
.
getVirtualEntity
(
binding
,
true
);
DBVEntityAttribute
vAttr
=
vEntity
.
getVirtualAttribute
(
binding
,
true
);
if
(
vAttr
!=
null
)
{
vAttr
.
setProperty
(
PROP_FLIP_COORDINATES
,
String
.
valueOf
(
flipCoordinates
));
vAttr
.
setProperty
(
PROP_SRID
,
String
.
valueOf
(
getValueSRID
()));
}
valueController
.
getExecutionContext
().
getDataSource
().
getContainer
().
getRegistry
().
flushConfig
();
}
}
}
private
void
updateControlsVisibility
()
{
GC
gc
=
new
GC
(
browser
.
getDisplay
());
try
{
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/virtual/DBVEntityAttribute.java
浏览文件 @
61a75824
...
...
@@ -38,6 +38,7 @@ public class DBVEntityAttribute implements DBSEntityAttribute
private
String
defaultValue
;
private
String
description
;
private
DBVTransformSettings
transformSettings
;
Map
<
String
,
String
>
properties
;
public
DBVEntityAttribute
(
DBVEntity
entity
,
DBVEntityAttribute
parent
,
String
name
)
{
this
.
entity
=
entity
;
...
...
@@ -52,6 +53,9 @@ public class DBVEntityAttribute implements DBSEntityAttribute
for
(
DBVEntityAttribute
child
:
copy
.
children
)
{
this
.
children
.
add
(
new
DBVEntityAttribute
(
entity
,
this
,
child
));
}
if
(!
CommonUtils
.
isEmpty
(
copy
.
properties
))
{
this
.
properties
=
new
LinkedHashMap
<>(
copy
.
properties
);
}
}
@NotNull
...
...
@@ -177,6 +181,28 @@ public class DBVEntityAttribute implements DBSEntityAttribute
this
.
transformSettings
=
transformSettings
;
}
public
Map
<
String
,
String
>
getProperties
()
{
return
properties
;
}
@Nullable
public
String
getProperty
(
String
name
)
{
return
CommonUtils
.
isEmpty
(
properties
)
?
null
:
properties
.
get
(
name
);
}
public
void
setProperty
(
String
name
,
@Nullable
String
value
)
{
if
(
properties
==
null
)
{
properties
=
new
LinkedHashMap
<>();
}
if
(
value
==
null
)
{
properties
.
remove
(
name
);
}
else
{
properties
.
put
(
name
,
value
);
}
}
public
boolean
hasValuableData
()
{
if
(!
CommonUtils
.
isEmpty
(
defaultValue
)
||
!
CommonUtils
.
isEmpty
(
description
))
{
return
true
;
...
...
@@ -188,6 +214,6 @@ public class DBVEntityAttribute implements DBSEntityAttribute
}
}
}
return
transformSettings
!=
null
&&
transformSettings
.
hasValuableData
();
return
transformSettings
!=
null
&&
transformSettings
.
hasValuableData
()
||
!
CommonUtils
.
isEmpty
(
properties
)
;
}
}
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/virtual/DBVModel.java
浏览文件 @
61a75824
...
...
@@ -24,10 +24,7 @@ import org.jkiss.dbeaver.model.DBUtils;
import
org.jkiss.dbeaver.model.data.DBDAttributeTransformerDescriptor
;
import
org.jkiss.dbeaver.model.exec.DBCLogicalOperator
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.struct.DBSEntity
;
import
org.jkiss.dbeaver.model.struct.DBSEntityConstraintType
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.model.struct.DBSObjectContainer
;
import
org.jkiss.dbeaver.model.struct.*
;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
import
org.jkiss.utils.ArrayUtils
;
import
org.jkiss.utils.CommonUtils
;
...
...
@@ -206,6 +203,14 @@ public class DBVModel extends DBVContainer {
}
}
}
if
(!
CommonUtils
.
isEmpty
(
attr
.
properties
))
{
for
(
Map
.
Entry
<
String
,
String
>
prop
:
attr
.
properties
.
entrySet
())
{
xml
.
startElement
(
TAG_PROPERTY
);
xml
.
addAttribute
(
ATTR_NAME
,
prop
.
getKey
());
xml
.
addAttribute
(
ATTR_VALUE
,
prop
.
getValue
());
xml
.
endElement
();
}
}
}
}
// Constraints
...
...
@@ -227,7 +232,10 @@ public class DBVModel extends DBVContainer {
xml
.
startElement
(
TAG_ASSOCIATION
);
DBSEntity
refEntity
=
fk
.
getAssociatedEntity
();
xml
.
addAttribute
(
ATTR_ENTITY
,
DBUtils
.
getObjectFullId
(
refEntity
));
xml
.
addAttribute
(
ATTR_CONSTRAINT
,
fk
.
getReferencedConstraint
().
getName
());
DBSEntityConstraint
refConstraint
=
fk
.
getReferencedConstraint
();
if
(
refConstraint
!=
null
)
{
xml
.
addAttribute
(
ATTR_CONSTRAINT
,
refConstraint
.
getName
());
}
for
(
DBVEntityForeignKeyColumn
cc
:
CommonUtils
.
safeCollection
(
fk
.
getAttributeReferences
(
null
)))
{
xml
.
startElement
(
TAG_ATTRIBUTE
);
xml
.
addAttribute
(
ATTR_NAME
,
cc
.
getAttributeName
());
...
...
@@ -322,6 +330,10 @@ public class DBVModel extends DBVContainer {
curTransformSettings
.
setTransformOption
(
atts
.
getValue
(
ATTR_NAME
),
atts
.
getValue
(
ATTR_VALUE
));
}
else
if
(
curAttribute
!=
null
)
{
curAttribute
.
setProperty
(
atts
.
getValue
(
ATTR_NAME
),
atts
.
getValue
(
ATTR_VALUE
));
}
else
if
(
curEntity
!=
null
)
{
curEntity
.
setProperty
(
atts
.
getValue
(
ATTR_NAME
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录