Skip to content

Commit

Permalink
Browser widget test
Browse files Browse the repository at this point in the history
  • Loading branch information
hansva committed Feb 7, 2024
1 parent 4112bff commit 05b2858
Show file tree
Hide file tree
Showing 10 changed files with 566 additions and 0 deletions.
13 changes: 13 additions & 0 deletions assemblies/plugins/dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3328,6 +3328,19 @@
</exclusions>
</dependency>

<dependency>
<groupId>org.apache.hop</groupId>
<artifactId>hop-assemblies-plugins-tech-hopserver</artifactId>
<version>${project.version}</version>
<type>zip</type>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.apache.hop</groupId>
<artifactId>hop-assemblies-plugins-tech-neo4j</artifactId>
Expand Down
46 changes: 46 additions & 0 deletions assemblies/plugins/tech/hopserver/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.hop</groupId>
<artifactId>hop-assemblies-plugins-tech</artifactId>
<version>2.8.0-SNAPSHOT</version>
</parent>

<artifactId>hop-assemblies-plugins-tech-hopserver</artifactId>
<version>2.8.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Hop Assemblies Plugins Hop Server</name>
<description />

<properties>
</properties>

<dependencies>

<dependency>
<groupId>org.apache.hop</groupId>
<artifactId>hop-plugins-tech-hopserver</artifactId>
<version>2.8.0-SNAPSHOT</version>
</dependency>
</dependencies>

</project>
57 changes: 57 additions & 0 deletions assemblies/plugins/tech/hopserver/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!--
~ 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.
-->

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>hop-assemblies-plugins-tech-hopserver</id>
<formats>
<format>zip</format>
</formats>
<baseDirectory>tech/hopserver</baseDirectory>
<files>
<file>
<source>${project.basedir}/src/main/resources/version.xml</source>
<outputDirectory>.</outputDirectory>
<filtered>true</filtered>
</file>
</files>

<fileSets>
<fileSet>
<outputDirectory>lib</outputDirectory>
<excludes>
<exclude>**/*</exclude>
</excludes>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<includes>
<include>org.apache.hop:hop-plugins-tech-hopserver:jar</include>
</includes>
</dependencySet>
<dependencySet>
<outputDirectory>lib</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
<scope>runtime</scope>
<includes>
</includes>
</dependencySet>
</dependencySets>
</assembly>
19 changes: 19 additions & 0 deletions assemblies/plugins/tech/hopserver/src/main/resources/version.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?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.
-->

<version>${project.version}</version>
1 change: 1 addition & 0 deletions assemblies/plugins/tech/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<module>google</module>
<module>neo4j</module>
<module>parquet</module>
<module>hopserver</module>
</modules>

</project>
63 changes: 63 additions & 0 deletions plugins/tech/hopserver/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.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.
-->

<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.apache.hop</groupId>
<artifactId>hop-plugins-tech-hopserver</artifactId>
<version>2.8.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Hop Plugins Technology Google</name>
<url>http://maven.apache.org</url>

<parent>
<groupId>org.apache.hop</groupId>
<artifactId>hop-plugins-tech</artifactId>
<version>2.8.0-SNAPSHOT</version>
</parent>

<licenses>
<license>
<name>Apache License, version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0</url>
<distribution>repo</distribution>
<comments />
</license>
</licenses>

<properties>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.hop</groupId>
<artifactId>hop-core</artifactId>
<scope>compile</scope>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hop</groupId>
<artifactId>hop-ui</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
/*
* 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.hop.hopserver.perspective;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.apache.hop.core.gui.plugin.GuiPlugin;
import org.apache.hop.core.search.ISearchable;
import org.apache.hop.ui.core.ConstUi;
import org.apache.hop.ui.core.PropsUi;
import org.apache.hop.ui.hopgui.HopGui;
import org.apache.hop.ui.hopgui.context.IGuiContextHandler;
import org.apache.hop.ui.hopgui.file.IHopFileType;
import org.apache.hop.ui.hopgui.file.IHopFileTypeHandler;
import org.apache.hop.ui.hopgui.perspective.HopPerspectivePlugin;
import org.apache.hop.ui.hopgui.perspective.IHopPerspective;
import org.apache.hop.ui.hopgui.perspective.TabItemHandler;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;

@HopPerspectivePlugin(
id = "HopNeo4jPerspective2",
name = "Neo4j",
description = "Neo4j Perspective",
image = "server.svg")
@GuiPlugin
public class HopServerPerspective implements IHopPerspective {

public HopServerPerspective() {}

public static final Class<?> PKG = HopServerPerspective.class;

public static final String ID_PERSPECTIVE_TOOLBAR_ITEM = "9900-perspective-hopserver";

private HopGui hopGui;
private Composite parent;
private Composite composite;

@Override
public List<IGuiContextHandler> getContextHandlers() {
List<IGuiContextHandler> handlers = new ArrayList<>();
return handlers;
}

@Override
public String getId() {
return "hansIsCool";
}

@Override
public IHopFileTypeHandler getActiveFileTypeHandler() {
return null;
}

@Override
public void setActiveFileTypeHandler(IHopFileTypeHandler activeFileTypeHandler) {

}

@Override
public List<IHopFileType> getSupportedHopFileTypes() {
return Collections.emptyList();
}

@Override
public void activate() {
hopGui.setActivePerspective(this);

}

@Override
public void perspectiveActivated() {

}

@Override
public void navigateToPreviousFile() {

}

@Override
public void navigateToNextFile() {

}

@Override
public boolean isActive() {
return hopGui.isActivePerspective(this);
}

@Override
public void initialize(HopGui hopGui, Composite parent) {
this.hopGui = hopGui;
this.parent = parent;

PropsUi props = PropsUi.getInstance();

int size = (int) Math.round((double) ConstUi.SMALL_ICON_SIZE * props.getZoomFactor());

composite = new Composite(parent, SWT.NONE);
PropsUi.setLook(composite);
FormLayout layout = new FormLayout();
layout.marginLeft = props.getMargin();
layout.marginTop = props.getMargin();
layout.marginLeft = props.getMargin();
layout.marginBottom = props.getMargin();
composite.setLayout(layout);

}

@Override
public boolean hasNavigationPreviousFile() {
return false;
}

@Override
public boolean hasNavigationNextFile() {
return false;
}

@Override
public Control getControl() {
return composite;
}

@Override
public boolean remove(IHopFileTypeHandler typeHandler) {
return false;
}

@Override
public List<TabItemHandler> getItems() {
return null;
}

@Override
public List<ISearchable> getSearchables() {
List<ISearchable> searchables = new ArrayList<>();
return searchables;
}
}
Loading

0 comments on commit 05b2858

Please sign in to comment.