Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
fef862f2
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,发现更多精彩内容 >>
提交
fef862f2
编写于
2月 07, 2019
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#4209 Dashboards configuration and dialogs
上级
a3a97d95
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
200 addition
and
75 deletion
+200
-75
plugins/org.jkiss.dbeaver.ui.dashboard/src/org/jkiss/dbeaver/ui/dashboard/DashboardStorage.java
.../src/org/jkiss/dbeaver/ui/dashboard/DashboardStorage.java
+0
-63
plugins/org.jkiss.dbeaver.ui.dashboard/src/org/jkiss/dbeaver/ui/dashboard/control/DashboardChartComposite.java
...dbeaver/ui/dashboard/control/DashboardChartComposite.java
+1
-0
plugins/org.jkiss.dbeaver.ui.dashboard/src/org/jkiss/dbeaver/ui/dashboard/view/DashboardAddDialog.java
...g/jkiss/dbeaver/ui/dashboard/view/DashboardAddDialog.java
+63
-0
plugins/org.jkiss.dbeaver.ui.dashboard/src/org/jkiss/dbeaver/ui/dashboard/view/DashboardChartConfigDialog.java
...dbeaver/ui/dashboard/view/DashboardChartConfigDialog.java
+5
-12
plugins/org.jkiss.dbeaver.ui.dashboard/src/org/jkiss/dbeaver/ui/dashboard/view/DashboardViewConfiguration.java
...dbeaver/ui/dashboard/view/DashboardViewConfiguration.java
+126
-0
plugins/org.jkiss.dbeaver.ui.dashboard/src/org/jkiss/dbeaver/ui/dashboard/view/HandlerDashboardAddItem.java
...ss/dbeaver/ui/dashboard/view/HandlerDashboardAddItem.java
+5
-0
未找到文件。
plugins/org.jkiss.dbeaver.ui.dashboard/src/org/jkiss/dbeaver/ui/dashboard/DashboardStorage.java
已删除
100644 → 0
浏览文件 @
a3a97d95
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2019 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.dashboard
;
import
org.jkiss.dbeaver.ui.dashboard.internal.UIDashboardActivator
;
import
org.jkiss.dbeaver.ui.dashboard.registry.DashboardDescriptor
;
import
java.io.File
;
/**
* Dashboard renderer
*/
public
class
DashboardStorage
{
public
static
class
ViewSettings
{
DashboardDescriptor
dashboard
;
}
private
String
viewId
;
public
DashboardStorage
(
String
viewId
)
{
this
.
viewId
=
viewId
;
}
public
boolean
loadSettings
()
{
//getInstance().getStateLocation().toFile()
ViewSettings
viewConfig
=
getViewsSettings
(
viewId
);
if
(
viewConfig
==
null
)
{
return
false
;
}
return
true
;
}
private
ViewSettings
getViewsSettings
(
String
viewId
)
{
ViewSettings
viewSettings
=
new
ViewSettings
();
File
configFile
=
getConfigFile
(
viewId
);
if
(
configFile
.
exists
())
{
}
return
viewSettings
;
}
private
File
getConfigFile
(
String
viewId
)
{
File
pluginFolder
=
UIDashboardActivator
.
getDefault
().
getStateLocation
().
toFile
();
return
new
File
(
pluginFolder
,
"view-"
+
viewId
+
".xml"
);
}
}
plugins/org.jkiss.dbeaver.ui.dashboard/src/org/jkiss/dbeaver/ui/dashboard/control/DashboardChartComposite.java
浏览文件 @
fef862f2
...
...
@@ -22,6 +22,7 @@ import org.eclipse.swt.graphics.Point;
import
org.eclipse.swt.widgets.Composite
;
import
org.jkiss.dbeaver.ui.charts.BaseChartComposite
;
import
org.jkiss.dbeaver.ui.dashboard.model.DashboardContainer
;
import
org.jkiss.dbeaver.ui.dashboard.view.DashboardChartConfigDialog
;
/**
* Dashboard chart composite
...
...
plugins/org.jkiss.dbeaver.ui.dashboard/src/org/jkiss/dbeaver/ui/dashboard/view/DashboardAddDialog.java
0 → 100644
浏览文件 @
fef862f2
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2019 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.dashboard.view
;
import
org.eclipse.jface.dialogs.IDialogConstants
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.widgets.Button
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Shell
;
import
org.jkiss.dbeaver.ui.controls.finder.viewer.AdvancedListViewer
;
import
org.jkiss.dbeaver.ui.dialogs.BaseDialog
;
/**
* Dashboard add dialog
*/
public
class
DashboardAddDialog
extends
BaseDialog
{
private
static
final
String
DIALOG_ID
=
"DBeaver.DashboardAddDialog"
;
//$NON-NLS-1$
private
static
final
int
MANAGER_BUTTON_ID
=
1000
;
public
DashboardAddDialog
(
Shell
parentShell
)
{
super
(
parentShell
,
"Add Dashboard"
,
null
);
}
@Override
protected
Composite
createDialogArea
(
Composite
parent
)
{
Composite
dialogArea
=
super
.
createDialogArea
(
parent
);
AdvancedListViewer
listViewer
=
new
AdvancedListViewer
(
dialogArea
,
SWT
.
NONE
);
listViewer
.
getControl
().
setLayoutData
(
new
GridData
(
GridData
.
FILL_BOTH
));
return
dialogArea
;
}
@Override
protected
void
createButtonsForButtonBar
(
Composite
parent
)
{
((
GridData
)
parent
.
getLayoutData
()).
grabExcessHorizontalSpace
=
true
;
final
Button
createButton
=
createButton
(
parent
,
MANAGER_BUTTON_ID
,
"Manage ..."
,
false
);
((
GridData
)
createButton
.
getLayoutData
()).
horizontalAlignment
=
GridData
.
BEGINNING
;
((
GridData
)
createButton
.
getLayoutData
()).
grabExcessHorizontalSpace
=
true
;
createButton
(
parent
,
IDialogConstants
.
OK_ID
,
"Add"
,
true
);
createButton
(
parent
,
IDialogConstants
.
CANCEL_ID
,
IDialogConstants
.
CANCEL_LABEL
,
false
);
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.ui.dashboard/src/org/jkiss/dbeaver/ui/dashboard/
control
/DashboardChartConfigDialog.java
→
plugins/org.jkiss.dbeaver.ui.dashboard/src/org/jkiss/dbeaver/ui/dashboard/
view
/DashboardChartConfigDialog.java
浏览文件 @
fef862f2
...
...
@@ -14,30 +14,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.ui.dashboard.
control
;
package
org.jkiss.dbeaver.ui.dashboard.
view
;
import
org.eclipse.jface.dialogs.IDialogSettings
;
import
org.eclipse.swt.custom.CTabFolder
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Control
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.dashboard.control.DashboardChartComposite
;
import
org.jkiss.dbeaver.ui.dashboard.model.DashboardContainer
;
import
org.jkiss.dbeaver.ui.dialogs.BaseDialog
;
class
DashboardChartConfigDialog
extends
BaseDialog
{
public
class
DashboardChartConfigDialog
extends
BaseDialog
{
private
static
final
String
DIALOG_ID
=
"DBeaver.DashboardChartConfigDialog"
;
//$NON-NLS-1$
private
DashboardChartComposite
chartComposite
;
private
DashboardContainer
container
;
private
CTabFolder
chartTabFolder
;
DashboardChartConfigDialog
(
DashboardChartComposite
chartComposite
,
DashboardContainer
container
)
public
DashboardChartConfigDialog
(
DashboardChartComposite
chartComposite
,
DashboardContainer
container
)
{
super
(
chartComposite
.
getShell
(),
"Charts for ["
+
container
.
getDataSourceContainer
().
getName
()
+
"]"
,
null
);
this
.
chartComposite
=
chartComposite
;
this
.
container
=
container
;
super
(
chartComposite
.
getShell
(),
"Dashboard ["
+
container
.
getDashboardTitle
()
+
"]"
,
null
);
}
@Override
...
...
plugins/org.jkiss.dbeaver.ui.dashboard/src/org/jkiss/dbeaver/ui/dashboard/view/DashboardViewConfiguration.java
0 → 100644
浏览文件 @
fef862f2
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2019 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.dashboard.view
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.ui.dashboard.internal.UIDashboardActivator
;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
import
org.jkiss.utils.xml.XMLBuilder
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.OutputStream
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* DashboardViewConfiguration
*/
public
class
DashboardViewConfiguration
{
private
static
final
Log
log
=
Log
.
getLog
(
DashboardViewConfiguration
.
class
);
private
String
viewId
;
public
class
DashboardItemViewConfig
{
private
String
dashboardId
;
private
String
description
;
private
float
widthRatio
;
private
long
updatePeriod
;
private
int
maxItems
;
private
long
maxAge
;
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
float
getWidthRatio
()
{
return
widthRatio
;
}
public
void
setWidthRatio
(
float
widthRatio
)
{
this
.
widthRatio
=
widthRatio
;
}
public
long
getUpdatePeriod
()
{
return
updatePeriod
;
}
public
void
setUpdatePeriod
(
long
updatePeriod
)
{
this
.
updatePeriod
=
updatePeriod
;
}
public
int
getMaxItems
()
{
return
maxItems
;
}
public
void
setMaxItems
(
int
maxItems
)
{
this
.
maxItems
=
maxItems
;
}
public
long
getMaxAge
()
{
return
maxAge
;
}
public
void
setMaxAge
(
long
maxAge
)
{
this
.
maxAge
=
maxAge
;
}
}
List
<
DashboardItemViewConfig
>
items
=
new
ArrayList
<>();
public
DashboardViewConfiguration
(
String
viewId
)
{
this
.
viewId
=
viewId
;
loadSettings
();
}
private
void
loadSettings
()
{
File
configFile
=
getConfigFile
();
if
(!
configFile
.
exists
())
{
return
;
}
}
private
void
saveSettings
()
{
File
configFile
=
getConfigFile
();
try
(
OutputStream
out
=
new
FileOutputStream
(
configFile
)){
XMLBuilder
xml
=
new
XMLBuilder
(
out
,
GeneralUtils
.
UTF8_ENCODING
);
xml
.
startElement
(
"dashboards"
);
for
(
DashboardItemViewConfig
itemConfig
:
items
)
{
xml
.
startElement
(
"dashboard"
);
//itemConfig.serialize(xml);
xml
.
endElement
();
}
xml
.
endElement
();
out
.
flush
();
}
catch
(
Exception
e
)
{
log
.
error
(
"Error saving dashboard view configuration"
,
e
);
}
}
private
File
getConfigFile
()
{
File
pluginFolder
=
UIDashboardActivator
.
getDefault
().
getStateLocation
().
toFile
();
return
new
File
(
pluginFolder
,
"view-"
+
viewId
+
".xml"
);
}
}
plugins/org.jkiss.dbeaver.ui.dashboard/src/org/jkiss/dbeaver/ui/dashboard/view/HandlerDashboardAddItem.java
浏览文件 @
fef862f2
...
...
@@ -18,6 +18,8 @@ package org.jkiss.dbeaver.ui.dashboard.view;
import
org.eclipse.core.commands.ExecutionEvent
;
import
org.eclipse.core.commands.ExecutionException
;
import
org.eclipse.jface.dialogs.IDialogConstants
;
import
org.eclipse.ui.handlers.HandlerUtil
;
public
class
HandlerDashboardAddItem
extends
HandlerDashboardAbstract
{
...
...
@@ -25,8 +27,11 @@ public class HandlerDashboardAddItem extends HandlerDashboardAbstract {
public
Object
execute
(
ExecutionEvent
event
)
throws
ExecutionException
{
DashboardView
view
=
getActiveDashboardView
(
event
);
if
(
view
!=
null
)
{
DashboardAddDialog
addDialog
=
new
DashboardAddDialog
(
HandlerUtil
.
getActiveShell
(
event
));
if
(
addDialog
.
open
()
==
IDialogConstants
.
OK_ID
)
{
}
}
return
null
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录