Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
minerva
core
Commits
3be43266
Commit
3be43266
authored
6 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
jsdoc added for GuiUtils
parent
8b0cb5f3
No related branches found
No related tags found
1 merge request
!345
Resolve "Genes annotations don't show"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend-js/src/main/js/gui/leftPanel/GuiUtils.js
+137
-28
137 additions, 28 deletions
frontend-js/src/main/js/gui/leftPanel/GuiUtils.js
with
137 additions
and
28 deletions
frontend-js/src/main/js/gui/leftPanel/GuiUtils.js
+
137
−
28
View file @
3be43266
...
...
@@ -16,6 +16,11 @@ var Promise = require('bluebird');
var
tabIdCounter
=
0
;
/**
*
* @param {Configuration} configuration
* @constructor
*/
function
GuiUtils
(
configuration
)
{
var
self
=
this
;
self
.
setConfiguration
(
configuration
);
...
...
@@ -24,14 +29,27 @@ function GuiUtils(configuration) {
GuiUtils
.
prototype
=
Object
.
create
(
AbstractGuiElement
.
prototype
);
GuiUtils
.
prototype
.
constructor
=
GuiUtils
;
/**
*
* @param {Configuration} configuration
*/
GuiUtils
.
prototype
.
setConfiguration
=
function
(
configuration
)
{
this
.
_configuration
=
configuration
;
};
/**
*
* @returns {Configuration}
*/
GuiUtils
.
prototype
.
getConfiguration
=
function
()
{
return
this
.
_configuration
;
};
/**
*
* @param {string} value
* @returns {HTMLSpanElement}
*/
GuiUtils
.
prototype
.
createLabel
=
function
(
value
)
{
var
result
=
document
.
createElement
(
"
span
"
);
result
.
innerHTML
=
value
;
...
...
@@ -69,26 +87,23 @@ GuiUtils.prototype.createPostTranslationalModifications = function (label, value
return
result
;
};
GuiUtils
.
prototype
.
createCandidates
=
function
(
label
,
value
)
{
var
result
=
document
.
createElement
(
"
div
"
);
if
(
value
!==
undefined
)
{
throw
new
Error
(
"
Not implemented
"
);
}
return
result
;
};
GuiUtils
.
prototype
.
createChebiTree
=
function
(
label
,
value
)
{
var
result
=
document
.
createElement
(
"
div
"
);
if
(
value
!==
undefined
)
{
throw
new
Error
(
"
Not implemented
"
);
}
return
result
;
};
/**
*
* @returns {HTMLHRElement}
*/
GuiUtils
.
prototype
.
createSeparator
=
function
()
{
return
document
.
createElement
(
"
hr
"
);
};
/**
*
* @param {number} [count]
* @returns {HTMLParagraphElement}
*/
GuiUtils
.
prototype
.
createNewLine
=
function
(
count
)
{
if
(
count
===
undefined
)
{
count
=
0
;
}
var
result
=
document
.
createElement
(
"
p
"
);
if
(
count
>
0
)
{
result
.
style
.
height
=
((
count
-
1
)
*
10
)
+
"
px
"
;
...
...
@@ -96,6 +111,12 @@ GuiUtils.prototype.createNewLine = function (count) {
return
result
;
};
/**
*
* @param {string} [url]
* @param {string} name
* @returns {HTMLElement}
*/
GuiUtils
.
prototype
.
createLink
=
function
(
url
,
name
)
{
if
(
url
===
null
||
url
===
undefined
)
{
logger
.
warn
(
"
URL not defined for:
\"
"
+
name
+
"
\"
link
"
);
...
...
@@ -113,6 +134,12 @@ GuiUtils.prototype.createLink = function (url, name) {
return
link
;
};
/**
*
* @param {Annotation} annotation
* @param {boolean} [showType=false]
* @returns {HTMLElement}
*/
GuiUtils
.
prototype
.
createAnnotationLink
=
function
(
annotation
,
showType
)
{
var
self
=
this
;
var
name
,
type
,
hint
;
...
...
@@ -150,6 +177,15 @@ GuiUtils.prototype.createAnnotationLink = function (annotation, showType) {
}
};
/**
*
* @param {string} label
* @param {Annotation[]} [value]
* @param {Object} [options]
* @param {boolean} [options.inline]
*
* @returns {HTMLDivElement}
*/
GuiUtils
.
prototype
.
createAnnotations
=
function
(
label
,
value
,
options
)
{
var
self
=
this
;
...
...
@@ -172,9 +208,16 @@ GuiUtils.prototype.createAnnotations = function (label, value, options) {
return
result
;
};
/**
*
* @param {boolean} inline
* @param {string} annotatorClass
* @param {Object.<string, Annotator>} annotatorsClassMapping
* @param {boolean} groupAnnotations
* @returns {HTMLElement}
*/
function
createGroupContainer
(
inline
,
annotatorClass
,
annotatorsClassMapping
,
groupAnnotations
)
{
var
automaticallyAnnotated
=
!
(
annotatorClass
===
undefined
||
annotatorClass
===
"
undefined
"
||
annotatorClass
===
null
||
annotatorClass
===
""
);
// var desc = grouppedAnnotations.keys()[i];
var
groupContainer
=
(
inline
?
document
.
createElement
(
"
span
"
)
:
document
.
createElement
(
"
div
"
));
var
descContainer
=
(
inline
?
document
.
createElement
(
"
span
"
)
:
document
.
createElement
(
"
div
"
));
...
...
@@ -334,6 +377,11 @@ GuiUtils.prototype.createAnnotationList = function (annotations, options) {
return
result
;
};
/**
*
* @param {string} [value]
* @returns {HTMLSpanElement}
*/
GuiUtils
.
prototype
.
createLabelText
=
function
(
value
)
{
var
result
=
document
.
createElement
(
"
span
"
);
if
(
value
!==
undefined
)
{
...
...
@@ -342,6 +390,11 @@ GuiUtils.prototype.createLabelText = function (value) {
return
result
;
};
/**
*
* @param {string} [value]
* @returns {HTMLInputElement}
*/
GuiUtils
.
prototype
.
createInputText
=
function
(
value
)
{
var
result
=
document
.
createElement
(
"
input
"
);
result
.
setAttribute
(
'
type
'
,
'
text
'
);
...
...
@@ -352,6 +405,11 @@ GuiUtils.prototype.createInputText = function (value) {
return
result
;
};
/**
*
* @param {string} [value]
* @returns {HTMLTextAreaElement}
*/
GuiUtils
.
prototype
.
createTextArea
=
function
(
value
)
{
var
result
=
document
.
createElement
(
"
textarea
"
);
...
...
@@ -362,16 +420,12 @@ GuiUtils.prototype.createTextArea = function (value) {
return
result
;
};
GuiUtils
.
prototype
.
createCheckbox
=
function
(
value
)
{
var
result
=
document
.
createElement
(
"
input
"
);
result
.
type
=
"
checkbox
"
;
if
(
value
)
{
result
.
checked
=
true
;
}
return
result
;
};
/**
*
* @param {string} label
* @param {string|number} [value]
* @returns {HTMLDivElement}
*/
GuiUtils
.
prototype
.
createParamLine
=
function
(
label
,
value
)
{
var
result
=
document
.
createElement
(
"
div
"
);
if
(
value
!==
undefined
&&
value
!==
null
&&
value
!==
""
)
{
...
...
@@ -382,6 +436,12 @@ GuiUtils.prototype.createParamLine = function (label, value) {
return
result
;
};
/**
*
* @param {string} [icon]
* @param {function} [onclickFunction]
* @returns {HTMLDivElement}
*/
GuiUtils
.
prototype
.
createIcon
=
function
(
icon
,
onclickFunction
)
{
var
result
=
document
.
createElement
(
"
div
"
);
if
(
icon
!==
undefined
&&
icon
!==
null
)
{
...
...
@@ -397,6 +457,13 @@ GuiUtils.prototype.createIcon = function (icon, onclickFunction) {
return
result
;
};
/**
*
* @param {string} label
* @param {string[]} [value]
*
* @returns {HTMLDivElement}
*/
GuiUtils
.
prototype
.
createArrayParamLine
=
function
(
label
,
value
)
{
var
result
=
document
.
createElement
(
"
div
"
);
if
(
value
!==
undefined
&&
value
.
length
>
0
)
{
...
...
@@ -407,6 +474,12 @@ GuiUtils.prototype.createArrayParamLine = function (label, value) {
return
result
;
};
/**
*
* @param {string} label
* @param {number} [modelId]
* @returns {HTMLDivElement}
*/
GuiUtils
.
prototype
.
createSubMapLink
=
function
(
label
,
modelId
)
{
var
self
=
this
;
var
result
=
document
.
createElement
(
"
div
"
);
...
...
@@ -424,6 +497,11 @@ GuiUtils.prototype.createSubMapLink = function (label, modelId) {
return
result
;
};
/**
*
* @param {Array<string|HTMLElement>} elements
* @returns {HTMLElement}
*/
GuiUtils
.
prototype
.
createTableRow
=
function
(
elements
)
{
var
row
=
Functions
.
createElement
({
type
:
"
div
"
,
...
...
@@ -558,6 +636,10 @@ GuiUtils.prototype.createSearchBioEntityGroupElement = function (group) {
}
};
/**
*
* @returns {HTMLAnchorElement}
*/
GuiUtils
.
prototype
.
createLogoutLink
=
function
()
{
var
logoutLink
=
document
.
createElement
(
"
a
"
);
logoutLink
.
href
=
"
#
"
;
...
...
@@ -569,6 +651,14 @@ GuiUtils.prototype.createLogoutLink = function () {
return
logoutLink
;
};
/**
*
* @param {string} params.name
* @param {string} params.id
* @param {HTMLElement} params.navigationBar
*
* @returns {HTMLLIElement}
*/
GuiUtils
.
prototype
.
createTabMenuObject
=
function
(
params
)
{
var
name
=
params
.
name
;
var
id
=
params
.
id
;
...
...
@@ -597,6 +687,13 @@ GuiUtils.prototype.createTabMenuObject = function (params) {
return
navLi
;
};
/**
*
* @param {string} params.id
* @param {HTMLElement} params.navigationObject
*
* @returns {HTMLDivElement}
*/
GuiUtils
.
prototype
.
createTabContentObject
=
function
(
params
)
{
var
navigationObject
=
params
.
navigationObject
;
var
tabId
=
params
.
id
;
...
...
@@ -613,6 +710,13 @@ GuiUtils.prototype.createTabContentObject = function (params) {
return
result
;
};
/**
*
* @param {HTMLElement} [params.element]
* @param {string} params.id
*
* @returns {{element: HTMLElement, menu: HTMLElement, content: HTMLElement, tabId: *}}
*/
GuiUtils
.
prototype
.
createTabDiv
=
function
(
params
)
{
var
tabDiv
=
Functions
.
createElement
({
type
:
"
div
"
,
...
...
@@ -632,7 +736,7 @@ GuiUtils.prototype.createTabDiv = function (params) {
});
tabDiv
.
appendChild
(
tabContentDiv
);
if
(
params
!==
undefined
&&
params
.
element
!==
undefined
)
{
if
(
params
.
element
!==
undefined
)
{
params
.
element
.
appendChild
(
tabDiv
);
}
...
...
@@ -645,7 +749,6 @@ GuiUtils.prototype.createTabDiv = function (params) {
};
GuiUtils
.
prototype
.
createTab
=
function
(
params
)
{
var
self
=
this
;
var
tabData
=
params
.
tabData
;
var
tabId
=
tabData
.
tabId
+
"
_tab_
"
+
tabIdCounter
;
...
...
@@ -693,6 +796,12 @@ GuiUtils.prototype.createTab = function (params) {
}
};
/**
*
* @param {string} toolTip
* @param {boolean} [useXss=false]
* @returns {HTMLElement}
*/
GuiUtils
.
prototype
.
createHelpButton
=
function
(
toolTip
,
useXss
)
{
var
helpContent
;
if
(
useXss
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment