You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2014/07/03 17:01:48 UTC
[42/63] [abbrv] [partial] ISIS-832: mothballing components
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/security/file/src/main/java/org/apache/isis/security/file/authorization/FileAuthorizor.java
----------------------------------------------------------------------
diff --git a/component/security/file/src/main/java/org/apache/isis/security/file/authorization/FileAuthorizor.java b/component/security/file/src/main/java/org/apache/isis/security/file/authorization/FileAuthorizor.java
deleted file mode 100644
index 3bb1e57..0000000
--- a/component/security/file/src/main/java/org/apache/isis/security/file/authorization/FileAuthorizor.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.isis.security.file.authorization;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.applib.Identifier;
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.commons.config.IsisConfigurationException;
-import org.apache.isis.core.commons.config.JmxBeanServer;
-import org.apache.isis.core.commons.ensure.Assert;
-import org.apache.isis.core.commons.exceptions.IsisException;
-import org.apache.isis.core.commons.resource.ResourceStreamSource;
-import org.apache.isis.core.runtime.authorization.standard.AuthorizorAbstract;
-
-public class FileAuthorizor extends AuthorizorAbstract implements FileAuthorizorMBean {
-
- private static final Logger LOG = LoggerFactory.getLogger(FileAuthorizor.class);
-
- private static final String NONE = "";
- private static final String ACCESS_QUALIFIER_RO = "-ro";
- private static final String ACCESS_QUALIFIER_RW = "-rw";
-
- private Map<String, List<String>> whiteListMap;
- private Map<String, List<String>> blackListMap;
-
- private final ResourceStreamSource resourceStreamSource;
- private final boolean learn;
-
- private final String whiteListResourceName;
- private InputStream whiteListInputResource;
- private final boolean whiteListEmptyAllowed;
-
- private final String blackListResourceName;
- private InputStream blackListInputResource;
-
- private boolean printedWarning;
- private boolean printedDebug;
-
- public FileAuthorizor(final IsisConfiguration configuration) {
- super(configuration);
-
- // read from config
- this.resourceStreamSource = getConfiguration().getResourceStreamSource();
-
- this.learn =
- getConfiguration().getBoolean(FileAuthorizationConstants.LEARN, FileAuthorizationConstants.LEARN_DEFAULT);
- whiteListResourceName =
- getConfiguration().getString(FileAuthorizationConstants.WHITELIST_RESOURCE_KEY,
- FileAuthorizationConstants.WHITELIST_RESOURCE_DEFAULT);
- Assert.assertTrue(whiteListResourceName.length() > 0);
-
- whiteListEmptyAllowed =
- getConfiguration().getBoolean(FileAuthorizationConstants.WHITELIST_EMPTY,
- FileAuthorizationConstants.WHITELIST_EMPTY_DEFAULT);
-
- blackListResourceName =
- getConfiguration().getString(FileAuthorizationConstants.BLACKLIST_RESOURCE_KEY,
- FileAuthorizationConstants.BLACKLIST_RESOURCE_DEFAULT);
-
- findResources();
- }
-
- private void findResources() {
- whiteListInputResource = resourceStreamSource.readResource(whiteListResourceName);
- if (whiteListInputResource == null) {
- throw new IsisException("Cannot read whitelist authorization file: " + whiteListResourceName);
- }
-
- if (blackListResourceName.length() > 0) {
- this.blackListInputResource = resourceStreamSource.readResource(blackListResourceName);
- if (blackListInputResource == null) {
- throw new IsisException("Blacklist authorization file exists, but it cannot be read: "
- + blackListResourceName);
- }
- } else {
- blackListInputResource = null;
- }
- }
-
- // //////////////////////////////////////////////////////////////
- // init, shutdown
- // //////////////////////////////////////////////////////////////
-
- @Override
- public void init() {
- whiteListMap = Maps.newHashMap();
- blackListMap = Maps.newHashMap();
-
- // initialize
- if (learn) {
- return;
- }
- cacheAuthorizationDetails(whiteListMap, whiteListInputResource, whiteListResourceName);
- if (blackListInputResource != null) {
- cacheAuthorizationDetails(blackListMap, blackListInputResource, blackListResourceName);
- }
-
- JmxBeanServer.getInstance().register("file-authorizer", this);
- }
-
- @Override
- public void reload() {
- final Map<String, List<String>> whiteListMap = Maps.newHashMap();
- final Map<String, List<String>> blackListMap = Maps.newHashMap();
-
- findResources();
- cacheAuthorizationDetails(whiteListMap, whiteListInputResource, null);
- if (blackListInputResource != null) {
- cacheAuthorizationDetails(blackListMap, blackListInputResource, null);
- this.blackListMap = blackListMap;
- }
- this.whiteListMap = whiteListMap;
- }
-
- private void cacheAuthorizationDetails(final Map<String, List<String>> map, final InputStream inputStream,
- String resourceName) {
- try {
- if (LOG.isInfoEnabled()) {
- LOG.info("loading authorization details from " + resourceName);
- }
- final BufferedReader buffReader = new BufferedReader(new InputStreamReader(inputStream));
- for (String line; (line = buffReader.readLine()) != null;) {
- tokenizeLine(map, line);
- }
- buffReader.close();
- } catch (final Exception e) {
- throw new IsisException(e);
- }
- }
-
- private void tokenizeLine(final Map<String, List<String>> map, final String line) {
- if (line.trim().startsWith("#") || line.trim().length() == 0) {
- return;
- }
- final int pos = line.trim().indexOf(">");
- if (pos == -1) {
- final StringTokenizer tokens = new StringTokenizer(line.trim(), ":", false);
- if (tokens.countTokens() != 2) {
- throw new IsisConfigurationException("Invalid line: " + line);
- }
- final String token1 = tokens.nextToken();
- final String token2 = tokens.nextToken();
- final Identifier identifier = memberFromString(token1.trim());
- final List<String> roles = tokenizeRoles(token2);
- final String identityString = identifier.toIdentityString(Identifier.CLASS_MEMBERNAME_PARAMETERS);
- map.put(identityString, roles);
- } else {
- final Map<String, List<String>> newRules = new HashMap<String, List<String>>();
- for (final String name : map.keySet()) {
- final String originalName = line.trim().substring(0, pos);
- final String redirectedName = line.trim().substring(pos + 1);
- if (name.startsWith(redirectedName)) {
- final String id = originalName + name.substring(redirectedName.length());
- final List<String> roles = map.get(name);
- newRules.put(id, roles);
- }
- }
- map.putAll(newRules);
- }
- }
-
- private Identifier memberFromString(final String identifier) {
- return Identifier.fromIdentityString(identifier);
- }
-
- private List<String> tokenizeRoles(final String allRoles) {
- final List<String> roles = new ArrayList<String>();
- final StringTokenizer tokens = new StringTokenizer(allRoles, "|", false);
- while (tokens.hasMoreTokens()) {
- final String nextToken = tokens.nextToken();
- final String trimmedNextToken = nextToken.trim();
- roles.add(trimmedNextToken);
- }
- return roles;
- }
-
- @Override
- public void shutdown() {
- if (learn) {
- writeMap();
- }
- }
-
- // //////////////////////////////////////////////////////////////
- // API
- // //////////////////////////////////////////////////////////////
-
- @Override
- public boolean isUsableInRole(final String role, final Identifier member) {
- if(role == null) {
- return false;
- }
- return isAuthorized(role, member, Arrays.asList(NONE, ACCESS_QUALIFIER_RW));
- }
-
- @Override
- public boolean isVisibleInRole(final String role, final Identifier member) {
- if(role == null) {
- return false;
- }
- return isAuthorized(role, member, Arrays.asList(NONE, ACCESS_QUALIFIER_RO, ACCESS_QUALIFIER_RW));
- }
-
- private boolean isAuthorized(final String role, final Identifier member, final List<String> qualifiers) {
- if (learn) {
- return learn(role, member);
- }
- return isWhiteListed(role, member, qualifiers, whiteListEmptyAllowed)
- && !isBlackListed(role, member, qualifiers);
- }
-
- private boolean isWhiteListed(final String role, final Identifier member, final List<String> qualifiers,
- boolean defaultIfEmpty) {
- return isListed(whiteListMap, role, member, qualifiers, defaultIfEmpty);
- }
-
- private boolean isBlackListed(final String role, final Identifier member, final List<String> qualifiers) {
- return isListed(blackListMap, role, member, qualifiers, false);
- }
-
- /*
- * Work through the available entries from most specific to least. When one exists then determine the result of this
- * method by looking for a compatible role between the entry and required role.
- */
- private boolean isListed(final Map<String, List<String>> map, final String role, final Identifier identifier,
- final List<String> qualifiers, boolean defaultIfEmpty) {
- if (map.isEmpty()) {// quick fail
- return defaultIfEmpty;
- }
- List<String> roles;
- roles = rolesFor(map, identifier.toIdentityString(Identifier.CLASS_MEMBERNAME_PARAMETERS));
- if (roles == null) {
- roles = rolesFor(map, identifier.toIdentityString(Identifier.CLASS_MEMBERNAME));
- }
- if (roles == null) {
- roles = rolesFor(map, identifier.toIdentityString(Identifier.CLASS));
- }
- if (roles == null) {
- roles = rolesFor(map, "*#" + identifier.toIdentityString(Identifier.MEMBERNAME_ONLY));
- }
- if (roles != null) {
- for (final String qualifier : qualifiers) {
- final String qualifiedRole = role + qualifier;
- if (roles.contains(qualifiedRole)) {
- return true;
- }
- }
- }
- return false;
- }
-
- private List<String> rolesFor(final Map<String, List<String>> map, final String key) {
- if (map.containsKey(key)) {
- return map.get(key);
- } else {
- return null;
- }
- }
-
- private boolean learn(final String role, final Identifier member) {
- final String identityString = member.toIdentityString(Identifier.CLASS_MEMBERNAME_PARAMETERS);
- if (whiteListMap.containsKey(identityString)) {
- final List<String> roles = whiteListMap.get(identityString);
- if (!roles.contains(role)) {
- roles.add(role);
- }
- } else {
- whiteListMap.put(identityString, Arrays.asList(new String[] { role }));
- }
-
- // REVIEW: might be too labour intensive
- writeMap();
- return true;
- }
-
- private void writeMap() {
- try {
- final OutputStream whiteListOutputResource = resourceStreamSource.writeResource(whiteListResourceName);
- if (whiteListOutputResource == null) {
- if (!printedWarning) {
- LOG.warn("unable to write out authorisation details");
- printedWarning = true; // just to stop flooding log
- }
- return;
- }
- if (LOG.isDebugEnabled() && !printedDebug) {
- LOG.debug("writing authorisation details to " + whiteListResourceName);
- printedDebug = true; // just to stop flooding log
- }
-
- final Set<Entry<String, List<String>>> entrySet = whiteListMap.entrySet();
- final List<Entry<String, List<String>>> entryList = Lists.newArrayList(entrySet);
-
- final OutputStreamWriter fileWriter = new OutputStreamWriter(whiteListOutputResource);
- final BufferedWriter buffWriter = new BufferedWriter(fileWriter);
- for (final Map.Entry<String, List<String>> entry : entryList) {
- writeTo(entry, buffWriter);
- }
- buffWriter.flush();
- buffWriter.close();
-
- } catch (final IOException e) {
- throw new IsisException(e);
- }
- }
-
- public void writeTo(final Map.Entry<String, List<String>> entry, final BufferedWriter buffWriter)
- throws IOException {
- final StringBuffer buff = new StringBuffer();
- buff.append(entry.getKey()).append(":");
- final List<String> roles = entry.getValue();
- for (int j = 0; j < roles.size(); j++) {
- buff.append(roles.get(j));
- if (j < roles.size() - 1) {
- buff.append("|");
- }
- }
- buffWriter.write(buff.toString());
- buffWriter.newLine();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/security/file/src/main/java/org/apache/isis/security/file/authorization/FileAuthorizorMBean.java
----------------------------------------------------------------------
diff --git a/component/security/file/src/main/java/org/apache/isis/security/file/authorization/FileAuthorizorMBean.java b/component/security/file/src/main/java/org/apache/isis/security/file/authorization/FileAuthorizorMBean.java
deleted file mode 100644
index 611673e..0000000
--- a/component/security/file/src/main/java/org/apache/isis/security/file/authorization/FileAuthorizorMBean.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.isis.security.file.authorization;
-
-public interface FileAuthorizorMBean {
-
- void reload();
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/security/file/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/component/security/file/src/site/apt/index.apt b/component/security/file/src/site/apt/index.apt
deleted file mode 100644
index ff097f5..0000000
--- a/component/security/file/src/site/apt/index.apt
+++ /dev/null
@@ -1,46 +0,0 @@
-~~ Licensed to the Apache Software Foundation (ASF) under one
-~~ or more contributor license agreements. See the NOTICE file
-~~ distributed with this work for additional information
-~~ regarding copyright ownership. The ASF licenses this file
-~~ to you 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.
-
-
-
-Security File Implementation
-
- The <file security> module is a simple implementation of Isis' authentication and
- authorization APIs, that uses flat files store user/passwords/roles (for authentication)
- and role-based permissions (for authorization).
-
- Because of critical information stored in flat files, this implementation is unlikely to
- be suitable for deployment, but it is valuable both for prototyping and building
- up roles/permission sets (eg to be imported into some other implementation). It is
- also useful as a example implementation that can be enhanced as required.
-
- See the security
- {{{../docbkx/html/guide/isis-security.html}HTML}} or
- {{{../docbkx/pdf/isis-security.pdf}PDF}} documentation for more detail.
-
-Alternatives
-
- Alternatives include:
-
- * the {{{../dflt/index.html}default}} (no-op) security implementation, for prototyping use only
-
- * the {{{../ldap/index.html}LDAP}} security
-
- * the {{{../sql/index.html}SQL}} security (reading from simple SQL tables)
-
- []
-
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/security/file/src/site/apt/jottings.apt
----------------------------------------------------------------------
diff --git a/component/security/file/src/site/apt/jottings.apt b/component/security/file/src/site/apt/jottings.apt
deleted file mode 100644
index c5d1200..0000000
--- a/component/security/file/src/site/apt/jottings.apt
+++ /dev/null
@@ -1,24 +0,0 @@
-~~ Licensed to the Apache Software Foundation (ASF) under one
-~~ or more contributor license agreements. See the NOTICE file
-~~ distributed with this work for additional information
-~~ regarding copyright ownership. The ASF licenses this file
-~~ to you 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.
-
-
-
-Jottings
-
- This page is to capture any random jottings relating to this module prior
- to being moved into formal documentation.
-
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/security/file/src/site/site.xml
----------------------------------------------------------------------
diff --git a/component/security/file/src/site/site.xml b/component/security/file/src/site/site.xml
deleted file mode 100644
index 2a8b1c1..0000000
--- a/component/security/file/src/site/site.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
--->
-<project>
-
- <body>
- <breadcrumbs>
- <item name="File" href="index.html"/>
- </breadcrumbs>
-
- <menu name="File Security">
- <item name="About" href="index.html" />
- <item name="Jottings" href="jottings.html" />
- </menu>
-
- <menu name="Security Modules">
- <item name="Default (No-op)" href="../dflt/index.html" />
- <item name="File" href="../file/index.html" />
- <item name="LDAP" href="../ldap/index.html" />
- <item name="SQL" href="../sql/index.html" />
- </menu>
-
- <menu name="Maven Reports" ref="reports" />
- </body>
-</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/security/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/component/security/src/site/apt/index.apt b/component/security/src/site/apt/index.apt
deleted file mode 100644
index 0aba0d6..0000000
--- a/component/security/src/site/apt/index.apt
+++ /dev/null
@@ -1,47 +0,0 @@
-~~ Licensed to the Apache Software Foundation (ASF) under one
-~~ or more contributor license agreements. See the NOTICE file
-~~ distributed with this work for additional information
-~~ regarding copyright ownership. The ASF licenses this file
-~~ to you 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.
-
-
-
-Security
-
- The <security> module is the parent for various implementations of the
- security APIs defined in the {{{../core/index.html}core}} framework.
-
- Security implementations provide authentication and
- authorization services. They do not providing services
- such as auditing, encryption, non-repudiation or confidentiality.
-
- * {{{./dflt/index.html}dflt}}
-
- The <dflt> (default) implementation is a no-op service that always
- authenticates and authorizes. It is designed for testing and prototyping.
-
- * {{{./file/index.html}file}}
-
- The <file> implementation uses simple flat files to store
- user account/password (authentication) and permissions (authorization) data.
-
- * {{{./ldap/index.html}ldap}}
-
- The <ldap> implementation provides integration with an LDAP provider.
-
- * {{{./sql/index.html}sql}}
-
- The <sql> implementation provides basic integration with a SQL database.
-
- []
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/security/src/site/apt/jottings.apt
----------------------------------------------------------------------
diff --git a/component/security/src/site/apt/jottings.apt b/component/security/src/site/apt/jottings.apt
deleted file mode 100644
index c5d1200..0000000
--- a/component/security/src/site/apt/jottings.apt
+++ /dev/null
@@ -1,24 +0,0 @@
-~~ Licensed to the Apache Software Foundation (ASF) under one
-~~ or more contributor license agreements. See the NOTICE file
-~~ distributed with this work for additional information
-~~ regarding copyright ownership. The ASF licenses this file
-~~ to you 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.
-
-
-
-Jottings
-
- This page is to capture any random jottings relating to this module prior
- to being moved into formal documentation.
-
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/security/src/site/site.xml
----------------------------------------------------------------------
diff --git a/component/security/src/site/site.xml b/component/security/src/site/site.xml
deleted file mode 100644
index 2d9af1c..0000000
--- a/component/security/src/site/site.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
--->
-<project>
-
- <body>
- <breadcrumbs>
- <item name="Security" href="index.html"/>
- </breadcrumbs>
-
- <menu name="Security">
- <item name="About" href="index.html" />
- <item name="Jottings" href="jottings.html" />
- </menu>
-
- <menu name="Security Modules">
- <item name="Default (No-op)" href="./dflt/index.html" />
- <item name="File" href="./file/index.html" />
- <item name="LDAP" href="./ldap/index.html" />
- <item name="SQL" href="./sql/index.html" />
- </menu>
-
- <menu name="Documentation">
- <item name="${docbkxGuideTitle} (PDF)" href="docbkx/pdf/${docbkxGuideName}.pdf" />
- <item name="${docbkxGuideTitle} (HTML)" href="docbkx/html/guide/${docbkxGuideName}.html" />
- </menu>
-
- <menu name="Maven Reports" ref="reports" />
- </body>
-</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/NOTICE
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/NOTICE b/component/viewer/dnd/NOTICE
deleted file mode 100644
index ba21d0c..0000000
--- a/component/viewer/dnd/NOTICE
+++ /dev/null
@@ -1,7 +0,0 @@
-Apache Isis
-Copyright 2010-2013 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/pom.xml
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/pom.xml b/component/viewer/dnd/impl/pom.xml
deleted file mode 100644
index f691a5c..0000000
--- a/component/viewer/dnd/impl/pom.xml
+++ /dev/null
@@ -1,115 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.isis.viewer</groupId>
- <artifactId>isis-viewer-dnd</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>isis-viewer-dnd-impl</artifactId>
-
- <name>Isis Drag-n-Drop Viewer Implementation</name>
-
- <properties>
- <siteBaseDir>..</siteBaseDir>
- <relativeUrl>dnd</relativeUrl>
-
- </properties>
-
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-project-info-reports-plugin</artifactId>
- <inherited>false</inherited>
- <configuration>
- <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
- </configuration>
- <reportSets>
- <reportSet>
- <inherited>false</inherited>
- <reports>
- <report>dependencies</report>
- <report>dependency-convergence</report>
- <report>plugins</report>
- <report>summary</report>
- </reports>
- </reportSet>
- </reportSets>
- </plugin>
- </plugins>
- </reporting>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-unittestsupport</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-runtime</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-integtestsupport</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-runtime</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-objectstore</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-bytecode-cglib</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jmock</groupId>
- <artifactId>jmock-junit4</artifactId>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/DndViewer.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/DndViewer.java b/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/DndViewer.java
deleted file mode 100644
index 8c1f315..0000000
--- a/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/DndViewer.java
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.isis.viewer.dnd;
-
-import java.awt.Dimension;
-import java.util.StringTokenizer;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.commons.config.IsisConfigurationException;
-import org.apache.isis.core.commons.exceptions.IsisException;
-import org.apache.isis.core.commons.factory.InstanceCreationException;
-import org.apache.isis.core.commons.factory.InstanceUtil;
-import org.apache.isis.core.runtime.authentication.AuthenticationRequest;
-import org.apache.isis.core.runtime.authentication.exploration.AuthenticationRequestExploration;
-import org.apache.isis.core.runtime.fixtures.authentication.AuthenticationRequestLogonFixture;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.userprofile.UserProfile;
-import org.apache.isis.core.runtime.viewer.IsisViewerAbstract;
-import org.apache.isis.viewer.dnd.awt.AwtImageFactory;
-import org.apache.isis.viewer.dnd.awt.AwtToolkit;
-import org.apache.isis.viewer.dnd.awt.LoginDialog;
-import org.apache.isis.viewer.dnd.awt.ViewerFrame;
-import org.apache.isis.viewer.dnd.awt.XViewer;
-import org.apache.isis.viewer.dnd.calendar.CalendarSpecification;
-import org.apache.isis.viewer.dnd.combined.ExpandableListSpecification;
-import org.apache.isis.viewer.dnd.combined.FormWithTableSpecification;
-import org.apache.isis.viewer.dnd.combined.TwoPartViewSpecification;
-import org.apache.isis.viewer.dnd.configurable.ConfigurableObjectViewSpecification;
-import org.apache.isis.viewer.dnd.configurable.GridListSpecification;
-import org.apache.isis.viewer.dnd.configurable.NewViewSpecification;
-import org.apache.isis.viewer.dnd.configurable.PanelViewSpecification;
-import org.apache.isis.viewer.dnd.drawing.Bounds;
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.drawing.Size;
-import org.apache.isis.viewer.dnd.field.CheckboxField;
-import org.apache.isis.viewer.dnd.field.ColorField;
-import org.apache.isis.viewer.dnd.field.DateFieldSpecification;
-import org.apache.isis.viewer.dnd.field.EmptyField;
-import org.apache.isis.viewer.dnd.field.FieldOfSpecification;
-import org.apache.isis.viewer.dnd.field.ImageField;
-import org.apache.isis.viewer.dnd.field.PasswordFieldSpecification;
-import org.apache.isis.viewer.dnd.field.TextFieldSpecification;
-import org.apache.isis.viewer.dnd.form.ExpandableFormSpecification;
-import org.apache.isis.viewer.dnd.form.FormSpecification;
-import org.apache.isis.viewer.dnd.form.FormWithDetailSpecification;
-import org.apache.isis.viewer.dnd.form.InternalFormSpecification;
-import org.apache.isis.viewer.dnd.form.SummaryFormSpecification;
-import org.apache.isis.viewer.dnd.grid.GridSpecification;
-import org.apache.isis.viewer.dnd.help.HelpViewer;
-import org.apache.isis.viewer.dnd.help.InternalHelpViewer;
-import org.apache.isis.viewer.dnd.histogram.HistogramSpecification;
-import org.apache.isis.viewer.dnd.icon.LargeIconSpecification;
-import org.apache.isis.viewer.dnd.icon.RootIconSpecification;
-import org.apache.isis.viewer.dnd.icon.SubviewIconSpecification;
-import org.apache.isis.viewer.dnd.list.InternalListSpecification;
-import org.apache.isis.viewer.dnd.list.SimpleListSpecification;
-import org.apache.isis.viewer.dnd.service.PerspectiveContent;
-import org.apache.isis.viewer.dnd.service.ServiceIconSpecification;
-import org.apache.isis.viewer.dnd.table.WindowTableSpecification;
-import org.apache.isis.viewer.dnd.tree.ListWithDetailSpecification;
-import org.apache.isis.viewer.dnd.tree.TreeSpecification;
-import org.apache.isis.viewer.dnd.tree.TreeWithDetailSpecification;
-import org.apache.isis.viewer.dnd.tree2.CollectionTreeNodeSpecification;
-import org.apache.isis.viewer.dnd.tree2.TreeNodeSpecification;
-import org.apache.isis.viewer.dnd.util.Properties;
-import org.apache.isis.viewer.dnd.view.Axes;
-import org.apache.isis.viewer.dnd.view.ShutdownListener;
-import org.apache.isis.viewer.dnd.view.Toolkit;
-import org.apache.isis.viewer.dnd.view.View;
-import org.apache.isis.viewer.dnd.view.ViewRequirement;
-import org.apache.isis.viewer.dnd.view.ViewSpecification;
-import org.apache.isis.viewer.dnd.view.ViewUpdateNotifier;
-import org.apache.isis.viewer.dnd.view.base.ViewUpdateNotifierImpl;
-import org.apache.isis.viewer.dnd.view.message.DetailedMessageViewSpecification;
-import org.apache.isis.viewer.dnd.view.message.MessageDialogSpecification;
-import org.apache.isis.viewer.dnd.viewer.SkylarkViewFactory;
-import org.apache.isis.viewer.dnd.viewer.basic.DragContentSpecification;
-import org.apache.isis.viewer.dnd.viewer.basic.InnerWorkspaceSpecification;
-import org.apache.isis.viewer.dnd.viewer.basic.RootWorkspaceSpecification;
-import org.apache.isis.viewer.dnd.viewer.basic.WrappedTextFieldSpecification;
-
-public class DndViewer extends IsisViewerAbstract {
-
- private static final Logger LOG = LoggerFactory.getLogger(DndViewer.class);
- private static final String SPECIFICATION_BASE = Properties.PROPERTY_BASE + "specification.";
- private ViewUpdateNotifier updateNotifier;
- private ViewerFrame frame;
- private XViewer viewer;
- private ShutdownListener shutdownListener;
- private Bounds bounds;
- private HelpViewer helpViewer;
- private boolean acceptingLogIns = true;
-
- // ////////////////////////////////////
- // shutdown
- // ////////////////////////////////////
-
- @Override
- public void shutdown() {
- System.exit(0);
- }
-
- private Bounds calculateInitialWindowSize(final Dimension screenSize) {
- int maxWidth = screenSize.width;
- final int maxHeight = screenSize.height;
-
- if ((screenSize.width / screenSize.height) >= 2) {
- final int f = screenSize.width / screenSize.height;
- maxWidth = screenSize.width / f;
- }
-
- final int width = maxWidth - 80;
- final int height = maxHeight - 80;
- final int x = 100;
- final int y = 100;
-
- final Size defaultWindowSize = new Size(width, height);
- defaultWindowSize.limitWidth(800);
- defaultWindowSize.limitHeight(600);
-
- final Size size = Properties.getSize(Properties.PROPERTY_BASE + "initial.size", defaultWindowSize);
- final Location location = Properties.getLocation(Properties.PROPERTY_BASE + "initial.location", new Location(x, y));
- return new Bounds(location, size);
- }
-
- private ViewSpecification loadSpecification(final String name, final Class<?> cls) {
- final String factoryName = IsisContext.getConfiguration().getString(SPECIFICATION_BASE + name);
- ViewSpecification spec;
- if (factoryName != null) {
- spec = InstanceUtil.createInstance(factoryName, ViewSpecification.class);
- } else {
- spec = InstanceUtil.createInstance(cls.getName(), ViewSpecification.class);
- }
- return spec;
- }
-
- private synchronized void logOut() {
- LOG.info("user log out");
- saveDesktop();
- final AuthenticationSession session = IsisContext.getAuthenticationSession();
- getAuthenticationManager().closeSession(session);
- viewer.close();
- notify();
- }
-
- private void saveDesktop() {
- if (!IsisContext.inSession()) {
- // can't do anything
- return;
- }
- viewer.saveOpenObjects();
- }
-
- protected void quit() {
- LOG.info("user quit");
- saveDesktop();
- acceptingLogIns = false;
- shutdown();
- }
-
- @Override
- public synchronized void init() {
- super.init();
-
- new AwtImageFactory(IsisContext.getTemplateImageLoader());
- new AwtToolkit();
-
- setShutdownListener(new ShutdownListener() {
- @Override
- public void logOut() {
- DndViewer.this.logOut();
- }
-
- @Override
- public void quit() {
- DndViewer.this.quit();
- }
- });
-
- updateNotifier = new ViewUpdateNotifierImpl();
-
- if (updateNotifier == null) {
- throw new NullPointerException("No update notifier set for " + this);
- }
- if (shutdownListener == null) {
- throw new NullPointerException("No shutdown listener set for " + this);
- }
-
- while (acceptingLogIns) {
- if (login()) {
- openViewer();
- try {
- wait();
- } catch (final InterruptedException e) {
- }
- } else {
- quit();
- }
- }
- }
-
- // ////////////////////////////////////
- // login
- // ////////////////////////////////////
-
- // TODO: nasty
- private boolean loggedInUsingLogonFixture = false;
-
- /**
- * TODO: there is similar code in
- * <tt>AuthenticationSessionLookupStrategyDefault</tt>; should try to
- * combine somehow...
- */
- private boolean login() {
- final AuthenticationRequest request = determineRequestIfPossible();
-
- // we may have enough to get a session
- AuthenticationSession session = getAuthenticationManager().authenticate(request);
- clearAuthenticationRequestViaArgs();
-
- if (session == null) {
- session = loginDialogPrompt(request);
- }
- if (session == null) {
- return false;
- } else {
- IsisContext.openSession(session);
- return true;
- }
- }
-
- private AuthenticationSession loginDialogPrompt(final AuthenticationRequest request) {
- AuthenticationSession session;
- final LoginDialog dialog = new LoginDialog(getAuthenticationManager());
- if (request != null) {
- dialog.setUserName(request.getName());
- }
- dialog.setVisible(true);
- dialog.toFront();
- dialog.login();
- dialog.setVisible(false);
- dialog.dispose();
- session = dialog.getSession();
- return session;
- }
-
- private AuthenticationRequest determineRequestIfPossible() {
-
- // command line args
- AuthenticationRequest request = getAuthenticationRequestViaArgs();
- ;
-
- // exploration & (optionally) logon fixture provided
- if (request == null) {
- if (getDeploymentType().isExploring()) {
- request = new AuthenticationRequestExploration(getLogonFixture());
- }
- }
-
- // logon fixture provided
- if (request == null) {
- if (getLogonFixture() != null && !loggedInUsingLogonFixture) {
- loggedInUsingLogonFixture = true;
- request = new AuthenticationRequestLogonFixture(getLogonFixture());
- }
- }
- return request;
- }
-
- private void openViewer() {
- frame = new ViewerFrame();
-
- if (bounds == null) {
- bounds = calculateInitialWindowSize(frame.getToolkit().getScreenSize());
- }
-
- frame.pack(); // forces insets to be calculated, hence need to then set
- // bounds
- frame.setBounds(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight());
-
- viewer = (XViewer) Toolkit.getViewer();
- viewer.setRenderingArea(frame);
- viewer.setUpdateNotifier(updateNotifier);
- viewer.setListener(shutdownListener);
- viewer.setExploration(isInExplorationMode());
- viewer.setPrototype(isInPrototypeMode());
-
- if (helpViewer == null) {
- helpViewer = new InternalHelpViewer(viewer);
- }
- viewer.setHelpViewer(helpViewer);
-
- frame.setViewer(viewer);
-
- final AuthenticationSession currentSession = IsisContext.getAuthenticationSession();
- if (currentSession == null) {
- throw new NullPointerException("No session for " + this);
- }
-
- setupViewFactory();
-
- final UserProfile userProfiler = IsisContext.getUserProfile();
-
- // TODO viewer should be shown during init() (so login can take place on
- // main window, and can quit
- // before
- // logging in), and should be updated during start to show context.
-
- // TODO resolving should be done by the views?
- // resolveApplicationContextCollection(rootObject, "services");
- // resolveApplicationContextCollection(rootObject, "objects");
- final RootWorkspaceSpecification spec = new RootWorkspaceSpecification();
- final PerspectiveContent content = new PerspectiveContent(userProfiler.getPerspective());
- if (spec.canDisplay(new ViewRequirement(content, ViewRequirement.CLOSED))) {
- // View view = spec.createView(new RootObject(rootObject), null);
- final View view = spec.createView(content, new Axes(), -1);
- viewer.setRootView(view);
- } else {
- throw new IsisException();
- }
-
- viewer.init();
-
- final String name = userProfiler.getPerspective().getName();
- frame.setTitle(name);
- frame.init();
-
- viewer.initSize();
- viewer.scheduleRepaint();
-
- frame.setVisible(true);
- frame.toFront();
- }
-
- private boolean isInExplorationMode() {
- return getDeploymentType().isExploring();
- }
-
- private boolean isInPrototypeMode() {
- return getDeploymentType().isPrototyping();
- }
-
- public void setBounds(final Bounds bounds) {
- this.bounds = bounds;
- }
-
- public void setHelpViewer(final HelpViewer helpViewer) {
- this.helpViewer = helpViewer;
- }
-
- public void setShutdownListener(final ShutdownListener shutdownListener) {
- this.shutdownListener = shutdownListener;
- }
-
- private void setupViewFactory() throws IsisConfigurationException, InstanceCreationException {
- final SkylarkViewFactory viewFactory = (SkylarkViewFactory) Toolkit.getViewFactory();
-
- LOG.debug("setting up default views (provided by the framework)");
-
- /*
- * viewFactory.addValueFieldSpecification(loadSpecification("field.option"
- * , OptionSelectionField.Specification.class));
- * viewFactory.addValueFieldSpecification
- * (loadSpecification("field.percentage",
- * PercentageBarField.Specification.class));
- * viewFactory.addValueFieldSpecification
- * (loadSpecification("field.timeperiod",
- * TimePeriodBarField.Specification.class));
- */
- viewFactory.addSpecification(loadSpecification("field.image", ImageField.Specification.class));
- viewFactory.addSpecification(loadSpecification("field.color", ColorField.Specification.class));
- viewFactory.addSpecification(loadSpecification("field.password", PasswordFieldSpecification.class));
- viewFactory.addSpecification(loadSpecification("field.wrappedtext", WrappedTextFieldSpecification.class));
- viewFactory.addSpecification(loadSpecification("field.checkbox", CheckboxField.Specification.class));
- viewFactory.addSpecification(loadSpecification("field.date", DateFieldSpecification.class));
- viewFactory.addSpecification(loadSpecification("field.text", TextFieldSpecification.class));
- viewFactory.addSpecification(new RootWorkspaceSpecification());
- viewFactory.addSpecification(new InnerWorkspaceSpecification());
-
- if (IsisContext.getConfiguration().getBoolean(SPECIFICATION_BASE + "defaults", true)) {
- viewFactory.addSpecification(new FieldOfSpecification());
-
- viewFactory.addSpecification(new InternalListSpecification());
- viewFactory.addSpecification(new SimpleListSpecification());
- viewFactory.addSpecification(new GridSpecification());
- // TBA viewFactory.addSpecification(new
- // ListWithExpandableElementsSpecification());
- // TBA
- viewFactory.addSpecification(new CalendarSpecification());
- viewFactory.addSpecification(new ListWithDetailSpecification());
- viewFactory.addSpecification(new HistogramSpecification());
-
- viewFactory.addSpecification(new TreeWithDetailSpecification());
- viewFactory.addSpecification(new FormSpecification());
- viewFactory.addSpecification(new FormWithTableSpecification());
- viewFactory.addSpecification(new WindowTableSpecification());
- // TBA
- viewFactory.addSpecification(new ExpandableFormSpecification());
- viewFactory.addSpecification(new InternalFormSpecification());
- viewFactory.addSpecification(new TwoPartViewSpecification());
- // TBA
- viewFactory.addSpecification(new FormWithDetailSpecification());
-
- viewFactory.addSpecification(new SummaryFormSpecification());
-
- viewFactory.addSpecification(new TreeSpecification());
- // TODO allow window form to be used for objects with limited number
- // of collections
- // viewFactory.addSpecification(new TreeWithDetailSpecification(0,
- // 3));
-
- viewFactory.addDesignSpecification(new GridListSpecification());
- viewFactory.addDesignSpecification(new ConfigurableObjectViewSpecification());
- viewFactory.addDesignSpecification(new PanelViewSpecification());
- viewFactory.addDesignSpecification(new NewViewSpecification());
- }
-
- viewFactory.addSpecification(new MessageDialogSpecification());
- viewFactory.addSpecification(new DetailedMessageViewSpecification());
-
- viewFactory.addEmptyFieldSpecification(loadSpecification("field.empty", EmptyField.Specification.class));
-
- viewFactory.addSpecification(loadSpecification("icon.object", RootIconSpecification.class));
- viewFactory.addSpecification(loadSpecification("icon.subview", SubviewIconSpecification.class));
- viewFactory.addSpecification(loadSpecification("icon.collection", ExpandableListSpecification.class));
- viewFactory.addSpecification(new LargeIconSpecification());
-
- viewFactory.addSpecification(loadSpecification("icon.service", ServiceIconSpecification.class));
- viewFactory.setDragContentSpecification(loadSpecification("drag-content", DragContentSpecification.class));
-
- // TODO remove or move to better position
- final ViewSpecification[] specifications = CollectionTreeNodeSpecification.create();
- viewFactory.addSpecification(specifications[0]);
- viewFactory.addSpecification(specifications[1]);
- viewFactory.addSpecification(new TreeNodeSpecification());
-
- installSpecsFromConfiguration(viewFactory);
-
- viewFactory.loadUserViewSpecifications();
- }
-
- private void installSpecsFromConfiguration(final SkylarkViewFactory viewFactory) {
- final String viewParams = IsisContext.getConfiguration().getString(SPECIFICATION_BASE + "view");
- if (viewParams != null) {
- final StringTokenizer st = new StringTokenizer(viewParams, ",");
- while (st.hasMoreTokens()) {
- final String specName = st.nextToken().trim();
- if (specName != null && !specName.trim().equals("")) {
- viewFactory.addSpecification(specName);
- }
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/DndViewerInstaller.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/DndViewerInstaller.java b/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/DndViewerInstaller.java
deleted file mode 100644
index a5b909f..0000000
--- a/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/DndViewerInstaller.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.isis.viewer.dnd;
-
-import org.apache.isis.core.runtime.installerregistry.installerapi.IsisViewerInstallerAbstract;
-import org.apache.isis.core.runtime.viewer.IsisViewer;
-
-public class DndViewerInstaller extends IsisViewerInstallerAbstract {
-
- public DndViewerInstaller() {
- super("dnd");
- }
-
- @Override
- public IsisViewer doCreateViewer() {
- return new DndViewer();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/awt/AWTUtilities.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/awt/AWTUtilities.java b/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/awt/AWTUtilities.java
deleted file mode 100644
index 64c33a3..0000000
--- a/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/awt/AWTUtilities.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.isis.viewer.dnd.awt;
-
-import java.awt.Frame;
-import java.awt.Image;
-import java.net.URL;
-
-public class AWTUtilities {
-
- public static void addWindowIcon(final Frame window, final String file) {
- final URL url = ViewerFrame.class.getResource("/" + "images/" + file);
- if (url != null) {
- final Image image = java.awt.Toolkit.getDefaultToolkit().getImage(url);
- if (image != null) {
- window.setIconImage(image);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/awt/AwtCanvas.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/awt/AwtCanvas.java b/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/awt/AwtCanvas.java
deleted file mode 100644
index 48e7790..0000000
--- a/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/awt/AwtCanvas.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.isis.viewer.dnd.awt;
-
-import java.awt.Font;
-import java.awt.Graphics;
-import java.awt.Polygon;
-import java.awt.Rectangle;
-import java.awt.image.ImageObserver;
-import java.util.StringTokenizer;
-
-import org.apache.isis.viewer.dnd.drawing.Bounds;
-import org.apache.isis.viewer.dnd.drawing.Canvas;
-import org.apache.isis.viewer.dnd.drawing.Color;
-import org.apache.isis.viewer.dnd.drawing.ColorsAndFonts;
-import org.apache.isis.viewer.dnd.drawing.Image;
-import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.drawing.Shape;
-import org.apache.isis.viewer.dnd.drawing.Text;
-import org.apache.isis.viewer.dnd.view.Toolkit;
-import org.apache.isis.viewer.dnd.view.base.AwtImage;
-
-public class AwtCanvas implements Canvas {
- private java.awt.Color color;
- private Font font;
- private final Graphics graphics;
- private final RenderingArea renderingArea;
-
- private AwtCanvas(final Graphics graphics, final RenderingArea renderingArea) {
- this.graphics = graphics;
- this.renderingArea = renderingArea;
- }
-
- public AwtCanvas(final Graphics bufferGraphic, final RenderingArea renderingArea, final int x, final int y, final int width, final int height) {
- graphics = bufferGraphic;
- this.renderingArea = renderingArea;
- graphics.clipRect(x, y, width, height);
- }
-
- private Polygon createOval(final int x, final int y, final int width, final int height) {
- final int points = 40;
- final int xPoints[] = new int[points];
- final int yPoints[] = new int[points];
- double radians = 0.0;
- for (int i = 0; i < points; i++) {
- xPoints[i] = x + (int) (width / 2.0) + (int) (width / 2.0 * Math.cos(radians));
- yPoints[i] = y + (int) (height / 2.0) + (int) (height / 2.0 * Math.sin(radians));
- radians += (2.0 * Math.PI) / points;
- }
- final Polygon p = new Polygon(xPoints, yPoints, points);
- return p;
- }
-
- @Override
- public Canvas createSubcanvas() {
- return new AwtCanvas(graphics.create(), renderingArea);
- }
-
- @Override
- public Canvas createSubcanvas(final Bounds bounds) {
- return createSubcanvas(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight());
- }
-
- @Override
- public Canvas createSubcanvas(final int x, final int y, final int width, final int height) {
- final Graphics g = graphics.create();
- // this form of clipping must go here!
- g.translate(x, y);
- return new AwtCanvas(g, renderingArea, 0, 0, width, height);
- }
-
- @Override
- public void draw3DRectangle(final int x, final int y, final int width, final int height, final Color color, final boolean raised) {
- useColor(color);
- graphics.draw3DRect(x, y, width - 1, height - 1, raised);
- }
-
- @Override
- public void drawDebugOutline(final Bounds bounds, final int baseline, final Color color) {
- final int width = bounds.getWidth();
- final int height = bounds.getHeight();
- drawRectangle(bounds.getX(), bounds.getY(), width, height, color);
- final int midpoint = bounds.getY() + height / 2;
- drawLine(bounds.getX(), midpoint, width - 2, midpoint, color);
- if (baseline > 0) {
- drawLine(bounds.getX(), baseline, width - 1, baseline, Toolkit.getColor(ColorsAndFonts.COLOR_DEBUG_BASELINE));
- }
- }
-
- @Override
- public void drawImage(final Image image, final int x, final int y) {
- graphics.drawImage(((AwtImage) image).getAwtImage(), x, y, (ImageObserver) renderingArea);
- }
-
- @Override
- public void drawImage(final Image image, final int x, final int y, final int width, final int height) {
- graphics.drawImage(((AwtImage) image).getAwtImage(), x, y, width - 1, height - 1, (ImageObserver) renderingArea);
- }
-
- @Override
- public void drawLine(final int x, final int y, final int x2, final int y2, final Color color) {
- useColor(color);
- graphics.drawLine(x, y, x2, y2);
- }
-
- @Override
- public void drawLine(final Location start, final int xExtent, final int yExtent, final Color color) {
- drawLine(start.getX(), start.getY(), start.getX() + xExtent, start.getY() + yExtent, color);
- }
-
- @Override
- public void drawOval(final int x, final int y, final int width, final int height, final Color color) {
- useColor(color);
- final Polygon p = createOval(x, y, width - 1, height - 1);
- graphics.drawPolygon(p);
- }
-
- @Override
- public void drawRectangle(final int x, final int y, final int width, final int height, final Color color) {
- useColor(color);
- graphics.drawRect(x, y, width - 1, height - 1);
- }
-
- @Override
- public void drawRectangleAround(final Bounds bounds, final Color color) {
- drawRectangle(0, 0, bounds.getWidth(), bounds.getHeight(), color);
- }
-
- @Override
- public void drawRoundedRectangle(final int x, final int y, final int width, final int height, final int arcWidth, final int arcHeight, final Color color) {
- useColor(color);
- graphics.drawRoundRect(x, y, width - 1, height - 1, arcWidth, arcHeight);
- }
-
- @Override
- public void drawShape(final Shape shape, final Color color) {
- useColor(color);
- graphics.drawPolygon(shape.getX(), shape.getY(), shape.count());
- }
-
- @Override
- public void drawShape(final Shape shape, final int x, final int y, final Color color) {
- final Shape copy = new Shape(shape);
- copy.translate(x, y);
- drawShape(copy, color);
- }
-
- @Override
- public void drawSolidOval(final int x, final int y, final int width, final int height, final Color color) {
- useColor(color);
- final Polygon p = createOval(x, y, width, height);
- graphics.fillPolygon(p);
- }
-
- @Override
- public void drawSolidRectangle(final int x, final int y, final int width, final int height, final Color color) {
- useColor(color);
- graphics.fillRect(x, y, width, height);
- }
-
- @Override
- public void drawSolidShape(final Shape shape, final Color color) {
- useColor(color);
- graphics.fillPolygon(shape.getX(), shape.getY(), shape.count());
- }
-
- @Override
- public void drawSolidShape(final Shape shape, final int x, final int y, final Color color) {
- final Shape copy = new Shape(shape);
- copy.translate(x, y);
- drawSolidShape(copy, color);
- }
-
- @Override
- public void drawText(final String text, final int x, final int y, final Color color, final Text style) {
- useColor(color);
- useFont(style);
- graphics.drawString(text, x, y);
- }
-
- @Override
- public void drawText(final String text, final int x, final int y, final int maxWidth, final Color color, final Text style) {
- useColor(color);
- useFont(style);
-
- int top = y;
- final StringTokenizer lines = new StringTokenizer(text, "\n\r");
- while (lines.hasMoreTokens()) {
- final String line = lines.nextToken();
- final StringTokenizer words = new StringTokenizer(line, " ");
- final StringBuffer l = new StringBuffer();
- int width = 0;
- while (words.hasMoreTokens()) {
- final String nextWord = words.nextToken();
- final int wordWidth = style.stringWidth(nextWord);
- width += wordWidth;
- if (width >= maxWidth) {
- graphics.drawString(l.toString(), x + (line.startsWith("\t") ? 20 : 00), top);
- top += style.getLineHeight();
- l.setLength(0);
- width = wordWidth;
- }
- l.append(nextWord);
- l.append(" ");
- width += style.stringWidth(" ");
- }
- graphics.drawString(l.toString(), x + (line.startsWith("\t") ? 20 : 00), top);
- top += style.getLineHeight();
- }
- }
-
- @Override
- public void offset(final int x, final int y) {
- graphics.translate(x, y);
- }
-
- @Override
- public boolean overlaps(final Bounds bounds) {
- final Rectangle clip = graphics.getClipBounds();
- final Bounds activeArea = new Bounds(clip.x, clip.y, clip.width, clip.height);
- return bounds.intersects(activeArea);
- }
-
- @Override
- public String toString() {
- final Rectangle cb = graphics.getClipBounds();
- return "Canvas [area=" + cb.x + "," + cb.y + " " + cb.width + "x" + cb.height + ",color=" + color + ",font=" + font + "]";
- }
-
- private void useColor(final Color color) {
- final java.awt.Color awtColor = ((AwtColor) color).getAwtColor();
-
- if (this.color != awtColor) {
- this.color = awtColor;
- graphics.setColor(awtColor);
- }
- }
-
- private void useFont(final Text style) {
- final Font font = ((AwtText) style).getAwtFont();
- if (this.font != font) {
- this.font = font;
- graphics.setFont(font);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/awt/AwtColor.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/awt/AwtColor.java b/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/awt/AwtColor.java
deleted file mode 100644
index 8cbb702..0000000
--- a/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/awt/AwtColor.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.isis.viewer.dnd.awt;
-
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.dnd.drawing.Color;
-import org.apache.isis.viewer.dnd.util.Properties;
-
-public class AwtColor implements Color {
- public static final AwtColor DEBUG_BASELINE = new AwtColor(java.awt.Color.magenta);
- public static final AwtColor DEBUG_DRAW_BOUNDS = new AwtColor(java.awt.Color.cyan);
- public static final AwtColor DEBUG_VIEW_BOUNDS = new AwtColor(java.awt.Color.orange);
- public static final AwtColor DEBUG_REPAINT_BOUNDS = new AwtColor(java.awt.Color.green);
- public static final AwtColor DEBUG_BORDER_BOUNDS = new AwtColor(java.awt.Color.pink);
-
- public static final AwtColor RED = new AwtColor(java.awt.Color.red);
- public static final AwtColor GREEN = new AwtColor(java.awt.Color.green);
- public static final AwtColor BLUE = new AwtColor(java.awt.Color.blue);
- public static final AwtColor BLACK = new AwtColor(java.awt.Color.black);
- public static final AwtColor WHITE = new AwtColor(java.awt.Color.white);
- public static final AwtColor GRAY = new AwtColor(java.awt.Color.gray);
- public static final AwtColor LIGHT_GRAY = new AwtColor(java.awt.Color.lightGray);
- public static final AwtColor ORANGE = new AwtColor(java.awt.Color.orange);
- public static final AwtColor YELLOW = new AwtColor(java.awt.Color.yellow);
-
- static public final AwtColor NULL = new AwtColor(0);
-
- private static final String PROPERTY_STEM = Properties.PROPERTY_BASE + "color.";
- private final java.awt.Color color;
- private String name;
-
- public AwtColor(final int rgbColor) {
- this(new java.awt.Color(rgbColor));
- }
-
- private AwtColor(final java.awt.Color color) {
- this.color = color;
- }
-
- public AwtColor(final String propertyName, final String defaultColor) {
- this.name = propertyName;
- color = IsisContext.getConfiguration().getColor(PROPERTY_STEM + propertyName, java.awt.Color.decode(defaultColor));
- }
-
- public AwtColor(final String propertyName, final AwtColor defaultColor) {
- this.name = propertyName;
- color = IsisContext.getConfiguration().getColor(PROPERTY_STEM + propertyName, defaultColor.getAwtColor());
- }
-
- @Override
- public Color brighter() {
- return new AwtColor(color.brighter());
- }
-
- @Override
- public Color darker() {
- return new AwtColor(color.darker());
- }
-
- public java.awt.Color getAwtColor() {
- return color;
- }
-
- @Override
- public String toString() {
- return name + " (" + "#" + Integer.toHexString(color.getRGB()) + ")";
- }
-
- @Override
- public String getName() {
- return name;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/awt/AwtColorsAndFonts.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/awt/AwtColorsAndFonts.java b/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/awt/AwtColorsAndFonts.java
deleted file mode 100644
index cc05daa..0000000
--- a/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/awt/AwtColorsAndFonts.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.isis.viewer.dnd.awt;
-
-import java.util.Hashtable;
-
-import org.apache.isis.viewer.dnd.drawing.Color;
-import org.apache.isis.viewer.dnd.drawing.ColorsAndFonts;
-import org.apache.isis.viewer.dnd.drawing.Text;
-import org.apache.isis.viewer.dnd.view.ViewConstants;
-
-public class AwtColorsAndFonts implements ColorsAndFonts {
- private final Hashtable colors = new Hashtable();
- private int defaultBaseline;
- private int defaultFieldHeight;
- private final Hashtable fonts = new Hashtable();
-
- @Override
- public int defaultBaseline() {
- if (defaultBaseline == 0) {
- final int iconSize = getText(TEXT_NORMAL).getAscent();
- defaultBaseline = ViewConstants.VPADDING + iconSize;
- }
- return defaultBaseline;
- }
-
- @Override
- public int defaultFieldHeight() {
- if (defaultFieldHeight == 0) {
- defaultFieldHeight = getText(TEXT_NORMAL).getTextHeight();
- }
- return defaultFieldHeight;
- }
-
- @Override
- public Color getColor(final String name) {
- Color color = (Color) colors.get(name);
- if (color == null && name.startsWith(COLOR_WINDOW + ".")) {
- color = new AwtColor(name, (AwtColor) getColor(COLOR_WINDOW));
- colors.put(name, color);
- }
- return color;
-
- }
-
- @Override
- public Color getColor(final int rgbColor) {
- return new AwtColor(rgbColor);
- }
-
- @Override
- public Text getText(final String name) {
- return (Text) fonts.get(name);
- }
-
- @Override
- public void init() {
- // core color scheme
- setColor(COLOR_BLACK, "#000000");
- setColor(COLOR_WHITE, "#ffffff");
- setColor(COLOR_PRIMARY1, "#666699");
- setColor(COLOR_PRIMARY2, "#9999cc");
- setColor(COLOR_PRIMARY3, "#ccccff");
- setColor(COLOR_SECONDARY1, "#666666");
- setColor(COLOR_SECONDARY2, "#999999");
- setColor(COLOR_SECONDARY3, "#cccccc");
-
- // background colors
- setColor(COLOR_APPLICATION, "#e0e0e0");
- setColor(COLOR_WINDOW, getColor(COLOR_WHITE));
- setColor(COLOR_MENU_VALUE, getColor(COLOR_PRIMARY3)); // "#ccffcc");
- setColor(COLOR_MENU_CONTENT, getColor(COLOR_PRIMARY3)); // "#ffcccc");
- setColor(COLOR_MENU_VIEW, getColor(COLOR_SECONDARY3)); // "#ffccff");
- setColor(COLOR_MENU_WORKSPACE, getColor(COLOR_SECONDARY3)); // "#cccccc");
-
- // menu colors
- setColor(COLOR_MENU, getColor(COLOR_BLACK));
- setColor(COLOR_MENU_DISABLED, getColor(COLOR_SECONDARY1));
- setColor(COLOR_MENU_REVERSED, getColor(COLOR_WHITE));
-
- // label colors
- setColor(COLOR_LABEL_MANDATORY, getColor(COLOR_BLACK));
- setColor(COLOR_LABEL, getColor(COLOR_SECONDARY1));
- setColor(COLOR_LABEL_DISABLED, getColor(COLOR_SECONDARY2));
-
- // state colors
- setColor(COLOR_IDENTIFIED, getColor(COLOR_PRIMARY1)); // "#0099ff");
- setColor(COLOR_VALID, "#32CD32");
- setColor(COLOR_INVALID, "#ee1919");
- setColor(COLOR_ERROR, "#ee1919");
- setColor(COLOR_ACTIVE, "#ff0000");
- setColor(COLOR_OUT_OF_SYNC, "#662200");
-
- // text colors
- setColor(COLOR_TEXT_SAVED, getColor(COLOR_SECONDARY1));
- setColor(COLOR_TEXT_EDIT, getColor(COLOR_PRIMARY1)); // "#009933");
- setColor(COLOR_TEXT_CURSOR, getColor(COLOR_PRIMARY1));
- setColor(COLOR_TEXT_HIGHLIGHT, getColor(COLOR_PRIMARY3));
-
- // debug outline colors
- setColor(COLOR_DEBUG_BASELINE, AwtColor.DEBUG_BASELINE);
- setColor(COLOR_DEBUG_BOUNDS_BORDER, AwtColor.DEBUG_BORDER_BOUNDS);
- setColor(COLOR_DEBUG_BOUNDS_DRAW, AwtColor.DEBUG_DRAW_BOUNDS);
- setColor(COLOR_DEBUG_BOUNDS_REPAINT, AwtColor.DEBUG_REPAINT_BOUNDS);
- setColor(COLOR_DEBUG_BOUNDS_VIEW, AwtColor.DEBUG_VIEW_BOUNDS);
-
- // fonts
- final String defaultFontFamily = AwtText.defaultFontFamily();
- final int defaultFontSizeSmall = AwtText.defaultFontSizeSmall();
- final int defaultFontSizeMedium = AwtText.defaultFontSizeMedium();
- final int defaultFontSizeLarge = AwtText.defaultFontSizeLarge();
-
- setText(TEXT_TITLE, defaultFontFamily + "-bold-" + defaultFontSizeLarge);
-
- setText(TEXT_TITLE_SMALL, defaultFontFamily + "-bold-" + defaultFontSizeMedium);
- setText(TEXT_NORMAL, defaultFontFamily + "-plain-" + defaultFontSizeMedium);
- setText(TEXT_CONTROL, defaultFontFamily + "-bold-" + defaultFontSizeMedium);
- setText(TEXT_STATUS, defaultFontFamily + "--" + defaultFontSizeMedium);
- setText(TEXT_ICON, defaultFontFamily + "-bold-" + defaultFontSizeMedium);
- setText(TEXT_MENU, defaultFontFamily + "--" + defaultFontSizeMedium);
-
- setText(TEXT_LABEL_MANDATORY, defaultFontFamily + "--" + defaultFontSizeSmall);
- setText(TEXT_LABEL_DISABLED, defaultFontFamily + "--" + defaultFontSizeSmall);
- setText(TEXT_LABEL, defaultFontFamily + "--" + defaultFontSizeSmall);
- }
-
- private void setColor(final String name, final Color defaultColor) {
- setColor(name, (AwtColor) defaultColor);
- }
-
- private void setColor(final String name, final AwtColor defaultColor) {
- if (getColor(name) == null) {
- final AwtColor color = new AwtColor(name, defaultColor);
- colors.put(name, color);
- }
- }
-
- private void setColor(final String name, final String defaultColor) {
- if (getColor(name) == null) {
- final AwtColor color = new AwtColor(name, defaultColor);
- colors.put(name, color);
- }
- }
-
- private void setText(final String name, final String defaultFont) {
- if (getText(name) == null) {
- final AwtText font = new AwtText(name, defaultFont);
- fonts.put(name, font);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/680f0c8d/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/awt/AwtImageFactory.java
----------------------------------------------------------------------
diff --git a/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/awt/AwtImageFactory.java b/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/awt/AwtImageFactory.java
deleted file mode 100644
index 27d8c18..0000000
--- a/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/awt/AwtImageFactory.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.isis.viewer.dnd.awt;
-
-import java.awt.Toolkit;
-import java.awt.image.FilteredImageSource;
-import java.awt.image.RGBImageFilter;
-
-import org.apache.isis.core.runtime.imageloader.TemplateImage;
-import org.apache.isis.core.runtime.imageloader.TemplateImageLoader;
-import org.apache.isis.viewer.dnd.drawing.Color;
-import org.apache.isis.viewer.dnd.drawing.Image;
-import org.apache.isis.viewer.dnd.drawing.ImageFactory;
-import org.apache.isis.viewer.dnd.view.base.AwtImage;
-
-public class AwtImageFactory extends ImageFactory {
-
- private static class Filter extends RGBImageFilter {
- @Override
- public int filterRGB(final int x, final int y, final int rgb) {
- return 0xFFFFFF - rgb;
- }
- }
-
- private final TemplateImageLoader loader;
-
- public AwtImageFactory(final TemplateImageLoader imageLoader) {
- loader = imageLoader;
- }
-
- /**
- * Load an image with the given name.
- */
- @Override
- public Image loadImage(final String path) {
- final TemplateImage template = templateImage(path);
- if (template == null) {
- return null;
- }
- return new AwtImage(template.getImage());
- }
-
- @Override
- protected Image loadImage(final String name, final int height, final Color tint) {
- final TemplateImage template = templateImage(name);
- if (template == null) {
- return null;
- }
- final java.awt.Image iconImage = template.getIcon(height);
- if (tint != null) {
- Toolkit.getDefaultToolkit().createImage(new FilteredImageSource(iconImage.getSource(), new Filter()));
- }
- final Image icon = new AwtImage(iconImage);
- return icon;
- }
-
- // ////////////////////////////////////////////////////////////////////
- // Helpers
- // ////////////////////////////////////////////////////////////////////
-
- private TemplateImage templateImage(final String name) {
- final TemplateImage template = loader.getTemplateImage(name);
- return template;
- }
-
-}