• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

link-intersystems / lis-commons / #264

05 Nov 2023 11:38AM UTC coverage: 88.527% (-1.3%) from 89.804%
#264

Pull #7

renelink
Added tests.
Pull Request #7: Migrated swing-view stuff from java-swing-mvc-plugin-architecture.

249 of 400 new or added lines in 23 files covered. (62.25%)

7639 of 8629 relevant lines covered (88.53%)

0.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/lis-commons-swing-view/src/main/java/com/link_intersystems/swing/view/layout/DefaultViewLayout.java
1
package com.link_intersystems.swing.view.layout;
2

3
import com.link_intersystems.swing.view.ContainerViewContent;
4
import com.link_intersystems.swing.view.DefaultViewSite;
5
import com.link_intersystems.swing.view.View;
6
import com.link_intersystems.swing.view.ViewSite;
7
import com.link_intersystems.util.context.Context;
8

9
import java.awt.*;
10
import java.util.HashMap;
11
import java.util.Map;
12

13
import static java.util.Objects.requireNonNull;
14

15
public class DefaultViewLayout implements ViewLayout {
16

NEW
17
    private Map<String, ViewSite> layout = new HashMap<>();
×
NEW
18
    private Map<String, View> installedViews = new HashMap<>();
×
19
    private Context viewContext;
20
    private Container viewContainer;
21

NEW
22
    public DefaultViewLayout(Context viewContext, Container viewContainer) {
×
NEW
23
        this.viewContext = requireNonNull(viewContext);
×
NEW
24
        this.viewContainer = requireNonNull(viewContainer);
×
NEW
25
    }
×
26

27
    public void addViewSite(String name, Object layoutConstraints) {
NEW
28
        ViewSite layoutViewSite = new DefaultViewSite(new ContainerViewContent(viewContainer, layoutConstraints), viewContext);
×
NEW
29
        layout.put(requireNonNull(name), layoutViewSite);
×
30

NEW
31
    }
×
32

33
    @Override
34
    public void install(String viewSiteName, View view) {
NEW
35
        ViewSite viewSite = layout.get(viewSiteName);
×
NEW
36
        if (viewSite == null) {
×
NEW
37
            throw new IllegalArgumentException("No viewSite named " + viewSiteName + " existent in " + this);
×
38
        }
NEW
39
        view.install(viewSite);
×
NEW
40
        installedViews.put(viewSiteName, view);
×
NEW
41
        viewContainer.revalidate();
×
NEW
42
    }
×
43

44
    @Override
45
    public void remove(String viewSiteName) {
NEW
46
        View view = installedViews.get(viewSiteName);
×
NEW
47
        if (view != null) {
×
NEW
48
            view.uninstall();
×
NEW
49
            viewContainer.revalidate();
×
50
        }
NEW
51
    }
×
52

53
    public void dispose() {
NEW
54
        installedViews.keySet().forEach(this::remove);
×
NEW
55
    }
×
56
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc