Skip to content

Commit

Permalink
Adding control panel section for Yatran
Browse files Browse the repository at this point in the history
- First control panel section based on SimpleFormSection and RegistryProxy added
  • Loading branch information
Michael Pozhidaev committed Dec 13, 2015
1 parent 987ab0e commit 7a6dded
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 2 deletions.
4 changes: 2 additions & 2 deletions yatran/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<target name="compile" depends="clean">
<mkdir dir="build"/>
<mkdir dir="build/main"/>
<javac srcdir="src/main/java" destdir="build/main" source="1.7" target="1.7">
<javac srcdir="src/main/java" destdir="build/main" source="1.8" target="1.8">
<classpath refid="classpath"/>
</javac>
</target>
Expand All @@ -42,7 +42,7 @@
<target name="compile-tests" depends="jar">
<mkdir dir="build"/>
<mkdir dir="build/tests"/>
<javac srcdir="src/tests/java" destdir="build/tests" source="1.7" target="1.7">
<javac srcdir="src/tests/java" destdir="build/tests" source="1.8" target="1.8">
<classpath>
<path refid="classpath"/>
<path refid="mainjar"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
Copyright 2012-2015 Michael Pozhidaev <[email protected]>
This file is part of the LUWRAIN.
LUWRAIN is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
LUWRAIN is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
*/

package org.luwrain.extensions.yatran;

import org.luwrain.core.*;
import org.luwrain.cpanel.*;

public class ControlPanelSection extends SimpleFormSection
{
public ControlPanelSection(Registry registry)
{
super("Яндекс.Переводчик", BasicSections.ROOT);
final RegistryParams params = RegistryProxy.create(registry, "/org/luwrain/extensions/yatran", RegistryParams.class);
addString("Ключ для доступа к сервису:", "", (name, value)->params.setKey(value));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,19 @@
public class Extension extends EmptyExtension
{
private TranslateRegion translateRegion = null;
private ControlPanelSection section = null;

@Override public Command[] getCommands(Luwrain luwrain)
{
if (translateRegion == null)
translateRegion = new TranslateRegion();
return new Command[]{translateRegion};
}

@Override public org.luwrain.cpanel.Section[] getControlPanelSections(Luwrain luwrain)
{
if (section == null)
section = new ControlPanelSection(luwrain.getRegistry());
return new org.luwrain.cpanel.Section[]{section};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
Copyright 2012-2015 Michael Pozhidaev <[email protected]>
This file is part of the LUWRAIN.
LUWRAIN is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
LUWRAIN is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
*/

package org.luwrain.extensions.yatran;

interface RegistryParams
{
String getKey();
void setKey(String value);
}

0 comments on commit 7a6dded

Please sign in to comment.