110 lines
3.2 KiB
Java
110 lines
3.2 KiB
Java
package org.gcube.portlets.widgets.githubconnector.client;
|
|
|
|
import com.google.gwt.core.shared.GWT;
|
|
import com.google.gwt.event.dom.client.ClickEvent;
|
|
import com.google.gwt.event.dom.client.ClickHandler;
|
|
import com.google.gwt.i18n.client.Constants;
|
|
import com.google.gwt.user.client.ui.Button;
|
|
import com.google.gwt.user.client.ui.DecoratorPanel;
|
|
import com.google.gwt.user.client.ui.DialogBox;
|
|
import com.google.gwt.user.client.ui.DockPanel;
|
|
import com.google.gwt.user.client.ui.FlexTable;
|
|
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
|
|
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
|
import com.google.gwt.user.client.ui.Image;
|
|
import com.google.gwt.user.client.ui.PushButton;
|
|
import com.google.gwt.user.client.ui.TextBox;
|
|
|
|
/**
|
|
*
|
|
* @author Giancarlo Panichi email: <a
|
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
*
|
|
*/
|
|
public class GitHubConnectorDialog extends DialogBox implements ClickHandler {
|
|
|
|
public static interface GitHubConnectorDialogConstants extends Constants {
|
|
|
|
@DefaultStringValue("Owner:")
|
|
String gitCDecoratorPanelFormOwner();
|
|
|
|
@DefaultStringValue("Name:")
|
|
String gitCDecoratorPanelFormRepository();
|
|
|
|
@DefaultStringValue("Repository")
|
|
String gitCDecoratorPanelFormTitle();
|
|
|
|
}
|
|
|
|
/**
|
|
* An instance of the constants.
|
|
*/
|
|
private final GitHubConnectorDialogConstants gitHubConnectorDialogConstants = GWT
|
|
.create(GitHubConnectorDialogConstants.class);
|
|
|
|
public GitHubConnectorDialog() {
|
|
setText("GitHub Connector");
|
|
setGlassEnabled(true);
|
|
setAnimationEnabled(true);
|
|
|
|
ClickHandler searchRepositoryClickHandler=new ClickHandler() {
|
|
|
|
@Override
|
|
public void onClick(ClickEvent event) {
|
|
//TODO
|
|
|
|
}
|
|
};
|
|
PushButton searchRepository = new PushButton(new Image(), searchRepositoryClickHandler);
|
|
|
|
|
|
// Form
|
|
FlexTable layout = new FlexTable();
|
|
layout.setCellSpacing(10);
|
|
FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();
|
|
|
|
// Add a title to the form
|
|
layout.setHTML(0, 0,
|
|
"<b>"+gitHubConnectorDialogConstants.gitCDecoratorPanelFormTitle()+"</b>");
|
|
cellFormatter.setColSpan(0, 0, 3);
|
|
cellFormatter.setHorizontalAlignment(0, 0,
|
|
HasHorizontalAlignment.ALIGN_CENTER);
|
|
|
|
// Add some standard form options
|
|
layout.setHTML(1, 0,
|
|
gitHubConnectorDialogConstants.gitCDecoratorPanelFormOwner());
|
|
layout.setWidget(1, 1, new TextBox());
|
|
layout.setWidget(1, 2, searchRepository);
|
|
|
|
layout.setHTML(2, 0, gitHubConnectorDialogConstants
|
|
.gitCDecoratorPanelFormRepository());
|
|
layout.setWidget(2, 1, new TextBox());
|
|
|
|
// Wrap the content in a DecoratorPanel
|
|
DecoratorPanel decPanel = new DecoratorPanel();
|
|
decPanel.setWidget(layout);
|
|
|
|
|
|
|
|
Button closeButton = new Button("Close", this);
|
|
|
|
/*HTML msg = new HTML(
|
|
"<center>A standard dialog box component.</center>", true);*/
|
|
|
|
DockPanel dock = new DockPanel();
|
|
dock.setSpacing(4);
|
|
|
|
dock.add(closeButton, DockPanel.SOUTH);
|
|
dock.add(decPanel, DockPanel.CENTER);
|
|
//dock.add(new HTML("images/yourImage.jpg"), DockPanel.CENTER);
|
|
|
|
dock.setCellHorizontalAlignment(closeButton, DockPanel.ALIGN_CENTER);
|
|
dock.setWidth("100%");
|
|
setWidget(dock);
|
|
}
|
|
|
|
@Override
|
|
public void onClick(ClickEvent event) {
|
|
hide();
|
|
}
|
|
} |