refs:3772: SAI - Create a github project importer
https://support.d4science.org/issues/3772 Added GitHubConnectorWizard git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/github-connector@129124 82a268e6-3cf1-43bd-a215-b396298e98cfmaster
@ -0,0 +1,187 @@
|
||||
package org.gcube.portlets.widgets.githubconnector.client;
|
||||
|
||||
import org.gcube.portlets.widgets.githubconnector.client.wizard.WizardCard;
|
||||
import org.gcube.portlets.widgets.githubconnector.shared.git.credential.GitHubCredential;
|
||||
import org.gcube.portlets.widgets.githubconnector.shared.git.credential.GitHubCredentialType;
|
||||
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||
import com.google.gwt.user.client.Command;
|
||||
import com.google.gwt.user.client.ui.DecoratorPanel;
|
||||
import com.google.gwt.user.client.ui.FlexTable;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.RadioButton;
|
||||
import com.google.gwt.user.client.ui.SimplePanel;
|
||||
import com.google.gwt.user.client.ui.TextBox;
|
||||
|
||||
public class GitHubConnectorCredentialCard extends WizardCard {
|
||||
|
||||
private GitHubCredential gitHubCredential;
|
||||
private GitHubCredentialType selected;
|
||||
private SimplePanel simplePanel;
|
||||
private FlexTable layout;
|
||||
private TextBox userName;
|
||||
private TextBox password;
|
||||
private TextBox token;
|
||||
//private DecoratorPanel decPanel;
|
||||
|
||||
public GitHubConnectorCredentialCard() {
|
||||
super("Credential", "Select the credentials to use");
|
||||
selected = GitHubCredentialType.Anonymous;
|
||||
|
||||
simplePanel = new SimplePanel();
|
||||
// Form
|
||||
layout = new FlexTable();
|
||||
layout.setCellSpacing(16);
|
||||
|
||||
userName = new TextBox();
|
||||
password = new TextBox();
|
||||
token = new TextBox();
|
||||
|
||||
// Add some standard form options
|
||||
HorizontalPanel hPanel = new HorizontalPanel();
|
||||
hPanel.setSpacing(10);
|
||||
|
||||
for (GitHubCredentialType type : GitHubCredentialType.values()) {
|
||||
|
||||
RadioButton radioButton = new RadioButton("credentialType",
|
||||
type.getLabel());
|
||||
radioButton.getElement().setAttribute("itemId", type.name());
|
||||
radioButton.ensureDebugId("radioButton-credentialType-"
|
||||
+ type.name());
|
||||
radioButton
|
||||
.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||
|
||||
@Override
|
||||
public void onValueChange(
|
||||
ValueChangeEvent<Boolean> event) {
|
||||
if (event.getValue()) {
|
||||
RadioButton radioButton = (RadioButton) event
|
||||
.getSource();
|
||||
String selectedCredential = radioButton
|
||||
.getElement().getAttribute("itemId");
|
||||
GWT.log("Selected Credential: "
|
||||
+ selectedCredential);
|
||||
if (selectedCredential != null) {
|
||||
selected = GitHubCredentialType
|
||||
.valueOf(selectedCredential);
|
||||
|
||||
if (selected != null) {
|
||||
switch (selected) {
|
||||
case Anonymous:
|
||||
GWT.log("Anonymous");
|
||||
setAnonymous();
|
||||
break;
|
||||
case Login:
|
||||
GWT.log("Login");
|
||||
setLogin();
|
||||
break;
|
||||
case OAuth2:
|
||||
GWT.log("OAuth2");
|
||||
setOAuth2();
|
||||
break;
|
||||
default:
|
||||
GWT.log("OAuth2");
|
||||
setAnonymous();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
selected = GitHubCredentialType.Anonymous;
|
||||
setAnonymous();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
if (type.compareTo(GitHubCredentialType.Anonymous) == 0) {
|
||||
radioButton.setValue(true);
|
||||
}
|
||||
|
||||
hPanel.add(radioButton);
|
||||
}
|
||||
|
||||
layout.setHTML(1, 0, "Type:");
|
||||
layout.setWidget(1, 1, hPanel);
|
||||
|
||||
// Wrap the content in a DecoratorPanel
|
||||
//decPanel = new DecoratorPanel();
|
||||
//decPanel.setWidget(layout);
|
||||
|
||||
simplePanel.add(layout);
|
||||
setContent(simplePanel);
|
||||
|
||||
}
|
||||
|
||||
private void setAnonymous() {
|
||||
if (selected.compareTo(GitHubCredentialType.Anonymous) != 0) {
|
||||
for (int i = 1; i <= layout.getRowCount(); i++) {
|
||||
layout.removeRow(i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setOAuth2() {
|
||||
if (selected.compareTo(GitHubCredentialType.OAuth2) != 0) {
|
||||
for (int i = 1; i <= layout.getRowCount(); i++) {
|
||||
layout.removeRow(i);
|
||||
}
|
||||
layout.setHTML(2, 0, "Token:");
|
||||
layout.add(token);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setLogin() {
|
||||
if (selected.compareTo(GitHubCredentialType.Login) != 0) {
|
||||
for (int i = 1; i <= layout.getRowCount(); i++) {
|
||||
layout.removeRow(i);
|
||||
}
|
||||
layout.setHTML(2, 0, "User:");
|
||||
layout.add(userName);
|
||||
|
||||
layout.setHTML(3, 0, "Password:");
|
||||
layout.add(password);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
Command sayNextCard = new Command() {
|
||||
|
||||
public void execute() {
|
||||
try {
|
||||
GWT.log("NextCard");
|
||||
getWizardWindow().nextCard();
|
||||
} catch (Exception e) {
|
||||
GWT.log("sayNextCard :" + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Command sayPreviousCard = new Command() {
|
||||
public void execute() {
|
||||
try {
|
||||
GWT.log("PreviousCard");
|
||||
getWizardWindow().previousCard();
|
||||
} catch (Exception e) {
|
||||
GWT.log("sayPreviousCard :" + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
||||
getWizardWindow().setNextButtonCommand(sayNextCard);
|
||||
|
||||
setEnableBackButton(false);
|
||||
setBackButtonVisible(false);
|
||||
setEnableNextButton(true);
|
||||
setNextButtonVisible(true);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package org.gcube.portlets.widgets.githubconnector.client;
|
||||
|
||||
|
||||
import org.gcube.portlets.widgets.githubconnector.client.wizard.WizardWindow;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class GitHubConnectorWizard extends WizardWindow {
|
||||
|
||||
public GitHubConnectorWizard() {
|
||||
super("GitHub Connector");
|
||||
GWT.log("GitHubConnectorWizard");
|
||||
create();
|
||||
}
|
||||
|
||||
private void create() {
|
||||
/*ApplyTableRuleSession applyTableRuleSession = new ApplyTableRuleSession();
|
||||
applyTableRuleSession.setTrId(trId);*/
|
||||
|
||||
GitHubConnectorCredentialCard CredentialCard = new GitHubConnectorCredentialCard();
|
||||
addCard(CredentialCard);
|
||||
CredentialCard.setup();
|
||||
|
||||
}
|
||||
}
|
@ -1,51 +1,32 @@
|
||||
package org.gcube.portlets.widgets.githubconnector.client.resource;
|
||||
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.resources.client.ClientBundle;
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public interface GCResources extends ClientBundle {
|
||||
|
||||
public static final GCResources INSTANCE=GWT.create(GCResources.class);
|
||||
|
||||
|
||||
public static final GCResources INSTANCE = GWT.create(GCResources.class);
|
||||
|
||||
@Source("Wizard.css")
|
||||
WizardCSS wizardCSS();
|
||||
|
||||
@Source("wizard-next_24.png")
|
||||
ImageResource wizardNext24();
|
||||
|
||||
@Source("wizard-previous_24.png")
|
||||
ImageResource wizardPrevious24();
|
||||
|
||||
@Source("wizard-go_24.png")
|
||||
ImageResource wizardGo24();
|
||||
|
||||
@Source("arrow-refresh.png")
|
||||
ImageResource refresh();
|
||||
|
||||
@Source("arrow-refresh_16.png")
|
||||
ImageResource refresh16();
|
||||
|
||||
|
||||
@Source("arrow-refresh_32.png")
|
||||
ImageResource refresh32();
|
||||
|
||||
@Source("wizard-next.png")
|
||||
ImageResource wizardNext();
|
||||
|
||||
@Source("wizard-next_32.png")
|
||||
ImageResource wizardNext32();
|
||||
|
||||
@Source("wizard-previous.png")
|
||||
ImageResource wizardPrevious();
|
||||
|
||||
@Source("wizard-previous_32.png")
|
||||
ImageResource wizardPrevious32();
|
||||
|
||||
@Source("wizard-go.png")
|
||||
ImageResource wizardGo();
|
||||
|
||||
@Source("wizard-go_32.png")
|
||||
ImageResource wizardGo32();
|
||||
|
||||
|
||||
@Source("tool-button-close_20.png")
|
||||
ImageResource toolButtonClose20();
|
||||
|
||||
}
|
||||
|
@ -1,43 +1,57 @@
|
||||
@CHARSET "UTF-8";
|
||||
|
||||
|
||||
.wizard-title {
|
||||
.wizard-card-title {
|
||||
padding: 5px;
|
||||
font-weight: bold;
|
||||
font-size: small;
|
||||
background-color: #C3D9FF;
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
|
||||
.wizard-footer {
|
||||
.wizard-card-footer {
|
||||
padding: 5px;
|
||||
font-weight: bold;
|
||||
font-size: x-small;
|
||||
text-align: left;
|
||||
background-color: #CDEB8B
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
|
||||
.source-selection-hover:hover {
|
||||
cursor: pointer;
|
||||
.wizard-previous-button-text {
|
||||
line-height: 24px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.wizard-previous-button-icon {
|
||||
vertical-align: middle;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.wizard-next-button-text {
|
||||
line-height: 24px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.column-excluded {
|
||||
background-color: #e6e0da !important;
|
||||
color: #bfa698;
|
||||
.wizard-next-button-icon {
|
||||
vertical-align: middle;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.importSelection-sources {
|
||||
padding: 30px;
|
||||
display: block;
|
||||
margin-top: 5px;
|
||||
.wizard-tool-button-text {
|
||||
margin-left: -20px;
|
||||
margin-top: 2px;
|
||||
|
||||
}
|
||||
|
||||
.importSelection-source {
|
||||
padding-bottom: 20px;
|
||||
.wizard-tool-button-text:hover {
|
||||
margin-left: -20px;
|
||||
margin-top: 0px;
|
||||
|
||||
}
|
||||
|
||||
|
||||
.wizard-tool-button-icon {
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.wizard-tool-button-icon:hover {
|
||||
height: 20px;
|
||||
border: 1px solid #222;
|
||||
}
|
Before Width: | Height: | Size: 781 B |
Before Width: | Height: | Size: 984 B |
Before Width: | Height: | Size: 572 B |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 701 B |
Before Width: | Height: | Size: 778 B |
Before Width: | Height: | Size: 771 B |
After Width: | Height: | Size: 809 B |
Before Width: | Height: | Size: 502 B |
After Width: | Height: | Size: 957 B |
Before Width: | Height: | Size: 656 B |
Before Width: | Height: | Size: 474 B |
After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 559 B |
Before Width: | Height: | Size: 431 B |
After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 573 B |