Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
c8cab5c8
Commit
c8cab5c8
authored
15 years ago
by
izabel
Browse files
Options
Downloads
Patches
Plain Diff
[LMS-1400] column auto width update
SVN: 15100
parent
9ff03b0f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/ExtendedGridView.java
+22
-12
22 additions, 12 deletions
...ient/web/client/application/ui/grid/ExtendedGridView.java
with
22 additions
and
12 deletions
openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/ExtendedGridView.java
+
22
−
12
View file @
c8cab5c8
...
...
@@ -69,17 +69,14 @@ class ExtendedGridView extends GridView
protected
void
onHeaderClickWithShift
(
Grid
<
ModelData
>
pGrid
,
int
column
)
{
// WORKAROUND: getHeaderCell takes into account only visible columns
int
headerCellIndex
=
column
;
for
(
int
i
=
0
;
i
<
column
;
i
++)
{
if
(
pGrid
.
getColumnModel
().
getColumn
(
i
).
isHidden
())
{
headerCellIndex
--;
}
}
int
margin
=
50
;
pGrid
.
getColumnModel
().
setColumnWidth
(
column
,
calculateWidth
(
pGrid
,
column
)
+
margin
);
}
private
int
calculateWidth
(
Grid
<
ModelData
>
pGrid
,
int
column
)
{
GridView
view
=
pGrid
.
getView
();
Element
headerCell
=
(
Element
)
view
.
getHeaderCell
(
h
eaderCellIndex
);
Element
headerCell
=
(
Element
)
view
.
getHeaderCell
(
calculateH
eaderCellIndex
(
pGrid
,
column
)
);
TextMetrics
tm
=
TextMetrics
.
get
();
tm
.
bind
(
headerCell
);
// TODO 2010-03-09, IA: line breaks are ignored
...
...
@@ -95,8 +92,21 @@ class ExtendedGridView extends GridView
max
=
width
;
}
}
int
margin
=
50
;
pGrid
.
getColumnModel
().
setColumnWidth
(
column
,
max
+
margin
);
return
max
;
}
private
int
calculateHeaderCellIndex
(
Grid
<
ModelData
>
pGrid
,
int
column
)
{
// WORKAROUND: getHeaderCell takes into account only visible columns
int
headerCellIndex
=
column
;
for
(
int
i
=
0
;
i
<
column
;
i
++)
{
if
(
pGrid
.
getColumnModel
().
getColumn
(
i
).
isHidden
())
{
headerCellIndex
--;
}
}
return
headerCellIndex
;
}
}
\ No newline at end of file
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